QCustomPlot Discussion and Comments

problem with add dataReturn to overview


QVector<QCPGraphdata> my_data(100);
for(int i=0;i<100;i++)

but the problem is when i add this raw data to plot, already existed data become 0.
i also try
QCPGraphdata my_data;
for(int i=0;i<100;i++)

but the problem is same. can any one help me?

i'm pretty sure that you have an extra 'data()' in your code QCPGraph::data returns a qSharedPointer to a QCPDataContainer. you should be able to just do graph(0)->data()->add(my_data). this is because -> automatically dereferences the sharedpointer and gives you the datacontainer.

the top version is definitely wrong though ,because you are adding 100 points 100 times sequentially, which is different from the bottom which only adds 100 points.

thanks lan. your second point is right. it is a type mistake in my post. the first code-part dont has any for loop.
but the first point: can you test it on your Qt? because the "add" function just exist under ->data().data()-> .