summaryrefslogtreecommitdiff
path: root/src/graphs
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphs')
-rw-r--r--src/graphs/BarGraph.qml12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/graphs/BarGraph.qml b/src/graphs/BarGraph.qml
index 9674832..08415a3 100644
--- a/src/graphs/BarGraph.qml
+++ b/src/graphs/BarGraph.qml
@@ -26,6 +26,7 @@ Item {
property var labelsArr: []
property var maxValue: 0
property real indicatorLineHeight: 0
+ property color indicatorLineColor: "#FFFFFF"
signal barClicked(index: int)
function dataLoadingDone() {
barsRepeater.model = 0
@@ -47,15 +48,16 @@ Item {
Rectangle { // indicator line
id: indicatorLine
height: 1
- z: 1
+ z: 2
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
+ color: barGraph.indicatorLineColor
}
Row { // bars
id: barsRow
- z: 2
+ z: 1
anchors {
left: markerParent.right
top: parent.top
@@ -100,4 +102,10 @@ Item {
}
}
}
+ function interpolateColors(color1, color2, position) {
+ return Qt.rgba(color1.r + (color2.r-color1.r)*position, color1.g+ (color2.g-color1.g)*position, color1.b + (color2.b-color1.b)*position,1)
+ }
+ function clamp(num, min, max) {
+ return Math.min(Math.max(num, min), max)
+ }
}