@@ -4,7 +4,6 | |||
|
4 | 4 | #include <qchartview.h> |
|
5 | 5 | #include <qpieseries.h> |
|
6 | 6 | #include <qpieslice.h> |
|
7 | #include "customslice.h" | |
|
8 | 7 | |
|
9 | 8 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
10 | 9 | |
@@ -14,23 +13,17 int main(int argc, char *argv[]) | |||
|
14 | 13 | |
|
15 | 14 | QMainWindow window; |
|
16 | 15 | |
|
16 | QChartView* chartView = new QChartView(&window); | |
|
17 | ||
|
18 | //! [1] | |
|
17 | 19 | QPieSeries *series = new QPieSeries(); |
|
18 |
series->add( |
|
|
20 | series->add(1, "Slice 1"); | |
|
19 | 21 | series->add(2, "Slice 2"); |
|
20 | 22 | series->add(3, "Slice 3"); |
|
21 | 23 | series->add(4, "Slice 4"); |
|
22 | 24 | series->add(5, "Slice 5"); |
|
23 | series->add(6, "Slice 6"); | |
|
24 | series->add(7, "Slice 7"); | |
|
25 | series->add(new CustomSlice(8)); | |
|
26 | series->enableClickExplodes(true); | |
|
27 | series->enableHoverHighlight(true); | |
|
28 | ||
|
29 | QChartView* chartView = new QChartView(&window); | |
|
30 | chartView->setRenderHint(QPainter::Antialiasing); | |
|
31 | chartView->setChartTheme(QChart::ChartThemeIcy); | |
|
32 | chartView->setChartTitle("Simple piechart"); | |
|
33 | 25 | chartView->addSeries(series); |
|
26 | //! [1] | |
|
34 | 27 | |
|
35 | 28 | window.setCentralWidget(chartView); |
|
36 | 29 | window.resize(600, 600); |
@@ -2,7 +2,7 | |||
|
2 | 2 | error( "Couldn't find the example.pri file!" ) |
|
3 | 3 | } |
|
4 | 4 | TARGET = piechart |
|
5 |
SOURCES += main.cpp |
|
|
6 | HEADERS += customslice.h | |
|
5 | SOURCES += main.cpp | |
|
6 | HEADERS += | |
|
7 | 7 | |
|
8 | 8 |
@@ -113,6 +113,9 bool QPieSeries::ChangeSet::isEmpty() const | |||
|
113 | 113 | |
|
114 | 114 | By default the pie is defined as full but it can be a partial pie. |
|
115 | 115 | This can be done by setting a starting angle and angle span to the series. |
|
116 | ||
|
117 | Example on how to create a chart with pie series: | |
|
118 | \snippet ../example/piechart/main.cpp 1 | |
|
116 | 119 | */ |
|
117 | 120 | |
|
118 | 121 | /*! |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now