diff options
author | dodoradio <dodoradio@outlook.com> | 2023-08-20 16:32:47 +0100 |
---|---|---|
committer | dodoradio <dodoradio@outlook.com> | 2023-08-20 19:57:01 +0100 |
commit | 6ae32dffa9939ee2a8ba1241659a9540dd88496b (patch) | |
tree | 36288398b92704740b07c1edfda142a56ec380dd /src/stepCounter | |
parent | 2178972412ecbf4301990e55067575cdd1faf526 (diff) |
steps preview: make step goal line change colour with target
we also move the indicator line up in the z stack, as we want the line above the bars. This wasn't obvious before as the elements were all the same colour.
The two processing functions, clamp and interpolateColors are probably not optimally placed in the code. These might move.
Diffstat (limited to '')
-rw-r--r-- | src/stepCounter/StepCounterPreview.qml | 1 | ||||
-rw-r--r-- | src/stepCounter/StepsDetailPage.qml | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/src/stepCounter/StepCounterPreview.qml b/src/stepCounter/StepCounterPreview.qml index 9042dd7..823f739 100644 --- a/src/stepCounter/StepCounterPreview.qml +++ b/src/stepCounter/StepCounterPreview.qml @@ -83,6 +83,7 @@ MouseArea { dataLoadingDone() } indicatorLineHeight: loggerSettings.stepGoalEnabled ? loggerSettings.stepGoalTarget : 0 + indicatorLineColor: interpolateColors(Qt.rgba(1,0,0,1),Qt.rgba(0.06,1,0.11,1),clamp(stepsDataLoader.todayTotal/loggerSettings.stepGoalTarget,0,1)) onBarClicked: (index)=> { var d = new Date() d.setDate(d.getDate() - valuesArr.length + 1 + index) diff --git a/src/stepCounter/StepsDetailPage.qml b/src/stepCounter/StepsDetailPage.qml index 7949a2f..2862eea 100644 --- a/src/stepCounter/StepsDetailPage.qml +++ b/src/stepCounter/StepsDetailPage.qml @@ -91,6 +91,7 @@ Item { } } } + indicatorLineColor = interpolateColors(Qt.rgba(1,0,0,1),Qt.rgba(0.06,1,0.11,1),clamp(stepsDataLoader.getTotalForDate(stepsLineGraph.startTime)/loggerSettings.stepGoalTarget,0,1)) dataLoadingDone() } indicatorLineHeight: loggerSettings.stepGoalEnabled ? loggerSettings.stepGoalTarget : 0 |