diff --git a/demos/qmlchart/qml/qmlchart/View1.qml b/demos/qmlchart/qml/qmlchart/View1.qml index 0e66371..2f179a8 100644 --- a/demos/qmlchart/qml/qmlchart/View1.qml +++ b/demos/qmlchart/qml/qmlchart/View1.qml @@ -22,53 +22,30 @@ import QtQuick 1.0 import QtCommercial.Chart 1.0 Rectangle { - width: parent.width - height: parent.height - - // Another option for QML data api: -// ListModel { -// id: listModelForPie -// // PieDataElement -// ListElement { -// label: "Apple" -// value: 4.3 -// } -// ListElement { -// label: "Blackberry" -// value: 15.1 -// } -// } - - Component.onCompleted: { -// console.log("model:" + myModel.item(0)); -// myModel.insert(1, {"time":1.4; "speed":41.1 }); -// scatter.appendData(); -// chart1.theme = Chart.ThemeHighContrast; -// chart2.theme = Chart.ThemeHighContrast; - } + anchors.fill: parent Chart { - id: chart1 + title: "Car brand shares in Finland" anchors.fill: parent - theme: Chart.ChartThemeDark - - BarSeries { - barCategories: [ "2008", "2009", "2010", "2011", "2012" ] - // TBD: data - } + theme: Chart.ChartThemeLight PieSeries { horizontalPosition: 0.2 verticalPosition: 0.3 size: 0.4 - endAngle: 0.52 * 360 // The share of "others" is 52% slices: [ PieSlice { label: "Volkswagen"; value: 13.5 }, PieSlice { label: "Toyota"; value: 10.9 }, PieSlice { label: "Ford"; value: 8.6 }, PieSlice { label: "Skoda"; value: 8.2 }, - PieSlice { label: "Volvo"; value: 6.8 } + PieSlice { label: "Volvo"; value: 6.8 }, + PieSlice { label: "Others"; value: 52.0 } ] } + + BarSeries { + barCategories: [ "2008", "2009", "2010", "2011", "2012" ] + // data implementation missing + } } } diff --git a/demos/qmlchart/qml/qmlchart/View2.qml b/demos/qmlchart/qml/qmlchart/View2.qml index b380d34..71f7731 100644 --- a/demos/qmlchart/qml/qmlchart/View2.qml +++ b/demos/qmlchart/qml/qmlchart/View2.qml @@ -25,6 +25,7 @@ Rectangle { anchors.fill: parent Chart { + title: "Line&Spline" anchors.fill: parent theme: Chart.ChartThemeBrownSand @@ -33,8 +34,10 @@ Rectangle { points: [ XyPoint { x: 0.0; y: 0.0 }, XyPoint { x: 1.1; y: 2.1 }, + XyPoint { x: 1.9; y: 3.3 }, XyPoint { x: 2.9; y: 4.9 }, - XyPoint { x: 3.2; y: 3.0 } + XyPoint { x: 3.2; y: 3.0 }, + XyPoint { x: 4.0; y: 3.3 } ] } @@ -43,8 +46,11 @@ Rectangle { points: [ XyPoint { x: 0.0; y: 0.3 }, XyPoint { x: 1.1; y: 3.2 }, - XyPoint { x: 2.17; y: 2.15 }, - XyPoint { x: 4.17; y: 3.15 } + XyPoint { x: 1.7; y: 2.4 }, + XyPoint { x: 2.1; y: 2.1 }, + XyPoint { x: 2.9; y: 2.6 }, + XyPoint { x: 3.4; y: 2.3 }, + XyPoint { x: 4.1; y: 3.1 } ] } } diff --git a/demos/qmlchart/qml/qmlchart/View3.qml b/demos/qmlchart/qml/qmlchart/View3.qml index 0a2c884..32092cb 100644 --- a/demos/qmlchart/qml/qmlchart/View3.qml +++ b/demos/qmlchart/qml/qmlchart/View3.qml @@ -25,45 +25,103 @@ Rectangle { anchors.fill: parent Chart { + title: "NHL All-Star Team Players" anchors.fill: parent theme: Chart.ChartThemeHighContrast AreaSeries { - name: "Area" + name: "Finnish" points: [ - XyPoint { x: 0.0; y: 1.1 }, - XyPoint { x: 2.5; y: 3.6 }, - XyPoint { x: 3.57; y: 2.55 } + XyPoint { x: 0; y: 0 }, + XyPoint { x: 1; y: 0 }, + XyPoint { x: 2; y: 0 }, + XyPoint { x: 3; y: 0 }, + XyPoint { x: 4; y: 0 }, + XyPoint { x: 5; y: 0 }, + XyPoint { x: 6; y: 1 }, + XyPoint { x: 7; y: 0 }, + XyPoint { x: 8; y: 0 }, + XyPoint { x: 9; y: 0 }, + XyPoint { x: 10; y: 0 }, + XyPoint { x: 11; y: 1 } ] lowerPoints: [ - XyPoint { x: 0.0; y: 0.0 }, - XyPoint { x: 2.5; y: 0.0 }, - XyPoint { x: 3.57; y: 0.0 } + XyPoint { x: 0; y: 0 }, + XyPoint { x: 1; y: 0 }, + XyPoint { x: 2; y: 0 }, + XyPoint { x: 3; y: 0 }, + XyPoint { x: 4; y: 0 }, + XyPoint { x: 5; y: 0 }, + XyPoint { x: 6; y: 0 }, + XyPoint { x: 7; y: 0 }, + XyPoint { x: 8; y: 0 }, + XyPoint { x: 9; y: 0 }, + XyPoint { x: 10; y: 0 }, + XyPoint { x: 11; y: 0 } ] } - ScatterSeries { - name: "Scatter1" + AreaSeries { + name: "Russian" points: [ - XyPoint { x: 1.5; y: 1.5 }, - XyPoint { x: 1.5; y: 1.6 }, - XyPoint { x: 1.57; y: 1.55 } + XyPoint { x: 0; y: 1 }, + XyPoint { x: 1; y: 1 }, + XyPoint { x: 2; y: 1 }, + XyPoint { x: 3; y: 1 }, + XyPoint { x: 4; y: 1 }, + XyPoint { x: 5; y: 0 }, + XyPoint { x: 6; y: 1 }, + XyPoint { x: 7; y: 1 }, + XyPoint { x: 8; y: 4 }, + XyPoint { x: 9; y: 3 }, + XyPoint { x: 10; y: 2 }, + XyPoint { x: 11; y: 1 } ] - } - ScatterSeries { - name: "Scatter2" - points: [ - XyPoint { x: 2.0; y: 2.0 }, - XyPoint { x: 2.0; y: 2.1 }, - XyPoint { x: 2.07; y: 2.05 } + lowerPoints: [ + XyPoint { x: 0; y: 0 }, + XyPoint { x: 1; y: 0 }, + XyPoint { x: 2; y: 0 }, + XyPoint { x: 3; y: 0 }, + XyPoint { x: 4; y: 0 }, + XyPoint { x: 5; y: 0 }, + XyPoint { x: 6; y: 0 }, + XyPoint { x: 7; y: 0 }, + XyPoint { x: 8; y: 0 }, + XyPoint { x: 9; y: 0 }, + XyPoint { x: 10; y: 0 }, + XyPoint { x: 11; y: 0 } ] } - ScatterSeries { - name: "Scatter3" + + AreaSeries { + name: "Swedish" points: [ - XyPoint { x: 2.6; y: 2.6 }, - XyPoint { x: 2.6; y: 2.7 }, - XyPoint { x: 2.67; y: 2.65 } + XyPoint { x: 0; y: 1 }, + XyPoint { x: 1; y: 1 }, + XyPoint { x: 2; y: 3 }, + XyPoint { x: 3; y: 3 }, + XyPoint { x: 4; y: 2 }, + XyPoint { x: 5; y: 0 }, + XyPoint { x: 6; y: 2 }, + XyPoint { x: 7; y: 1 }, + XyPoint { x: 8; y: 2 }, + XyPoint { x: 9; y: 1 }, + XyPoint { x: 10; y: 3 }, + XyPoint { x: 11; y: 3 } + ] + lowerPoints: [ + XyPoint { x: 0; y: 0 }, + XyPoint { x: 1; y: 0 }, + XyPoint { x: 2; y: 0 }, + XyPoint { x: 3; y: 0 }, + XyPoint { x: 4; y: 0 }, + XyPoint { x: 5; y: 0 }, + XyPoint { x: 6; y: 0 }, + XyPoint { x: 7; y: 0 }, + XyPoint { x: 8; y: 0 }, + XyPoint { x: 9; y: 0 }, + XyPoint { x: 10; y: 0 }, + XyPoint { x: 11; y: 0 } ] } } diff --git a/demos/qmlchart/qml/qmlchart/main.qml b/demos/qmlchart/qml/qmlchart/main.qml index 38c2f97..0db7f73 100644 --- a/demos/qmlchart/qml/qmlchart/main.qml +++ b/demos/qmlchart/qml/qmlchart/main.qml @@ -31,9 +31,8 @@ Rectangle { running: true repeat: true interval: 5000 - triggeredOnStart: true + triggeredOnStart: false onTriggered: { - loader.source = "View" + (__viewNumber % 3 + 1) + ".qml"; __viewNumber++; } } @@ -41,13 +40,13 @@ Rectangle { Loader { id: loader anchors.fill: parent + source: "View" + (__viewNumber % 4 + 1) + ".qml"; } MouseArea { anchors.fill: parent onClicked: { timer.restart(); - loader.source = "View" + (__viewNumber % 3 + 1) + ".qml"; __viewNumber++; } } diff --git a/demos/qmlchart/resources.qrc b/demos/qmlchart/resources.qrc index ecec535..82eb434 100644 --- a/demos/qmlchart/resources.qrc +++ b/demos/qmlchart/resources.qrc @@ -5,5 +5,6 @@ qml/qmlchart/View1.qml qml/qmlchart/View2.qml qml/qmlchart/View3.qml + qml/qmlchart/View4.qml