##// END OF EJS Templates
fixed legend scrolling in detached mode. updated example
fixed legend scrolling in detached mode. updated example

File last commit:

r1407:41924dd7d514
r1446:f8259d05b01f
Show More
examples-barchart.qdoc
36 lines | 1.3 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 x positions are not in even intervals and this will be reflected in the chart.
If x positions aren't defined, then the index of value is assumed to be x position.
\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.
We also set the title for chart
\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
*/