QCustomPlot Discussion and Comments

I don't want the data sortedReturn to overview

What should I do?
QCPGraph* curGraph;

The first Keyvalue is not (5,7)?????
I don't want the data sorted

it seems there is no method to achieve this. the data is always sorted in order to correctly plot. if you really want to do this, you can first add all the data to a vector<double>,and then

curGraph->(myVector, true);

but this will cause badly plot.

maybe you should give me a reason why you need the data not be sorted or you can just use an unsorted copy of your data by another vector.

the code above is wrong, the right one is

curGraph->addData(myKeyVector, my ValueVector, true)

"true" meas the data in the vector is already sorted, so the addData function will not sort it.

You can achieve what you want by using QCPCurve instead of QCPGraph.

A QCPGraph is always sorted by key. If you use the addData method with sorted=true as suggested above, you HAVE to ensure the data points you are passing in are already sorted. It is not a way to insert unsorted data, as QCPGraph relies on the sorted nature of the data.

So as mentioned, if you want your plotted lines to strictly follow the order of data point insertion, use QCPCurve instead.