void PlotWindow::realtimeDataSlot(double value0) { double key = QDateTime::currentDateTime().toMSecsSinceEpoch()/1000.0; plot_ui->customPlot->graph(0)->addData(key, value0); plot_ui->customPlot->graph(1)->clearData(); plot_ui->customPlot->graph(1)->addData(key, value0); plot_ui->customPlot->graph(0)->removeDataBefore(key-10); plot_ui->customPlot->xAxis->setRange(key+0.25, 10, Qt::AlignRight); plot_ui->customPlot->replot(); }