File indexing completed on 2024-11-24 03:57:51
0001 /** 0002 * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved. 0003 * 0004 * This file is part of the KD Chart library. 0005 * 0006 * SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #include <QApplication> 0010 #include <KChartWidget> 0011 #include <KChartPieDiagram> 0012 #include <KChartPolarCoordinatePlane> 0013 #include <QPen> 0014 0015 0016 using namespace KChart; 0017 0018 int main( int argc, char** argv ) { 0019 QApplication app( argc, argv ); 0020 0021 Widget widget; 0022 widget.resize( 600, 600 ); 0023 widget.setGlobalLeading( 5, 5, 5, 5 ); 0024 0025 QVector< qreal > vec0, vec1, vec2; 0026 0027 vec0 << 1 << -4 << -3 << -2 << -1 << 0 0028 << 1 << 2 << 3 << 4 << 5; 0029 vec1 << 2 << 16 << 9 << 4 << 1 << 0 0030 << 1 << 4 << 9 << 16 << 25; 0031 vec2 << 3 << -64 << -27 << -8 << -1 << 0 0032 << 1 << 8 << 27 << 64 << 125; 0033 0034 widget.setDataset( 0, vec0, "v0" ); 0035 widget.setDataset( 1, vec1, "v1" ); 0036 widget.setDataset( 2, vec2, "v2" ); 0037 widget.setType( Widget::Pie ); 0038 0039 // Draw a line around the 0040 // third sections 0041 // for example 0042 QPen piePen; 0043 piePen.setWidth( 3 ); 0044 piePen.setColor( Qt::white ); 0045 widget.pieDiagram()->setPen( 2, piePen ); 0046 ((PolarCoordinatePlane*)widget.coordinatePlane())->setStartPosition( 90 ); 0047 0048 widget.show(); 0049 0050 return app.exec(); 0051 }