• 7300阅读
  • 1回复

qcustomplot  如何控制根据指定的比例缩放坐标轴 [复制链接]

上一主题 下一主题
离线zhuifengwy
 

只看楼主 倒序阅读 楼主  发表于: 2016-01-13
关键词: 缩放
请教一下各位大神,qcustomplot  如何根据指定的比例缩放坐标轴,比如 已有一幅曲线图,
设置y轴 在现有基础上以2倍的比例进行放大或者缩小,x轴不变???
离线xiaoniede

只看该作者 1楼 发表于: 2016-05-10
    ///方法1 以鼠标当前位置为中心点进行放大缩小
    ui->customplot->axisRect()->setRangeZoomFactor(2);
    ui->customplot->axisRect()->setRangeZoom(Qt::Vertical);

   ///方法2 链接mouseWheel信号进行处理(如果不以鼠标为中心,以Y轴中心点为中心)


    double dCenter = ui->customplot->xAxis->range().center();
    ///扩大区间 (缩小 plottables 鼠标向内滚动)
    ui->customplot->xAxis->scaleRange(2.0, dCenter);
    ///缩小区间 (放大 plotTables 鼠标向外滚动)  
    ui->customplot->xAxis->scaleRange(0.5, dCenter);
快速回复
限100 字节
 
上一个 下一个