QCustomPlot Discussion and Comments

Runtime Plot: one sample per minuteReturn to overview


I have a problem: I want to make a "Runtime Plot", but with period of plotting equal to one minute.
I tried to change the key (double key = QDateTime::currentDateTime().toMSecsSinceEpoch()/60000.0) and I got a correct plot, but I had wrong reference for time in the "Tick Label" (I used QCPAxis::LtDateTime with setDateTimeFormat("hh:mm:ss"))

thank you!!!

Your dividing by 60000 causes the time axis to be wrong. The key value must be in seconds, and in the original code a millisecond value (returned by toMSecsSinceEpoch) is converted to seconds by dividing by 1000. Changing this to 60000 just makes the time value... well...wrong.

What you probably want to do is change the timer interval that calls the data update slot to 60000 instead of 0. Because 0 means update as fast as possible.

Thank you DerManu!

Yes, you are right about my mistake....but I still don't know how to fix the problem.

I can't change the interval that calls the data update slot.. I take the value from a UDP datagram (one datagram per minute), so I call the data update when the datagram is available..

If I don't change nothing in the code (original dividing by 1000 instead of 60000), the values are corretly added, but the "range" of my plotting is too small..for example with one value per minute I see just one value in the plot! I would like to expand my range..and I would be able to see more values in the plot (for example twenty).
When I divide by 60000 instead of 1000, I see a good plot..many values in a single plot, but I have that problem with the label of the time value...

any idea??