Enable rubber-band zooming in charts
authorMilian Wolff <mail@milianw.de>
Sun, 12 Mar 2017 19:59:28 +0000 (20:59 +0100)
committerMilian Wolff <mail@milianw.de>
Sun, 2 Apr 2017 18:32:45 +0000 (20:32 +0200)
Left-click and hold to create a rubber band zoom area which will
then be shown. Right-click to undo the last zoom change.

Note that this does not (yet) influence the other data aggregations.

src/analyze/gui/chartwidget.cpp

index e8a379e88336e3cd1c9df5745babc35d21418b5b..a04780496471bb96b9d05c0997bc38f3f8ba69ef 100644 (file)
@@ -82,6 +82,11 @@ ChartWidget::ChartWidget(QWidget* parent)
     auto layout = new QVBoxLayout(this);
     layout->addWidget(m_chart);
     setLayout(layout);
+
+    auto* coordinatePlane = dynamic_cast<CartesianCoordinatePlane*>(m_chart->coordinatePlane());
+    Q_ASSERT(coordinatePlane);
+    coordinatePlane->setRubberBandZoomingEnabled(true);
+    coordinatePlane->setAutoAdjustGridToZoom(true);
 }
 
 ChartWidget::~ChartWidget() = default;