@@ -1,36 +1,36 | |||||
1 | /*! |
|
1 | /*! | |
2 | \example examples/donutbreakdown |
|
2 | \example examples/donutbreakdown | |
3 | \title Donut chart breakdown example |
|
3 | \title Donut chart breakdown example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | This example shows how to use create a donut breakdown chart using QPieSeries API. |
|
6 | This example shows how to use create a donut breakdown chart using QPieSeries API. | |
7 | \image examples_donutbreakdown.png |
|
7 | \image examples_donutbreakdown.png | |
8 |
|
8 | |||
9 | Let's start by defining some data for the chart. |
|
9 | Let's start by defining some data for the chart. | |
10 |
|
10 | |||
11 | \snippet ../examples/donutbreakdown/main.cpp 1 |
|
11 | \snippet ../examples/donutbreakdown/main.cpp 1 | |
12 |
|
12 | |||
13 |
Then we create a chart where we add the data. Note that this |
|
13 | Then we create a chart where we add the data. Note that this is our own chart derived from QChart. | |
14 |
|
14 | |||
15 | \snippet ../examples/donutbreakdown/main.cpp 2 |
|
15 | \snippet ../examples/donutbreakdown/main.cpp 2 | |
16 |
|
16 | |||
17 | Our own chart works so that in the constructor we create a main series |
|
17 | Our own chart works so that in the constructor we create a main series | |
18 | which aggregates the data provided by the breakdown series. This is the piechart in the center. |
|
18 | which aggregates the data provided by the breakdown series. This is the piechart in the center. | |
19 |
|
19 | |||
20 | \snippet ../examples/donutbreakdown/donutbreakdownchart.cpp 1 |
|
20 | \snippet ../examples/donutbreakdown/donutbreakdownchart.cpp 1 | |
21 |
|
21 | |||
22 | When a breakdown series is added the data is used to create a slice in the main series and the |
|
22 | When a breakdown series is added the data is used to create a slice in the main series and the | |
23 | breakdown series itself is used to create a segment of a donut positioned so that it is aligned |
|
23 | breakdown series itself is used to create a segment of a donut positioned so that it is aligned | |
24 | with the corresponding slice in the main series. |
|
24 | with the corresponding slice in the main series. | |
25 |
|
25 | |||
26 | \snippet ../examples/donutbreakdown/donutbreakdownchart.cpp 2 |
|
26 | \snippet ../examples/donutbreakdown/donutbreakdownchart.cpp 2 | |
27 |
|
27 | |||
28 | Here's how the start and end angles for the donut segments are calculated. |
|
28 | Here's how the start and end angles for the donut segments are calculated. | |
29 |
|
29 | |||
30 | \snippet ../examples/donutbreakdown/donutbreakdownchart.cpp 3 |
|
30 | \snippet ../examples/donutbreakdown/donutbreakdownchart.cpp 3 | |
31 |
|
31 | |||
32 | And now that we have our chart defined we can finally create a QChartView and show the chart. |
|
32 | And now that we have our chart defined we can finally create a QChartView and show the chart. | |
33 |
|
33 | |||
34 | \snippet ../examples/donutbreakdown/main.cpp 3 |
|
34 | \snippet ../examples/donutbreakdown/main.cpp 3 | |
35 |
|
35 | |||
36 | */ |
|
36 | */ |
@@ -1,30 +1,30 | |||||
1 | /*! |
|
1 | /*! | |
2 | \example examples/linechart |
|
2 | \example examples/linechart | |
3 | \title LineChart Example |
|
3 | \title LineChart Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | The example shows how to create simple line chart. |
|
6 | The example shows how to create simple line chart. | |
7 |
|
7 | |||
8 | \image examples_linechart.png |
|
8 | \image examples_linechart.png | |
9 |
|
9 | |||
10 | To create line chart, QLineSeries instance is needed. Let's create one. |
|
10 | To create line chart, QLineSeries instance is needed. Let's create one. | |
11 |
|
11 | |||
12 | \snippet ../examples/linechart/main.cpp 1 |
|
12 | \snippet ../examples/linechart/main.cpp 1 | |
13 |
|
13 | |||
14 |
Then we add data to series. We can use a |
|
14 | Then we add data to series. We can use append() member function or use stream operator. | |
15 |
|
15 | |||
16 | \snippet ../examples/linechart/main.cpp 2 |
|
16 | \snippet ../examples/linechart/main.cpp 2 | |
17 |
|
17 | |||
18 | To present the data on the char we need QChart instance. We add the series to it, create the default axes and set the title of the chart. |
|
18 | To present the data on the char we need QChart instance. We add the series to it, create the default axes and set the title of the chart. | |
19 |
|
19 | |||
20 | \snippet ../examples/linechart/main.cpp 3 |
|
20 | \snippet ../examples/linechart/main.cpp 3 | |
21 |
|
21 | |||
22 | Then we create a QChartView object with QChart as a parameter. This way we don't need to create QGraphicsView scene ourselves. We also set the Antialiasing on to have the rendered lines look nicer. |
|
22 | Then we create a QChartView object with QChart as a parameter. This way we don't need to create QGraphicsView scene ourselves. We also set the Antialiasing on to have the rendered lines look nicer. | |
23 |
|
23 | |||
24 | \snippet ../examples/linechart/main.cpp 4 |
|
24 | \snippet ../examples/linechart/main.cpp 4 | |
25 |
|
25 | |||
26 | Chart is ready to be shown. |
|
26 | Chart is ready to be shown. | |
27 |
|
27 | |||
28 | \snippet ../examples/linechart/main.cpp 5 |
|
28 | \snippet ../examples/linechart/main.cpp 5 | |
29 |
|
29 | |||
30 | */ |
|
30 | */ |
@@ -1,27 +1,27 | |||||
1 | /*! |
|
1 | /*! | |
2 | \example examples/scatterchart |
|
2 | \example examples/scatterchart | |
3 | \title ScatterChart Example |
|
3 | \title ScatterChart Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | The example shows how to create simple scatter chart. |
|
6 | The example shows how to create simple scatter chart. | |
7 |
|
7 | |||
8 | \image examples_scatterchart.png |
|
8 | \image examples_scatterchart.png | |
9 |
|
9 | |||
10 | To create scatter charts, QScatterSeries instance is needed. Here we create scatter series instance and we set the type, color and width of outline for scatter points. |
|
10 | To create scatter charts, QScatterSeries instance is needed. Here we create scatter series instance and we set the type, color and width of outline for scatter points. | |
11 |
|
11 | |||
12 | \snippet ../examples/scatterchart/chartview.cpp 1 |
|
12 | \snippet ../examples/scatterchart/chartview.cpp 1 | |
13 |
|
13 | |||
14 |
We add data to be shown. We can use a |
|
14 | We add data to be shown. We can use append() member function or use stream operator. | |
15 |
|
15 | |||
16 | \snippet ../examples/scatterchart/chartview.cpp 2 |
|
16 | \snippet ../examples/scatterchart/chartview.cpp 2 | |
17 |
|
17 | |||
18 | In the end we enable anti-aliasing, set the chart title and add the scatter series onto the chart. We also disable |
|
18 | In the end we enable anti-aliasing, set the chart title and add the scatter series onto the chart. We also disable | |
19 | drop shadow, because it would not look good on an application with only chart view shown. |
|
19 | drop shadow, because it would not look good on an application with only chart view shown. | |
20 |
|
20 | |||
21 | \snippet ../examples/scatterchart/chartview.cpp 3 |
|
21 | \snippet ../examples/scatterchart/chartview.cpp 3 | |
22 |
|
22 | |||
23 | Chart is ready to be shown. |
|
23 | Chart is ready to be shown. | |
24 |
|
24 | |||
25 | \snippet ../examples/scatterchart/main.cpp 4 |
|
25 | \snippet ../examples/scatterchart/main.cpp 4 | |
26 |
|
26 | |||
27 | */ |
|
27 | */ |
General Comments 0
You need to be logged in to leave comments.
Login now