From 8ac3204aa7911aec20967c4d57b92da027b1ad03 Mon Sep 17 00:00:00 2001 From: Nikita Kostovsky Date: Sun, 24 Nov 2024 09:55:29 +0100 Subject: add encoder --- QmlCustomPlot.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'QmlCustomPlot.cpp') 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 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()); +} -- cgit v1.2.3-70-g09d2