@@ -318,7 +318,6 @@ void PageRtData::timerSlot()
318318 ui->tempPlot ->graph (graphIndex)->setName (" Temperature Motor" );
319319 ui->tempPlot ->graph (graphIndex)->setData (xAxis, mTempMotorVec );
320320 ui->tempPlot ->graph (graphIndex)->setVisible (ui->tempShowMotorBox ->isChecked ());
321- graphIndex++;
322321
323322 // RPM plot
324323 graphIndex = 0 ;
@@ -331,17 +330,36 @@ void PageRtData::timerSlot()
331330 ui->focPlot ->graph (graphIndex++)->setData (xAxis, mVdVec );
332331 ui->focPlot ->graph (graphIndex++)->setData (xAxis, mVqVec );
333332
333+ // Check if we should rescale the graphs
334334 if (ui->autoscaleButton ->isChecked ()) {
335- ui->currentPlot ->rescaleAxes ();
336- ui->tempPlot ->rescaleAxes ();
337- ui->rpmPlot ->rescaleAxes ();
338- ui->focPlot ->rescaleAxes ();
335+ // Only rescale if visible
336+ if (ui->focPlot ->isVisible ()) {
337+ ui->focPlot ->rescaleAxes ();
338+ }
339+ if (ui->tempPlot ->isVisible ()) {
340+ ui->tempPlot ->rescaleAxes ();
341+ }
342+ if (ui->rpmPlot ->isVisible ()) {
343+ ui->rpmPlot ->rescaleAxes ();
344+ }
345+ if (ui->focPlot ->isVisible ()) {
346+ ui->focPlot ->rescaleAxes ();
347+ }
339348 }
340349
341- ui->currentPlot ->replot ();
342- ui->tempPlot ->replot ();
343- ui->rpmPlot ->replot ();
344- ui->focPlot ->replot ();
350+ // Only replot if the graph is visible
351+ if (ui->focPlot ->isVisible ()) {
352+ ui->focPlot ->replot ();
353+ }
354+ if (ui->currentPlot ->isVisible ()) {
355+ ui->currentPlot ->replot ();
356+ }
357+ if (ui->tempPlot ->isVisible ()) {
358+ ui->tempPlot ->replot ();
359+ }
360+ if (ui->rpmPlot ->isVisible ()) {
361+ ui->rpmPlot ->replot ();
362+ }
345363
346364 mUpdateValPlot = false ;
347365 }
@@ -359,7 +377,10 @@ void PageRtData::timerSlot()
359377 ui->posPlot ->rescaleAxes ();
360378 }
361379
362- ui->posPlot ->replot ();
380+ // Only replot if the graph is visible
381+ if (ui->posPlot ->isVisible ()) {
382+ ui->posPlot ->replot ();
383+ }
363384
364385 mUpdatePosPlot = false ;
365386 }
@@ -399,7 +420,10 @@ void PageRtData::timerSlot()
399420 ui->experimentPlot ->rescaleAxes ();
400421 }
401422
402- ui->experimentPlot ->replot ();
423+ // Only replot if the graph is visible
424+ if (ui->experimentPlot ->isVisible ()) {
425+ ui->experimentPlot ->replot ();
426+ }
403427 mExperimentReplot = false ;
404428 }
405429}
@@ -540,17 +564,27 @@ void PageRtData::on_zoomVButton_toggled(bool checked)
540564
541565void PageRtData::on_rescaleButton_clicked ()
542566{
543- ui->currentPlot ->rescaleAxes ();
544- ui->tempPlot ->rescaleAxes ();
545- ui->rpmPlot ->rescaleAxes ();
546- ui->focPlot ->rescaleAxes ();
547- ui->posPlot ->rescaleAxes ();
548-
549- ui->currentPlot ->replot ();
550- ui->tempPlot ->replot ();
551- ui->rpmPlot ->replot ();
552- ui->focPlot ->replot ();
553- ui->posPlot ->replot ();
567+ // Only rescale/replot if the graph is visible
568+ if (ui->posPlot ->isVisible ()) {
569+ ui->posPlot ->rescaleAxes ();
570+ ui->posPlot ->replot ();
571+ }
572+ if (ui->currentPlot ->isVisible ()) {
573+ ui->currentPlot ->rescaleAxes ();
574+ ui->currentPlot ->replot ();
575+ }
576+ if (ui->tempPlot ->isVisible ()) {
577+ ui->tempPlot ->rescaleAxes ();
578+ ui->tempPlot ->replot ();
579+ }
580+ if (ui->rpmPlot ->isVisible ()) {
581+ ui->rpmPlot ->rescaleAxes ();
582+ ui->rpmPlot ->replot ();
583+ }
584+ if (ui->focPlot ->isVisible ()) {
585+ ui->focPlot ->rescaleAxes ();
586+ ui->focPlot ->replot ();
587+ }
554588}
555589
556590void PageRtData::on_posInductanceButton_clicked ()
0 commit comments