do not rescale y axis of graphing window when changing graph parameters

This commit is contained in:
Leopixelo
2026-06-08 15:03:38 +02:00
parent 1ac843ed3d
commit 539031d5b2
2 changed files with 7 additions and 5 deletions
+5 -3
View File
@@ -1225,7 +1225,7 @@ void GraphingWindow::showParamsDialog(int idx = -1)
//create a new graph with the returned parameters. //create a new graph with the returned parameters.
GraphParams params; GraphParams params;
thisDialog->getParams(params); thisDialog->getParams(params);
createGraph(params); createGraph(params, true, false);
} }
delete thisDialog; delete thisDialog;
} }
@@ -1322,7 +1322,7 @@ void GraphingWindow::appendToGraph(GraphParams &params, CANFrame &frame, QVector
} }
} }
void GraphingWindow::createGraph(GraphParams &params, bool createGraphParam) void GraphingWindow::createGraph(GraphParams &params, bool createGraphParam, bool recalcY)
{ {
int64_t tempVal; //64 bit temp value. int64_t tempVal; //64 bit temp value.
double yminval=10000000.0, ymaxval = -1000000.0; double yminval=10000000.0, ymaxval = -1000000.0;
@@ -1561,8 +1561,10 @@ void GraphingWindow::createGraph(GraphParams &params, bool createGraphParam)
ui->graphingView->xAxis->setRange(xminval, xmaxval); ui->graphingView->xAxis->setRange(xminval, xmaxval);
ui->graphingView->axisRect()->setupFullAxesBox(); ui->graphingView->axisRect()->setupFullAxesBox();
} }
//always recalculate Y range so that new graphs actually show up in view //almost always recalculate Y range so that new graphs actually show up in view
if (recalcY) {
ui->graphingView->yAxis->setRange(yminval, ymaxval); ui->graphingView->yAxis->setRange(yminval, ymaxval);
}
ui->graphingView->replot(); ui->graphingView->replot();
} }
+1 -1
View File
@@ -56,7 +56,7 @@ public:
void showEvent(QShowEvent*); void showEvent(QShowEvent*);
public slots: public slots:
void createGraph(GraphParams &params, bool createGraphParam = true); void createGraph(GraphParams &params, bool createGraphParam = true, bool recalcY = true);
private slots: private slots:
void titleDoubleClick(QMouseEvent *event, QCPTextElement *title); void titleDoubleClick(QMouseEvent *event, QCPTextElement *title);