From 2178972412ecbf4301990e55067575cdd1faf526 Mon Sep 17 00:00:00 2001 From: dodoradio Date: Mon, 7 Aug 2023 22:15:14 +0100 Subject: Further tweaks and fixes to time labelling algorithm --- src/graphs/TimeLabels.qml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/graphs') diff --git a/src/graphs/TimeLabels.qml b/src/graphs/TimeLabels.qml index b793040..514ce2a 100644 --- a/src/graphs/TimeLabels.qml +++ b/src/graphs/TimeLabels.qml @@ -49,9 +49,9 @@ Item { date = new Date(currentTime*1000) var value if (date.getMinutes() == 0 | i == 0) { - value = date.getHours() + (date.getMinutes() < 10 ? ":0" + date.getMinutes().toString() : date.getMinutes().toString()) - } else if (date.getMinutes() < 10) { - value = date.getMinutes() < 10 ? ":0" + date.getMinutes().toString() : date.getMinutes().toString() + value = date.getHours() + (date.getMinutes() < 10 ? ":0" + date.getMinutes().toString() : "0" + date.getMinutes().toString()) + } else { + value = date.getMinutes() < 10 ? ":0" + date.getMinutes().toString() : ":" + date.getMinutes().toString() } var x = (currentTime - startTime) / delta listModel.append({"value": value, "x": x}) @@ -74,9 +74,9 @@ Item { date = new Date(currentTime*1000) var value if (date.getMinutes() == 0 | i == 0) { - value = date.getHours() + (date.getMinutes() < 10 ? ":0" + date.getMinutes().toString() : date.getMinutes().toString()) - } else if (date.getMinutes() < 10) { - value = date.getMinutes() < 10 ? ":0" + date.getMinutes().toString() : date.getMinutes().toString() + value = date.getHours() + (date.getMinutes() < 10 ? ":0" + date.getMinutes().toString() : ":" + date.getMinutes().toString()) + } else { + value = date.getMinutes() < 10 ? ":0" + date.getMinutes().toString() : ":" + date.getMinutes().toString() } var x = (currentTime - startTime) / delta listModel.append({"value": value, "x": x}) @@ -102,7 +102,7 @@ Item { while (currentTime < endTime) { date = new Date(currentTime*1000) var value - if (date.getMinutes() != 0 | interval != 1800) { + if (date.getMinutes() == 0) { value = date.getHours().toString() + "h" } else { value = ":" + date.getMinutes() -- cgit v1.2.3-70-g09d2