From cd2dfc1dac081dbb635729f9c580e77baba73493 Mon Sep 17 00:00:00 2001 From: Jan Grewe Date: Wed, 12 Sep 2018 17:44:35 +0200 Subject: [PATCH] playing around with adding data --- chart.cpp | 20 ++++++++++++++++---- mainwindow.cpp | 8 ++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/chart.cpp b/chart.cpp index 0b3d72e..0369edd 100644 --- a/chart.cpp +++ b/chart.cpp @@ -56,9 +56,21 @@ bool Chart::myWheelEvent(QGraphicsSceneWheelEvent *event) { } void Chart::XRangeChanged(qreal min, qreal max) { - std::cerr << "XRangeChanged" << min << "\t"<< max << std::endl; - if (series().at(0)->type() == QtCharts::QAbstractSeries::SeriesTypeLine) { - QLineSeries *s = static_cast(series().at(0)); - std::cerr << s->at(0).x() << "\t"<< s->at(s->count()-1).x() << std::endl; + std::cerr << "XRangeChanged" << min << "\t"<< max << std::endl; + if (series().at(0)->type() == QtCharts::QAbstractSeries::SeriesTypeLine) { + QLineSeries *s = static_cast(series().at(0)); + qreal xmax = s->at(s->count()-1).x(); + if (max > s->at(s->count()-1).x()) { + QList buffer; + + std::cerr << "new DATA!!!" << std::endl; + double si = s->at(1).x() - s->at(0).x(); + qreal currentx = xmax; + buffer.reserve(1000); + for (int i = 0; i < 1000; ++i) { + buffer.push_back({xmax + i * si, 0.0}); + } + s->append(buffer); } + } } diff --git a/mainwindow.cpp b/mainwindow.cpp index 3417c24..8f5286e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -25,11 +25,11 @@ MainWindow::MainWindow(QWidget *parent) : DataLoader *loader = new DataLoader(); loader->moveToThread(&dataQueue); dataQueue.start(); - //file = nix::File::open("/home/grewe/zwischenlager/2017-08-17-af-invivo-1/2017-08-17-af-invivo-1.nix", - // nix::FileMode::ReadOnly); - - file = nix::File::open("/Users/jan/zwischenlager/threading_test/dataservice/data/2017-08-17-af-invivo-1.nix", + file = nix::File::open("/home/grewe/zwischenlager/2017-08-17-af-invivo-1/2017-08-17-af-invivo-1.nix", nix::FileMode::ReadOnly); + + //file = nix::File::open("/Users/jan/zwischenlager/threading_test/dataservice/data/2017-08-17-af-invivo-1.nix", + //nix::FileMode::ReadOnly); nix::Block b = file.getBlock(0); this->voltage = b.getDataArray("V-1"); this->eod = b.getDataArray("EOD");