Hello everyone!
I am new to qwt and I am facing a problem that when I refresh my graph after 10 seconds my old graph is removed and new is plotted. What I want though is that my previous graph is retained and new values get plotted into the existing plot. Is there a way to do this?
Here is my code (its just start code I have to so improvements in it also the data is large i can not plot it again from the start)
Kindly help me, here is the code :
double xs[100];
double yT[100];
double yP[100];
static int j=0;
myplot::myplot()
{
// add curves
QwtPlotCurve *curveT = new QwtPlotCurve("Temperature");
curveT->setPen(QPen(Qt::red,1));
QwtPlotCurve *curveP = new QwtPlotCurve("Pressure");
curveP->setPen(QPen(Qt::green,1));
for (int i = 0; i < 100; i ++)
{
xs[i] = j;
yT[i] = j;
yP[i] = j+10;
j++;
}
curveT->setRawSamples(xs,yT,100);
curveP->setRawSamples(xs,yP,100);
curveT->attach(this);
curveP->attach(this);
(void)startTimer(1000);
}
void myplot::newValues()
{
for (int i = 0; i < 100; i ++)
{
xs[i] = j+20;
yT[i] = j+20;
yP[i] = j+30;
j++;
}
}
void myplot::timerEvent(QTimerEvent * )
{
newValues();
replot();
}
Bookmarks