Warning, /frameworks/kquickcharts/controls/PieChartControl.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * This file is part of KQuickCharts
0003  * SPDX-FileCopyrightText: 2019 Arjen Hiemstra <ahiemstra@heimr.nl>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006  */
0007 
0008 import QtQuick 2.9
0009 import QtQuick.Controls 2.2
0010 
0011 import org.kde.quickcharts 1.0 as Charts
0012 import org.kde.quickcharts.controls 1.0
0013 
0014 /**
0015  * A pie chart with text in the middle.
0016  */
0017 Control {
0018     property alias valueSources: pie.valueSources
0019     property alias names: nameSource.array
0020     property alias color: colorSource.baseColor
0021     property alias range: pie.range
0022     property alias chart: pie
0023 
0024     property alias text: centerText.text
0025 
0026     implicitWidth: Theme.gridUnit * 5
0027     implicitHeight: Theme.gridUnit * 5
0028 
0029     contentItem: Item {
0030         Charts.PieChart {
0031             id: pie
0032 
0033             anchors.fill: parent
0034 
0035             nameSource: Charts.ArraySource { id: nameSource; array: [ ] }
0036             colorSource: Charts.ColorGradientSource { id: colorSource; baseColor: Theme.highlightColor; itemCount: pie.valueSources.length }
0037         }
0038 
0039         Label {
0040             id: centerText
0041 
0042             anchors.centerIn: parent;
0043 
0044             horizontalAlignment: Qt.AlignHCenter
0045             verticalAlignment: Qt.AlignVCenter
0046         }
0047     }
0048 }