Hello,
I am trying to plot (realtime) some lines for some sensor data without removing the older lines on the QwtPlot object from the past.

Qt Code:
  1. m_Gui.guiQwtPlot->setTitle(title);
  2. m_Gui.guiQwtPlot->setCanvasBackground(* new QBrush(Qt::black));
  3. m_Gui.guiQwtPlot->setAxisScale(QwtPlot::yLeft, -30.0, 30.0);
  4. m_Gui.guiQwtPlot->insertLegend(new QwtLegend());
  5. m_Gui.guiQwtPlot->legend()->setFont(fontNormal);
  6. m_Gui.guiQwtPlot->setFont(fontNormal);
  7. m_Gui.guiQwtPlot->setAxisFont(QwtPlot::yLeft, fontNormal);
  8. m_Gui.guiQwtPlot->setAxisFont(QwtPlot::xBottom, fontNormal);
  9. m_Gui.guiQwtPlot->setAxisScaleDraw(QwtPlot::xBottom, new TimeScaleDraw(QTime::currentTime()));
  10. m_Gui.guiQwtPlot->setAxisLabelRotation(QwtPlot::xBottom, 0.0);
  11. m_Gui.guiQwtPlot->setAxisLabelAlignment(QwtPlot::xBottom,Qt::AlignLeft|Qt::AlignBottom);
  12. m_Gui.guiQwtPlot->setAxisTitle(QwtPlot::xBottom, axisTitleBottom);
  13. m_Gui.guiQwtPlot->setAxisTitle(QwtPlot::yLeft, axisTitleLeft);
  14.  
  15. QwtPlotMagnifier *plotM= new QwtPlotMagnifier(m_Gui.guiQwtPlot->canvas());
  16. plotM->setMouseButton(Qt::NoButton);
  17.  
  18. QwtPlotPanner *plotP= new QwtPlotPanner(m_Gui.guiQwtPlot->canvas());
To copy to clipboard, switch view to plain text mode 

In every 5 seconds I get new data from sensors and for each sensor I create a QwtPlotCurve then update my sensor-data with setSamples(points)

Qt Code:
  1. void pcaPlotting::updateDataSlot(QString sensorId, QPolygonF points)
  2. {
  3. QMap<QString, QwtPlotCurve*> m_PlotC;
  4. QStringList m_SensorNameList
  5.  
  6. for(unsigned int i= 0; i< m_SensorNameList.count(); ++i)
  7. {
  8. m_PlotC[m_SensorNameList.at(i)]= new QwtPlotCurve();
  9. m_PlotC[m_SensorNameList.at(i)]->setRenderHint(QwtPlotItem::RenderAntialiased, true);
  10. m_PlotC[m_SensorNameList.at(i)]->setCurveAttribute(QwtPlotCurve::Fitted);
  11. }
  12. m_PlotC[sensorId]->setSamples(points);
  13.  
  14. emit updatePlotSignal(m_PlotC);
  15. }
To copy to clipboard, switch view to plain text mode 

Finally I update my plot over signal/slot

Qt Code:
  1. void mainGui::updatePlotSlot(QMap<QString, QwtPlotCurve*> plotC)
  2. {
  3. for(QMap<QString, QwtPlotCurve*>::iterator it= plotC.begin(); it!= plotC.end(); ++it)
  4. {
  5. plotC[it.key()]->attach(m_Gui.guiQwtPlot);
  6. m_Gui.guiQwtPlot->replot();
  7. }
  8. }
To copy to clipboard, switch view to plain text mode 

My problem is: it plots only the data, those I got in 5 sec and then the lines are replaced with the new data after 5 sec. What should I do, so that the lines will not be replaced and increased until I stop drawing?
May be second question: The drawn data is not centered to the QwtPlot-window, it overflows in +y-axis, if the data is higher then the set boundaries setAxisScale(QwtPlot::yLeft, -30.0, 30.0); How can I draw in the center of y-axis, so that the size of the QwtPlot does not matter.

Thank you