From 7038315f5f4df4e53fd065d5253a5d4cf81f0b81 Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Sat, 1 Jul 2023 00:49:57 +0100 Subject: Add steps goal line indicator to steps graph the move of loggersettings into main is just done so we don't have a duplicate, since we now need it in main. --- src/SettingsPage.qml | 3 --- src/graphs/BarGraph.qml | 11 +++++++++++ src/main.qml | 5 +++++ 3 files changed, 16 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/SettingsPage.qml b/src/SettingsPage.qml index 993381f..e184d88 100644 --- a/src/SettingsPage.qml +++ b/src/SettingsPage.qml @@ -26,9 +26,6 @@ Item { text: "Settings" z: 5 } - LoggerSettings{ - id: loggerSettings - } Flickable { anchors.fill: parent contentHeight: contentColumn.implicitHeight diff --git a/src/graphs/BarGraph.qml b/src/graphs/BarGraph.qml index fd5e947..2a16e97 100644 --- a/src/graphs/BarGraph.qml +++ b/src/graphs/BarGraph.qml @@ -27,6 +27,7 @@ Item { property var maxValue: 0 property var divisionsInterval: 0 property var divisionsCount: 0 + property real indicatorLineHeight: 0 function dataLoadingDone() { barsRepeater.model = valuesArr.length labelsRepeater.model = labelsArr.length @@ -52,8 +53,18 @@ Item { } } } + Rectangle { // indicator line + id: indicatorLine + height: 1 + z: 1 + width: barsRepeater.count*(barGraph.width-markerParent.width)/Math.max(barGraph.valuesArr.length,3) - height/2 + anchors.left: markerParent.right + y: barsRow.height*(1-(barGraph,indicatorLineHeight/barGraph.maxValue)) + visible: barGraph.indicatorLineHeight != 0 + } Row { // bars id: barsRow + z: 2 anchors { left: markerParent.right top: parent.top diff --git a/src/main.qml b/src/main.qml index 44af46e..e59ed82 100644 --- a/src/main.qml +++ b/src/main.qml @@ -31,6 +31,10 @@ Application { property var weekday: ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]; + LoggerSettings{ + id: loggerSettings + } + LayerStack { id: pageStack @@ -107,6 +111,7 @@ Application { console.log(maxValue,divisionsInterval,divisionsCount) dataLoadingDone() } + indicatorLineHeight: loggerSettings.stepGoalEnabled ? loggerSettings.stepGoalTarget : 0 } Item { width: parent.width; height: parent.width*0.1} -- cgit v1.2.3-54-g00ecf