From f298c6bc220ea19a4bca9fdc4a44a7799d695b25 Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Thu, 20 Jul 2023 16:43:50 +0100 Subject: Use VerticalLabels in BarGraph Currently the width of the labels isn't dynamic as it was before. This will need fixing. --- src/graphs/BarGraph.qml | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src/graphs/BarGraph.qml') diff --git a/src/graphs/BarGraph.qml b/src/graphs/BarGraph.qml index 2a16e97..1c869d7 100644 --- a/src/graphs/BarGraph.qml +++ b/src/graphs/BarGraph.qml @@ -25,33 +25,21 @@ Item { property var valuesArr: [] property var labelsArr: [] 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 } - Item { // labels column + VerticalLabels { // labels column id: markerParent - width: childrenRect.width height: parent.height + width: parent.height*0.1 anchors { left: parent.left top: barsRow.top bottom: barsRow.bottom } - Repeater { - model: barGraph.divisionsCount - delegate: Label { - width: implicitWidth - property var value: barGraph.divisionsInterval*index - text: value > 1000 ? value/1000 + "k" : value - font.pixelSize: Dims.w(5) - y: parent.height - parent.height*barGraph.divisionsInterval*index/barGraph.maxValue - height/2 - verticalAlignment: Text.AlignVCenter - } - } + endValue: barGraph.maxValue } Rectangle { // indicator line id: indicatorLine -- cgit v1.2.3-54-g00ecf