summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/graphs/TimeLabels.qml21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/graphs/TimeLabels.qml b/src/graphs/TimeLabels.qml
index bebeca5..eebec9e 100644
--- a/src/graphs/TimeLabels.qml
+++ b/src/graphs/TimeLabels.qml
@@ -47,7 +47,12 @@ Item {
var date
while (currentTime < endTime) {
date = new Date(currentTime*1000)
- var value = date.getHours().toString() + ":" + date.getMinutes().toString()
+ 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()
+ }
var x = (currentTime - startTime) / delta
listModel.append({"value": value, "x": x})
currentTime = currentTime + interval
@@ -67,7 +72,12 @@ Item {
var date
while (currentTime < endTime) {
date = new Date(currentTime*1000)
- var value = date.getHours().toString() + ":" + date.getMinutes().toString()
+ 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()
+ }
var x = (currentTime - startTime) / delta
listModel.append({"value": value, "x": x})
currentTime = currentTime + interval
@@ -89,7 +99,12 @@ Item {
var date
while (currentTime < endTime) {
date = new Date(currentTime*1000)
- var value = date.getHours().toString() + ":" + date.getMinutes().toString()
+ var value
+ if (date.getMinutes() != 0 | interval != 1800) {
+ value = date.getHours().toString() + "h"
+ } else {
+ value = ":" + date.getMinutes()
+ }
var x = (currentTime - startTime) / delta
listModel.append({"value": value, "x": x})
currentTime = currentTime + interval