Add graphs generated from journey data
[harbour-pedalo.git] / qml / pages / Stats.qml
index e082b0f..8e13f97 100644 (file)
@@ -78,9 +78,16 @@ Page {
             height: (isPortrait ? statsPage.height / 2.0 : statsPage.height) - Theme.paddingLarge
             itemWidth: width
             clip: true
+            anchors.left: isPortrait ? statsColumn.left : statsColumn.right
+            anchors.leftMargin: 0
 
             y: (isPortrait ? (statsPage.height / 2.0) : statsColumn.y)
 
+            onModelChanged: {
+                console.log("Model changed");
+                model.updateAll();
+            }
+
             model: statsmodel
             delegate: Rectangle {
                 width: graphsView.itemWidth
@@ -89,25 +96,25 @@ Page {
 
                 SectionHeader {
                     id: sectionHeaderItem
-                    text: "item " + index
+                    text: title
                 }
 
                 Graph {
                     id: graph
-                    width: parent.width - 2 * Theme.horizontalPageMargin
+                    width: parent.width - Theme.horizontalPageMargin
                     anchors.top: sectionHeaderItem.bottom
                     height: (isPortrait ? (statsPage.height / 2.0) - Theme.paddingLarge : statsPage.height - Theme.paddingLarge - headerItem.height) - sectionHeaderItem.height
-                    anchors.horizontalCenter: parent.horizontalCenter
+                    anchors.left: parent.left
                     model: values
                     labelsx: labels
                     //labelsy: ["0%", "10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%", "100%"]
-                    unitsy: "%"
+                    unitsy: units
                     primary: Theme.primaryColor
                     secondary: Theme.highlightColor
                     highlight: Theme.highlightColor
-                    miny: 0.0
-                    maxy: 1.0
-                    stepy: 0.1
+                    miny: minval
+                    maxy: maxval
+                    stepy: step
                     gap: 0.1
                     fontsize: Theme.fontSizeExtraSmall
                     /*