Debian Codegraph @

examples/charts/qmlchartsgallery/qml/PieChart.qml

raw
1 // Copyright (C) 2023 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4 //![2]
5 import QtQuick
6 //![2]
7 import QtCharts
8
9 //![1]
10 ChartView {
11 id: chart
12 title: "Top-5 car brand shares in Finland"
13 anchors.fill: parent
14 legend.alignment: Qt.AlignBottom
15 antialiasing: true
16
17 property variant othersSlice: 0
18
19 PieSeries {
20 id: pieSeries
21 PieSlice { label: "Volkswagen"; value: 13.5 }
22 PieSlice { label: "Toyota"; value: 10.9 }
23 PieSlice { label: "Ford"; value: 8.6 }
24 PieSlice { label: "Skoda"; value: 8.2 }
25 PieSlice { label: "Volvo"; value: 6.8 }
26 }
27
28 Component.onCompleted: {
29 // You can also manipulate slices dynamically, like append a slice or set a slice exploded
30 othersSlice = pieSeries.append("Others", 52.0);
31 pieSeries.find("Volkswagen").exploded = true;
32 }
33 }
34
35 //![1]