##// END OF EJS Templates
Updated API Classes page in docs
Updated API Classes page in docs

File last commit:

r1208:2943560d5819
r1368:eebcdd02f0a9
Show More
examples-barchart.qdoc
34 lines | 1.2 KiB | text/plain | TextLexer
/ doc / src / examples-barchart.qdoc
/*!
\example examples/barchart
\title BarChart Example
\subtitle
The example shows how to create simple bar chart. Barchart shows the data in sets as separate bars, which are drawn at the x-axis to the position defined by data.
\image examples_barchart.png
Data that barchart visualizes, is defined by QBarSet instances. Here we create some sets and append data
we want to visualize to them. Note that first and third QPointF in each set have smaller intervals at their x coordinates. This will be reflected in the chart.
\snippet ../examples/barchart/main.cpp 1
To combine the sets to a chart, we need to create QBarSeries instance. Then we append our barsets to the series.
\snippet ../examples/barchart/main.cpp 2
Next we create a chart and add the series to it.
\snippet ../examples/barchart/main.cpp 3
We want to have the legend displayed at the bottom of the chart. Also we turn on the nice numbers algorithm on for y-axis.
\snippet ../examples/barchart/main.cpp 4
Finally we add the chart onto a view.
\snippet ../examples/barchart/main.cpp 5
And it is ready to be shown in a window.
\snippet ../examples/percentbarchart/main.cpp 6
*/