##// END OF EJS Templates
revert donutchart back to original
Jani Honkonen -
r1876:f742f8cdc33a
parent child
Show More
@@ -1,62 +1,62
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include <QApplication>
22 22 #include <QMainWindow>
23 23 #include <QChartView>
24 24 #include <QPieSeries>
25 25 #include <QPieSlice>
26 26 #include <QDebug>
27 27 QTCOMMERCIALCHART_USE_NAMESPACE
28 28
29 29 int main(int argc, char *argv[])
30 30 {
31 31 QApplication a(argc, argv);
32 32
33 33 //![1]
34 34 QPieSeries *series = new QPieSeries();
35 35 series->setHoleSize(0.35);
36 36 series->append("Protein 4.2%", 4.2);
37 37 QPieSlice *slice = series->append("Fat 15.6%", 15.6);
38 38 slice->setExploded();
39 39 slice->setLabelVisible();
40 40 series->append("Other 23.8%", 23.8);
41 41 series->append("Carbs 56.4%", 56.4);
42 42 //![1]
43 43
44 44 //![2]
45 45 QChartView* chartView = new QChartView();
46 46 chartView->setRenderHint(QPainter::Antialiasing);
47 47 chartView->chart()->setTitle("Donut with a lemon glaze (100g)");
48 48 chartView->chart()->addSeries(series);
49 chartView->chart()->legend()->setAlignment(Qt::AlignLeft);
49 chartView->chart()->legend()->setAlignment(Qt::AlignBottom);
50 50 chartView->chart()->setTheme(QChart::ChartThemeBlueCerulean);
51 //chartView->chart()->legend()->setFont(QFont("Arial", 7));
51 chartView->chart()->legend()->setFont(QFont("Arial", 7));
52 52 //![2]
53 53
54 54 //![3]
55 55 QMainWindow window;
56 56 window.setCentralWidget(chartView);
57 57 window.resize(400, 300);
58 58 window.show();
59 59 //![3]
60 60
61 61 return a.exec();
62 62 }
General Comments 0
You need to be logged in to leave comments. Login now