一、改变范围
QCustomPlot *customplot;
customplot->setInteraction(QCP::iRangeDrag,true);
使控件能够拖拉。
customplot->axisRect()->setRangeDrag(Qt::Vertical);// Qt::Horizontal
使控件只能在某一方向上拖拉,默认是水平和垂直都支持。
customplot->setInteraction(QCP::iRangeZoom,true);
使控件能够伸缩。
customplot->axisRect()->setRangeZoomAxes(QCPAxis * horizontal, QCPAxis * vertical);
设置伸缩的坐标轴。
customplot->axisRect()->setRangeZoom();
设置伸缩的方向。默认水平和垂直都可以。
customplot->axisRect()->setRangeZoomFactor();
设置伸缩比例,可设置成一样的,也可分别对水平和垂直进行设置。
二、选择图元
customplot->setInteraction(QCP::iSelectPlottables,true);
将图元设置成可选择的。
在setInteraction函数中可开启的有上图这些。
customplo