##// END OF EJS Templates
Adds back diagram class to docs
Adds back diagram class to docs

File last commit:

r971:29cedae3d4be
r1089:15730c540d76
Show More
examples-barchart.qdoc
40 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 grouped in categories.
\image examples_barchart.png
First we define categories.
\snippet ../examples/barchart/main.cpp 1
Data that barchart visualizes, is defined by QBarSet instances. Here we create some sets and append data
we want to visualize to them.
\snippet ../examples/barchart/main.cpp 2
To combine the sets and categories to a chart, we need to create QBarSeries instance. When creating
the QBarSeries, the categories must be known. Sets can be added later. For example purposes the sets
are added to series here.
\snippet ../examples/barchart/main.cpp 3
Then we create a chart and add the series to it.
\snippet ../examples/barchart/main.cpp 4
And we also want to show the legend, so that the data is easier to read.
\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/percentbarchart/main.cpp 7
*/