summaryrefslogtreecommitdiff
path: root/QmlCustomPlot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'QmlCustomPlot.cpp')
-rw-r--r--QmlCustomPlot.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/QmlCustomPlot.cpp b/QmlCustomPlot.cpp
index 48ec917..ef30b3f 100644
--- a/QmlCustomPlot.cpp
+++ b/QmlCustomPlot.cpp
@@ -58,6 +58,8 @@ void QmlCustomPlot::setPlot(QCustomPlot *plot)
m_plot->yAxis->setLabel("y");
m_plot->xAxis->setRange(-50, 50);
m_plot->yAxis->setRange(0, 100);
+ m_plot->xAxis->setRange(-640, 640);
+ m_plot->yAxis->setRange(0, 800);
m_plot ->setInteractions(QCP::iRangeDrag |
QCP::iRangeZoom |
QCP::iSelectPlottables |
@@ -73,11 +75,13 @@ void QmlCustomPlot::setPlot(QCustomPlot *plot)
m_profileGraph->setPen(QPen(QColor(Qt::red)));
}
- startTimer(1000 / 24);
+ startTimer(std::chrono::milliseconds(1000/60));
connect(m_plot, &QCustomPlot::afterReplot, this, &QmlCustomPlot::onCustomReplot);
m_plot->replot();
+
+ // m_plot->setPlottingHints(QCP::phNone);
}
void QmlCustomPlot::setPoints(const QVector<QVector2D> points)
@@ -333,3 +337,9 @@ void QmlCustomPlot::onCustomReplot()
m_fpsCounter++;
update();
}
+
+void QmlCustomPlot::setRange(const QRectF &range)
+{
+ m_plot->xAxis->setRange(range.left(), range.right());
+ m_plot->yAxis->setRange(range.bottom(), range.top());
+}