@@ -37,7 +37,6 @@ void MainWindow::setupTable()
37
37
void MainWindow::processTable (QStringList labels, QList<double > values)
38
38
{
39
39
static QList<int > tableMissingCount;
40
- static QList<int > tableIntervalList;
41
40
42
41
foreach (auto label, labels)
43
42
{
@@ -473,7 +472,7 @@ void MainWindow::createChart()
473
472
connect (ui->widgetChart , SIGNAL (mousePress (QMouseEvent *)), this , SLOT (chartMousePressHandler (QMouseEvent *)));
474
473
connect (ui->widgetChart , SIGNAL (selectionChangedByUser ()), this , SLOT (chartSelectionChanged ()));
475
474
connect (ui->widgetChart , SIGNAL (customContextMenuRequested (QPoint)), this , SLOT (chartContextMenuRequest (QPoint)));
476
- connect (ui->widgetChart , SIGNAL (beforeReplot ()), this , SLOT (chartRunAutoTrackSlot ()));
475
+ connect (ui->widgetChart , SIGNAL (beforeReplot ()), this , SLOT (chartBeforeReplotSlot ()));
477
476
478
477
// ui->widgetChart->setNotAntialiasedElements(QCP::aeAll);
479
478
@@ -484,7 +483,8 @@ void MainWindow::createChart()
484
483
}
485
484
}
486
485
487
- void MainWindow::chartRunAutoTrackSlot ()
486
+ // Auto-scroll X and rescale Y
487
+ void MainWindow::chartBeforeReplotSlot ()
488
488
{
489
489
if (ui->checkBoxAutoTrack ->isChecked () && ui->widgetChart ->graphCount () > 0 )
490
490
{
@@ -496,15 +496,23 @@ void MainWindow::chartRunAutoTrackSlot()
496
496
497
497
if (ui->checkBoxAutoRescaleY ->isChecked ())
498
498
{
499
- bool atLeastOneGraphVisible = false , onlyFlatGraphsVisible = false ;
499
+ bool atLeastOneGraphVisible = false , atLeastOneNotFlat = false ;
500
500
501
501
for (auto i = 0 ; i < ui->widgetChart ->graphCount (); ++i)
502
502
{
503
503
if (ui->widgetChart ->graph (i)->visible ())
504
+ {
504
505
atLeastOneGraphVisible = true ;
506
+
507
+ bool foundRange = false ;
508
+ QCPRange valueRange = ui->widgetChart ->graph (i)->data ().data ()->valueRange (foundRange);
509
+
510
+ if (foundRange && abs (valueRange.upper - valueRange.lower ) >= 0.1 )
511
+ atLeastOneNotFlat = true ;
512
+ }
505
513
}
506
514
507
- if (atLeastOneGraphVisible == true ) // * && onlyFlatGraphsVisible == false*//
515
+ if (atLeastOneGraphVisible && atLeastOneNotFlat)
508
516
{
509
517
ui->widgetChart ->yAxis ->rescale (true );
510
518
ui->widgetChart ->yAxis ->scaleRange (1.20 );
@@ -715,9 +723,9 @@ void MainWindow::showPointValue(QMouseEvent *event)
715
723
" <td>Y: %L3</td>"
716
724
" </tr>"
717
725
" </table>" )
718
- .arg (graph->name ())
719
- .arg (QTime::fromMSecsSinceStartOfDay (temp.x () * 1000 ).toString (" hh:mm:ss:zzz" ))
720
- .arg (QString::number (temp.y (), ' f' , 5 )),
726
+ .arg (graph->name ())
727
+ .arg (QTime::fromMSecsSinceStartOfDay (temp.x () * 1000 ).toString (" hh:mm:ss:zzz" ))
728
+ .arg (QString::number (temp.y (), ' f' , 5 )),
721
729
ui->widgetChart , ui->widgetChart ->rect ());
722
730
}
723
731
@@ -866,9 +874,9 @@ void MainWindow::processChart(QStringList labelList, QList<double> numericDataLi
866
874
}
867
875
868
876
if (canAddGraph && ui->widgetChart ->graphCount () < ui->spinBoxMaxGraphs ->value () &&
869
- ((ui->comboBoxGraphDisplayMode ->currentIndex () == 0 ) ||
870
- (ui->comboBoxGraphDisplayMode ->currentIndex () == 1 &&
871
- ui->lineEditCustomParsingRules ->text ().simplified ().contains (label, Qt::CaseSensitivity::CaseSensitive))))
877
+ ((ui->comboBoxGraphDisplayMode ->currentIndex () == 0 ) ||
878
+ (ui->comboBoxGraphDisplayMode ->currentIndex () == 1 &&
879
+ ui->lineEditCustomParsingRules ->text ().simplified ().contains (label, Qt::CaseSensitivity::CaseSensitive))))
872
880
{
873
881
ui->widgetChart ->addGraph ();
874
882
ui->widgetChart ->graph ()->setName (label);
@@ -1010,6 +1018,11 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
1010
1018
ui->checkBoxShowLegend ->toggle ();
1011
1019
}
1012
1020
}
1021
+
1022
+ if (event->key () == Qt::Key_F1)
1023
+ {
1024
+ QWhatsThis::enterWhatsThisMode ();
1025
+ }
1013
1026
}
1014
1027
1015
1028
void MainWindow::sendSerial (QString message)
@@ -2018,3 +2031,8 @@ void MainWindow::on_pushButtonSaveRAMBuffer_clicked()
2018
2031
2019
2032
parser.appendSetToMemory (newlabelList, newDataList, newTimeList, text);
2020
2033
}
2034
+
2035
+ void MainWindow::on_actionUser_guide_triggered ()
2036
+ {
2037
+ QWhatsThis::enterWhatsThisMode ();
2038
+ }
0 commit comments