QCustomPlot Discussion and Comments

Independent Axis DraggingReturn to overview

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, 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)

	// 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)


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.

Any chance that somewhere else in your code you have connected the yAxis2 setRange to the yAxis rangeChanged and/or vice versa?
This connection is also made if you call

Thank you for your quick reply!

That is the issue, I call wideAxisRect->setupFullAxesBox(true);.
I was unaware that such also connects the ranges.

What is the best workaround?
To just add each axis separately?

I solved it.

I didn't even have to add each axis separately. I simply commented out that line of code and everything works as intended.

Thanks again!