##// END OF EJS Templates
Add custom slice color & explode & visible label in basic piechart example.
Jani Honkonen -
r713:964c794fe613
parent child
Show More
@@ -14,6 +14,8 int main(int argc, char *argv[])
14 QMainWindow window;
14 QMainWindow window;
15
15
16 QChartView* chartView = new QChartView(&window);
16 QChartView* chartView = new QChartView(&window);
17 chartView->setRenderHint(QPainter::Antialiasing);
18 chartView->setChartTitle("Simple pie chart");
17
19
18 //! [1]
20 //! [1]
19 QPieSeries *series = new QPieSeries();
21 QPieSeries *series = new QPieSeries();
@@ -22,9 +24,18 int main(int argc, char *argv[])
22 series->add(3, "Slice 3");
24 series->add(3, "Slice 3");
23 series->add(4, "Slice 4");
25 series->add(4, "Slice 4");
24 series->add(5, "Slice 5");
26 series->add(5, "Slice 5");
25 chartView->addSeries(series);
26 //! [1]
27 //! [1]
27
28
29 //! [2]
30 QPieSlice *slice = series->slices().first();
31 slice->setExploded();
32 slice->setLabelVisible();
33 slice->setSlicePen(QPen(Qt::darkGreen, 2));
34 slice->setSliceBrush(Qt::green);
35 //! [2]
36
37 chartView->addSeries(series);
38
28 window.setCentralWidget(chartView);
39 window.setCentralWidget(chartView);
29 window.resize(600, 600);
40 window.resize(600, 600);
30 window.show();
41 window.show();
General Comments 0
You need to be logged in to leave comments. Login now