##// END OF EJS Templates
Fix crash with boxplottertester brush...
Fix crash with boxplottertester brush The test sets the brush for the second set in the first series. It is checked that the set exists before setting the brush for it. Change-Id: Id677ab781953bf7cc789f316d92c137873d4f624 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>

File last commit:

r2610:66fa88d10640
r2635:d3155254bba4
Show More
examples-lineandbarchart.qdoc
46 lines | 1.7 KiB | text/plain | TextLexer
/ doc / src / examples-lineandbarchart.qdoc
sauimone
documentation for lineandbar example
r1634 /*!
\example examples/lineandbar
\title Line and BarChart Example
\subtitle
Nico Vertriest
Doc: language review of Qt Charts doc...
r2610 The example shows how to combine different charts and set the axes. In the example we combine a linechart with
a barchart and use the category axis as a common axis for both.
sauimone
documentation for lineandbar example
r1634
\image examples_lineandbar.png
Nico Vertriest
Doc: language review of Qt Charts doc...
r2610 Here we create data for our bar series.
sauimone
documentation for lineandbar example
r1634
\snippet ../examples/lineandbar/main.cpp 1
Nico Vertriest
Doc: language review of Qt Charts doc...
r2610 We create a bar series and append sets to it.
The first values of each set are grouped together in the first category, the second values in the second category and so on.
sauimone
documentation for lineandbar example
r1634
\snippet ../examples/lineandbar/main.cpp 2
Nico Vertriest
Doc: language review of Qt Charts doc...
r2610 Then we create a line series and add data to it. To make the data match with the barchart, we use the index as an x-value for our line series, so that
first point is at (0,value) second at (1,value) and so on.
\snippet ../examples/lineandbar/main.cpp 8
sauimone
documentation for lineandbar example
r1634 Here we create the chart and add both series to it.
\snippet ../examples/lineandbar/main.cpp 3
Nico Vertriest
Doc: language review of Qt Charts doc...
r2610
To make the chart show the series properly, we have to create custom axes for the series. If we don't create custom axes, then each series will get scaled to
use the maximum area of the chart (like in single series case) and the result will be incorrect. With custom axes we set the range of both series to follow the
same axis. For the x-axis we use the QBarCategoryAxis and for the y-axis we use QValuesAxis.
sauimone
documentation for lineandbar example
r1634
\snippet ../examples/lineandbar/main.cpp 4
And we also want to show the legend.
\snippet ../examples/lineandbar/main.cpp 5
Finally we add the chart onto a view.
\snippet ../examples/lineandbar/main.cpp 6
Nico Vertriest
Doc: language review of Qt Charts doc...
r2610 Now it is ready to be shown in a window.
sauimone
documentation for lineandbar example
r1634
\snippet ../examples/lineandbar/main.cpp 7
*/