From 7f4567c1659771f4d47d50f9c86fd4b6751fe556 Mon Sep 17 00:00:00 2001 From: Grieb Date: Wed, 6 May 2015 16:42:40 -0300 Subject: [PATCH] Solves item 2 of #2267. And add top/botton margin in graphs. --- companion/src/logsdialog.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/companion/src/logsdialog.cpp b/companion/src/logsdialog.cpp index dccd4708f..3514c7d69 100644 --- a/companion/src/logsdialog.cpp +++ b/companion/src/logsdialog.cpp @@ -612,11 +612,8 @@ void logsDialog::plotLogs() y = logValue->text().toDouble(); plotCoords.y.push_back(y); - if (plotCoords.min_y > y) { - plotCoords.min_y = y; - } else if (plotCoords.max_y < y) { - plotCoords.max_y = y; - } + if (plotCoords.min_y > y) plotCoords.min_y = y; + if (plotCoords.max_y < y) plotCoords.max_y = y; if (time_str.contains('.')) { time = QDateTime::fromString(time_str, "yyyy-MM-dd HH:mm:ss.zzz") @@ -628,12 +625,15 @@ void logsDialog::plotLogs() } plotCoords.x.push_back(time); - if (plots.min_x > time) { - plots.min_x = time; - } else if (plots.max_x < time) { - plots.max_x = time; - } + if (plots.min_x > time) plots.min_x = time; + if (plots.max_x < time) plots.max_x = time; } + + double range_inc = (plotCoords.max_y - plotCoords.min_y) / 100; + if (range_inc == 0) range_inc = 1; + plotCoords.max_y += range_inc; + plotCoords.min_y -= range_inc; + plots.coords.append(plotCoords); }