diff options
Diffstat (limited to 'basicsuite/enterprise-charts/View1.qml')
-rw-r--r-- | basicsuite/enterprise-charts/View1.qml | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/basicsuite/enterprise-charts/View1.qml b/basicsuite/enterprise-charts/View1.qml index 64aa78c..f85a18e 100644 --- a/basicsuite/enterprise-charts/View1.qml +++ b/basicsuite/enterprise-charts/View1.qml @@ -53,31 +53,30 @@ import QtQuick 2.0 //![2] import QtCharts 2.0 -Rectangle { +Item { anchors.fill: parent property variant othersSlice: 0 + //![1] - ChartView { + BaseChart { id: chart title: "Top-5 car brand shares in Finland" anchors.fill: parent - legend.alignment: Qt.AlignBottom - antialiasing: true - PieSeries { id: pieSeries - 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: "Volkswagen"; value: 13.5; color: defaultGreen } + PieSlice { label: "Toyota"; value: 10.9; color: mediumGreen } + PieSlice { label: "Ford"; value: 8.6; color: darkGreen } + PieSlice { label: "Skoda"; value: 8.2; color: defaultGrey } + PieSlice { label: "Volvo"; value: 6.8; color: secondaryGrey } } } Component.onCompleted: { // You can also manipulate slices dynamically othersSlice = pieSeries.append("Others", 52.0); + othersSlice.color = mediumGrey; pieSeries.find("Volkswagen").exploded = true; } //![1] |