PDA

View Full Version : Update axes in QLineSeries



Eduardo Huerta
16th December 2018, 06:04
I have a function that updates the X and Y ranges in real time and allows to visualize all the data of 5 QLineSeries. This function works correctly when I graph 5 QLineseries in a single window, but it works incorrectly when I add other QLineSeries in other windows (see image). I have observed that the X axis does not have this problem, but I suppose it is because the data in the X axis are the same in all the windows (I graphic in each window against time). My question is, how can I correctly update the Y axis of each window?

void setRange(QChart *mChart, qreal xValue, QVector<double> yValue)
This function receives the QChart of the window where the QLineSeries are plotted, the data of the X axis and a vector with the minimum and maximum value of the Y axis. I thought that with the QChart of each window it was enough to update the Y axis of each window , but I think that is not enough.
Thanks for help me.

d_stranz
18th December 2018, 15:56
You will have to post enough of your code so that we can see what you are doing and hopefully find what you are doing wrong. It isn't even apparent from your screen shots what you think is wrong. It looks like 4 perfectly good plots to me.

Eduardo Huerta
19th December 2018, 03:09
You will have to post enough of your code so that we can see what you are doing and hopefully find what you are doing wrong. It isn't even apparent from your screen shots what you think is wrong. It looks like 4 perfectly good plots to me.

Thanks I solved the problem, it was a global variable that was incorrect.