##// END OF EJS Templates
QML API versioning to QtCommercial.Chart 1.1
QML API versioning to QtCommercial.Chart 1.1

File last commit:

r1761:34fc5c0da098
r1857:58a3a87ea08b
Show More
examples-donutbreakdown.qdoc
52 lines | 2.4 KiB | text/plain | TextLexer
/ doc / src / examples-donutbreakdown.qdoc
Marek Rosa
Documented the donutdrilldown chart example
r1714 /*!
Marek Rosa
Renamed donutdrilldown example to donutbreakdown
r1761 \example examples/donutbreakdown
\title Donut chart breakdown example
Marek Rosa
Documented the donutdrilldown chart example
r1714 \subtitle
Marek Rosa
Renamed donutdrilldown example to donutbreakdown
r1761 This example shows how to use create a donut breakdown chart using QPieSeries API.
Marek Rosa
Documented the donutdrilldown chart example
r1714
Let's start by creating a QChartView instance and enabling the Antialiasing on it. Last line enables the animations of the chart.
Marek Rosa
Renamed donutdrilldown example to donutbreakdown
r1761 \snippet ../examples/donutbreakdown/widget.cpp 1
Marek Rosa
Documented the donutdrilldown chart example
r1714
PieSeries is used to present the general data.
Marek Rosa
Renamed donutdrilldown example to donutbreakdown
r1761 \snippet ../examples/donutbreakdown/widget.cpp 2
Marek Rosa
Documented the donutdrilldown chart example
r1714
Following block of code creates the slices for the mainData QPieSeries.
Then for every created slice a new series is created that stores the detailed data.
The details series is set to be a donut. Its size is adjusted so that it wraps around the mainData pie.
Next two signals from the mainData pie's slices are connected. This is used to keep the mainData slices agligned with their respective details series.
Marek Rosa
Renamed donutdrilldown example to donutbreakdown
r1761 \snippet ../examples/donutbreakdown/widget.cpp 3
Marek Rosa
Documented the donutdrilldown chart example
r1714
Set the labels of the mainData to enabled and their postion to Outside.
Then add the mainData and detailedData series to the chart.
Marek Rosa
Renamed donutdrilldown example to donutbreakdown
r1761 \snippet ../examples/donutbreakdown/widget.cpp 4
Marek Rosa
Documented the donutdrilldown chart example
r1714
Finally the widget is placed in a layout used by the application.
Marek Rosa
Renamed donutdrilldown example to donutbreakdown
r1761 \snippet ../examples/donutbreakdown/widget.cpp 5
Marek Rosa
Documented the donutdrilldown chart example
r1714
To show that the detailed data stays aligned with the main data every 2.5 sec. one of the slices is modified.
It should be noted that int this example the mainData slices should not be modified directly as the change
cannot be applied to the detailed slices without the extra knowledge on how the split looks like.
Marek Rosa
Renamed donutdrilldown example to donutbreakdown
r1761 \snippet ../examples/donutbreakdown/widget.cpp 6
Marek Rosa
Documented the donutdrilldown chart example
r1714
When the mainData slice layout is changed the detailed data layout has to be modified accordingly.
This is achived by setting the start and end angle of the detailed series.
Marek Rosa
Renamed donutdrilldown example to donutbreakdown
r1761 \snippet ../examples/donutbreakdown/widget.cpp 7
Marek Rosa
Documented the donutdrilldown chart example
r1714
Highlight slot selects a random slice for the modification.
The slice is set to exploded to notify the user that its going to be changed.
The actual data modification is delayed by 1 sec to give a user a chance to focus on the slice.
Then the slice is modified. Respective mainData slice is modified as well to contain as the value the sum of the detailed series slices values.
Finally the slice exploded state is set to false.
Marek Rosa
Renamed donutdrilldown example to donutbreakdown
r1761 \snippet ../examples/donutbreakdown/widget.cpp 8
Marek Rosa
Documented the donutdrilldown chart example
r1714
*/