X-Git-Url: https://www.flypig.org.uk/git/?p=harbour-pedalo.git;a=blobdiff_plain;f=qml%2Fpages%2FStats.qml;h=235ca1c7fe37bfc1c5f2cf7ad3673f9c472f2be7;hp=ad2dcae232d12711b7924d88d2fbe574ffe5a21c;hb=54ab3ebfadf8cb258561a4641249da8c6469dc0f;hpb=41ee443df2b12e7a4373be580006f57cc5fd768a diff --git a/qml/pages/Stats.qml b/qml/pages/Stats.qml index ad2dcae..235ca1c 100644 --- a/qml/pages/Stats.qml +++ b/qml/pages/Stats.qml @@ -8,6 +8,7 @@ Page { // The effective value will be restricted by ApplicationWindow.allowedOrientations allowedOrientations: Orientation.All + property int showingindex: 0 SilicaFlickable { id: statsView @@ -72,36 +73,60 @@ Page { } } - Column { - id: graphsColumn - spacing: Theme.paddingLarge + SlideshowView { + id: graphsView width: isPortrait ? parent.width : parent.width * 0.5 - y: (isPortrait ? (statsPage.height / 2.0) : statsColumn.y) + height: (isPortrait ? statsPage.height / 2.0 : statsPage.height) - Theme.paddingLarge + itemWidth: width + clip: true anchors.left: isPortrait ? statsColumn.left : statsColumn.right - anchors.leftMargin: Theme.horizontalPageMargin - - - Graph { - id: graph - width: parent.width - 2 * Theme.horizontalPageMargin - height: isPortrait ? (statsPage.height / 2.0) - Theme.paddingLarge : statsPage.height - Theme.paddingLarge - headerItem.height - model: currentStatus.getGraphData() - labelsx: ["M", "T", "W", "Th", "F", "S", "Su", "A", "B", "C"] - //labelsy: ["0%", "10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%", "100%"] - unitsy: "%" - primary: Theme.primaryColor - secondary: Theme.highlightColor - highlight: Theme.highlightColor - miny: 0.0 - maxy: 1.0 - stepy: 0.1 - gap: 0.1 - fontsize: Theme.fontSizeExtraSmall - PropertyAnimation on animate { - duration: 2000 - easing.type: Easing.InOutExpo - from: 0.0 - to: 1.0 + anchors.leftMargin: 0 + + y: (isPortrait ? (statsPage.height / 2.0) : statsColumn.y) + + onModelChanged: { + console.log("Model changed"); + model.updateAll(); + } + + model: statsmodel + delegate: Item { + id: delegateItem + width: graphsView.itemWidth + height: graphsView.height + + SectionHeader { + id: sectionHeaderItem + text: title + } + + Graph { + id: graph + 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.left: parent.left + bardata: barvalues + //linedata: barvalues + labelsx: labels + //labelsy: ["0%", "10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%", "100%"] + unitsy: units + primary: Theme.primaryColor + secondary: Theme.highlightColor + highlight: Theme.secondaryColor + miny: minval + maxy: maxval + stepy: step + gap: 0.1 + fontsize: Theme.fontSizeExtraSmall + animate: (graphsView.currentItem === delegateItem) ? 1.0 : 0.0 + + Behavior on animate { + NumberAnimation { + easing.type: Easing.OutExpo + duration: 2000 + } + } } } }