##// END OF EJS Templates
Nesteddonuts chart docs updated
Marek Rosa -
r1985:86ffb652e423
parent child
Show More
@@ -38,10 +38,10 Widget::Widget(QWidget *parent)
38 //! [1]
38 //! [1]
39 QChartView *chartView = new QChartView;
39 QChartView *chartView = new QChartView;
40 chartView->setRenderHint(QPainter::Antialiasing);
40 chartView->setRenderHint(QPainter::Antialiasing);
41 QChart *chart = chartView->chart();
41 QChart *chart = chartView->chart();
42 chart->setAnimationOptions(QChart::AllAnimations);
43 chart->legend()->setVisible(false);
42 chart->legend()->setVisible(false);
44 chart->setTitle("Nested donuts demo");
43 chart->setTitle("Nested donuts demo");
44 chart->setAnimationOptions(QChart::AllAnimations);
45 //! [1]
45 //! [1]
46
46
47 //! [2]
47 //! [2]
@@ -6,7 +6,8
6 This example shows how to use create a nested donuts chart using QPieSeries API.
6 This example shows how to use create a nested donuts chart using QPieSeries API.
7 \image demos_nesteddonuts.png
7 \image demos_nesteddonuts.png
8
8
9 Let's start by creating a QChartView instance and enabling the Antialiasing on it. Last line enables the animations of the chart.
9 Let's start by creating a QChartView instance and enabling the Antialiasing on it. QChart object is then obtained from the QChartView instance.
10 The legend is disabled and the title of the chart is set. Last line enables the animations of the chart.
10
11
11 \snippet ../demos/nesteddonuts/widget.cpp 1
12 \snippet ../demos/nesteddonuts/widget.cpp 1
12
13
@@ -16,7 +17,7
16 \snippet ../demos/nesteddonuts/widget.cpp 2
17 \snippet ../demos/nesteddonuts/widget.cpp 2
17
18
18 Following block of code defines the individual donuts and their slices. First new QPieSeries object is created.
19 Following block of code defines the individual donuts and their slices. First new QPieSeries object is created.
19 Callign setDonut() changes pie into a donut. The number of slices in each donut is randomized.
20 The number of slices in each donut is randomized.
20 The internal for loop creates the slices with a random value and label same as the value.
21 The internal for loop creates the slices with a random value and label same as the value.
21 Next the label of the slice is set to be visible and its color is set to white.
22 Next the label of the slice is set to be visible and its color is set to white.
22 To make the example more interesting the hovered signal of the slice is connected to widget's slot which inner workings are explained later.
23 To make the example more interesting the hovered signal of the slice is connected to widget's slot which inner workings are explained later.
@@ -40,7 +41,7
40
41
41 The earlier mentioned explodeSlice slot code is provided below.
42 The earlier mentioned explodeSlice slot code is provided below.
42 If the slice is set to exploded then stop the timer that controls the donuts rotation.
43 If the slice is set to exploded then stop the timer that controls the donuts rotation.
43 Then the slice's start and end agles are obtained from the slice.
44 Then the slice's start and end angles are obtained from the slice.
44 To highlight the selected slice all the other donuts that lie outward from the one that contains the selected slice
45 To highlight the selected slice all the other donuts that lie outward from the one that contains the selected slice
45 have their start and end angles modified so that they wouldn't "block" the way for the hightlighted slice.
46 have their start and end angles modified so that they wouldn't "block" the way for the hightlighted slice.
46 If the slice is no longer selected return to the original state.
47 If the slice is no longer selected return to the original state.
General Comments 0
You need to be logged in to leave comments. Login now