diff --git a/re/graphingwindow.cpp b/re/graphingwindow.cpp index 8056276..97e622b 100644 --- a/re/graphingwindow.cpp +++ b/re/graphingwindow.cpp @@ -586,6 +586,13 @@ void GraphingWindow::removeAllGraphs() } } +void GraphingWindow::rescaleToData() +{ + ui->graphingView->xAxis->rescale(true); + ui->graphingView->yAxis->rescale(true); + ui->graphingView->replot(); +} + void GraphingWindow::toggleFollowMode() { followGraphEnd = !followGraphEnd; @@ -627,6 +634,10 @@ void GraphingWindow::contextMenuRequest(QPoint pos) } menu->addSeparator(); menu->addAction(tr("Reset View"), this, SLOT(resetView())); + if (ui->graphingView->graphCount() > 0) + { + menu->addAction(tr("Rescale to data"), this, SLOT(rescaleToData())); + } menu->addAction(tr("Zoom In"), this, SLOT(zoomIn())); menu->addAction(tr("Zoom Out"), this, SLOT(zoomOut())); } diff --git a/re/graphingwindow.h b/re/graphingwindow.h index 664ad58..1502627 100644 --- a/re/graphingwindow.h +++ b/re/graphingwindow.h @@ -63,6 +63,7 @@ private slots: void saveSpreadsheet(); void saveDefinitions(); void loadDefinitions(); + void rescaleToData(); void toggleFollowMode(); void addNewGraph(); void createGraph(GraphParams ¶ms, bool createGraphParam = true);