Skip to content

Commit b5d2b25

Browse files
author
Mich
committed
Added auto-center on adding first graphs
2 parents 8f5c328 + 30a1f74 commit b5d2b25

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/mainwindow.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,17 @@ void MainWindow::on_comboBoxSendReturnPressedSlot()
504504
// Auto-scroll X and rescale Y
505505
void MainWindow::on_chartBeforeReplotSlot()
506506
{
507+
static bool isChartEmpty = false;
508+
if (ui->widgetChart->graphCount() > 0 && isChartEmpty == true)
509+
{
510+
isChartEmpty = false;
511+
ui->widgetChart->rescaleAxes(); // center plot if new graphs added to empty chart
512+
}
513+
else if (ui->widgetChart->graphCount() == 0)
514+
{
515+
isChartEmpty = true;
516+
}
517+
507518
if (ui->checkBoxAutoTrack->isChecked() && ui->widgetChart->graphCount() > 0)
508519
{
509520
if (parser.getListTimeStamp().count() > 0)

0 commit comments

Comments
 (0)