Solves item 2 of #2267. And add top/botton margin in graphs.

This commit is contained in:
Grieb
2015-05-21 22:08:44 -03:00
parent 3929ea7845
commit 7f4567c165
+10 -10
View File
@@ -612,11 +612,8 @@ void logsDialog::plotLogs()
y = logValue->text().toDouble(); y = logValue->text().toDouble();
plotCoords.y.push_back(y); plotCoords.y.push_back(y);
if (plotCoords.min_y > y) { if (plotCoords.min_y > y) plotCoords.min_y = y;
plotCoords.min_y = y; if (plotCoords.max_y < y) plotCoords.max_y = y;
} else if (plotCoords.max_y < y) {
plotCoords.max_y = y;
}
if (time_str.contains('.')) { if (time_str.contains('.')) {
time = QDateTime::fromString(time_str, "yyyy-MM-dd HH:mm:ss.zzz") time = QDateTime::fromString(time_str, "yyyy-MM-dd HH:mm:ss.zzz")
@@ -628,12 +625,15 @@ void logsDialog::plotLogs()
} }
plotCoords.x.push_back(time); plotCoords.x.push_back(time);
if (plots.min_x > time) { if (plots.min_x > time) plots.min_x = time;
plots.min_x = time; if (plots.max_x < time) plots.max_x = time;
} else 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); plots.coords.append(plotCoords);
} }