I am trying to make the graph so that only the selected axes drag/zoom.
I have these interactions set: QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes | QCP::iMultiSelect
. So that multiple axes can be selected and drug accordingly.
To enable the dragging I have:
void Graph::axisEvent() { // empty list that will hold all axis to drag QList<QCPAxis *> axis; // tie the two bottom axis togeather and add them to the dragable list if (ui.customPlot->xAxis->selectedParts().testFlag(QCPAxis::spAxis) || ui.customPlot->axisRect()->axis(QCPAxis::atBottom, 1)->selectedParts().testFlag(QCPAxis::spAxis)) { //if (axis.indexOf(ui.customPlot->axisRect()->axis(QCPAxis::atBottom)) == -1 || axis.indexOf(ui.customPlot->axisRect()->axis(QCPAxis::atBottom, 1)) == -1) { axis.append(ui.customPlot->axisRect()->axis(QCPAxis::atBottom)); axis.append(ui.customPlot->axisRect()->axis(QCPAxis::atBottom, 1)); } } // add the y axis to the dragable list if (ui.customPlot->yAxis->selectedParts().testFlag(QCPAxis::spAxis)) { //if (axis.indexOf(ui.customPlot->axisRect()->axis(QCPAxis::atLeft)) == -1) { axis.append(ui.customPlot->axisRect()->axis(QCPAxis::atLeft)); } } // add the y2 axis to the dragable list if (ui.customPlot->yAxis2->selectedParts().testFlag(QCPAxis::spAxis)) { //if (axis.indexOf(ui.customPlot->axisRect()->axis(QCPAxis::atRight)) == -1) { axis.append(ui.customPlot->axisRect()->axis(QCPAxis::atRight)); } } ui.customPlot->axisRect()->setRangeDragAxes(axis); ui.customPlot->axisRect()->setRangeZoomAxes(axis); }
So, why does this not work?
It recognizes the selected axes, and adds them to the list accordingly. I have traced that all the way into qcustomplot.cpp.
If yAxis2 is selected it will drag by itself.
But, if yAxis is selected, it makes yAxis2 align (both 0's move to the same point), and then they scroll together.
Avoiding that was the whole reason of writing axisEvent.
Anyone have an idea of what the issue is?
Please note: I am using qcustomplot 2.0, so I am afraid it may be an issue within the beta.