[chart] emit newDataRequest on scroll

This commit is contained in:
Jan Grewe 2018-09-19 15:05:11 +02:00
parent cd2dfc1dac
commit 343e611fa4
2 changed files with 5 additions and 11 deletions

View File

@ -59,18 +59,8 @@ 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<QLineSeries *>(series().at(0));
qreal xmax = s->at(s->count()-1).x();
if (max > s->at(s->count()-1).x()) {
QList<QPointF> 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);
emit newDataRequest(this->entityId, max);
}
}
}

View File

@ -17,6 +17,7 @@ public:
~Chart();
bool sceneEvent(QEvent *event);
std::string entityId;
private:
bool gestureEvent(QGestureEvent *event);
@ -24,5 +25,8 @@ private:
public slots:
void XRangeChanged(qreal min, qreal max);
signals:
void newDataRequest(const std::string &entityId, qreal max);
};
#endif // CHART_H