##// END OF EJS Templates
Simple to examples
Simple to examples

File last commit:

r1618:fab18ef35094
r1623:484828e48d5e
Show More
examples-barchart.qdoc
39 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 a bar chart. BarChart shows the data in sets as separate bars, which are in categories.
\image examples_barchart.png
Data that barchart visualizes, is defined by QBarSet instances. Here we create the sets and append data
to them.
\snippet ../examples/barchart/main.cpp 1
We create the series and append the sets to it. The barseries groups the data from sets to categories.
First value of each set are gropuped together at first category second value to second category and so on.
\snippet ../examples/barchart/main.cpp 2
Then we create a chart and add the series to it.
\snippet ../examples/barchart/main.cpp 3
We define the categories here and add them to QCategoriesAxis which we then set to be the x-axis of the chart.
\snippet ../examples/barchart/main.cpp 4
And we also want to show the legend.
\snippet ../examples/barchart/main.cpp 5
Finally we add the chart onto a view.
\snippet ../examples/barchart/main.cpp 6
And it is ready to be shown in a window.
\snippet ../examples/barchart/main.cpp 7
*/