QCustomPlot Discussion and Comments

Multiple axis: Displays in the reverse order compared to the order in the legendReturn to overview

My application is using multiple axes on the left side. I add a graph and a related axis for each of my parameters and have them automatically added to the legend (which is set to be a horizontal bar on the bottom).

The legend shows the parameters in the order I inserted them from left to right. The axes are shown in the reverse order. Last added axis is on the leftmost end.

I'd like the order to be consistent.

I have not been able to find a way to reverse the order the axes are shown, or reverse the order in the legend to make them match.

Is there a way to reverse either of these to align the order?

a legend is just a subclass of a QCPLayout, so I think you should just be able to move it roughly like this:

auto item = legend->takeAt(...last index after inserting...)
legend->insertRow(0)
legend->addElement(0, 0, item)
legend->simplify()