diff options
| author | Nikita Kostovsky <nikita@kostovsky.me> | 2024-11-24 09:55:29 +0100 |
|---|---|---|
| committer | Nikita Kostovsky <nikita@kostovsky.me> | 2024-11-24 09:55:29 +0100 |
| commit | 8ac3204aa7911aec20967c4d57b92da027b1ad03 (patch) | |
| tree | 7459f5ee505ec96078e893cc8673e61bc77eb96e /QmlCustomPlot.cpp | |
| parent | 373fac3d442ccda77ad457075c95220511981840 (diff) | |
add encoder
Diffstat (limited to 'QmlCustomPlot.cpp')
| -rw-r--r-- | QmlCustomPlot.cpp | 12 |
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()); +} |
