Hallo,
I would like to read & plot data, say every 1 sec (i.e new curve should replace the old one). I have plotted the graph (see attached figure) okay but when I use the timer an extra line (average?) appears on graph. At the moment it's reading the same data every 1 sec but later it will be replaced by new set of data.

Any idea why the extra line appears, and how to remove it?
Thank you.

Screenshot.jpg

Qt Code:
  1. Plot::Plot(QWidget *parent ): QwtPlot( parent )
  2. {
  3. ….
  4. …
  5. (void) startTimer(1000);// 1 sec
  6.  
  7. //populate(); //this works fine
  8.  
  9. connect( legend, SIGNAL( checked( const QVariant &, bool, int ) ),
  10. SLOT( legendChecked( const QVariant &, bool ) ) );
  11.  
  12. }
  13.  
  14. void Plot::populate()
  15. {
  16. ….Read data from a file…..
  17.  
  18. for ( int c = 0; c < 3; c++ )
  19. data[c].curve->setRawSamples(&timeData.front(), &yData[c].front(), timeData.size() );
  20.  
  21. }
  22.  
  23. void Plot::timerEvent(QTimerEvent *)
  24. {
  25. populate(); //Getting data for plotting
  26. replot(); // to refresh plot
  27. }
To copy to clipboard, switch view to plain text mode