KQuickCharts

PieChartControl.qml
1/*
2 * This file is part of KQuickCharts
3 * SPDX-FileCopyrightText: 2019 Arjen Hiemstra <ahiemstra@heimr.nl>
4 *
5 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6 */
7
8import QtQuick
9import QtQuick.Controls
10
11import org.kde.quickcharts as Charts
12import org.kde.quickcharts.controls
13
14/**
15 * A pie chart with text in the middle.
16 */
17Control {
18 property alias valueSources: pie.valueSources
19 property alias names: nameSource.array
20 property alias color: colorSource.baseColor
21 property alias range: pie.range
22 property alias chart: pie
23 property alias highlight: pie.highlight
24
25 property alias text: centerText.text
26
27 implicitWidth: Theme.gridUnit * 5
28 implicitHeight: Theme.gridUnit * 5
29
30 contentItem: Item {
31 Charts.PieChart {
32 id: pie
33
34 anchors.fill: parent
35
36 nameSource: Charts.ArraySource { id: nameSource; array: [ ] }
37 colorSource: Charts.ColorGradientSource { id: colorSource; baseColor: Theme.highlightColor; itemCount: pie.valueSources.length }
38 }
39
40 Label {
41 id: centerText
42
43 anchors.centerIn: parent;
44
45 horizontalAlignment: Qt.AlignHCenter
46 verticalAlignment: Qt.AlignVCenter
47 }
48 }
49}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:23 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.