I calculate the data to plot the graph from some mathematics equations and keep them in a vector. One parameter used for calculation is time which is extracted from computer time. So for 1 sec, I get something like 300 points.

One solution I can think of is I collect the data into multidimensional vector where row is time and column is data. Then read each row every second and use paintevent to draw the graph.

Are there any better methods?

Or how can I create multidimentional vector? I can get one vector, no problem but how can I get them pile up.

Until now I can draw the graph. I have a problem with updating them each second.

Thank you.

]]>I calculate the data to plot the graph from some mathematics equations and keep them in a vector. One parameter used for calculation is time which is extracted from computer time. So for 1 sec, I get something like 300 points.

One solution I can think of is I collect the data into multidimensional vector where row is time and column is data. Then read each row every second and use paintevent to draw the graph.

Are there any better methods?

Or how can I create multidimentional vector? I can get one vector, no problem but how can I get them pile up.

Until now I can draw the graph. I have a problem with updating them each second.

Thank you.

]]>What kind of graph is that?

Have you considered using a plot widget ?

like

http://www.qcustomplot.com/

http://qwt.sourceforge.net/

to get zooming etc for free?

anyway.

I wonder instead of multi vector then a data class?

class GData {

std:.vector<double> data;

};

std:.vector<GData> GraphsUpdates;

Then you could store more.

But im not 100% sure why you need to pile them up ?

If you have 1 sec to draw the points, should be fine or ?

Thank you for your suggestion. I will take a look on those plot widgets and class.

But im not 100% sure why you need to pile them up ?

I store my 360 points xy into QVector and use QPainter to draw it. I was thinking of triggering every row each second so that the graph would update as said.

]]>First I calculate the graph using the date and time provided by QDateTime. The 360 points xy are kept in vectorA. I copy vectorA into vectorB and use vectorB to draw the graph using QPainter and QPainterPath to fill the upper area.

Thank you.

]]>