##// END OF EJS Templates
fixed example paths in doc
fixed example paths in doc

File last commit:

r496:c23f1472c851
r496:c23f1472c851
Show More
example-splinechart.qdoc
42 lines | 1.6 KiB | text/plain | TextLexer
/ doc / src / example-splinechart.qdoc
Marek Rosa
Added missing example files
r435 /*!
\example example/splinechart
\title SplineChart Example
\subtitle
The example shows how to create simple spline chart.
\image splinechart_example
To create spline chart we need to put our data into QSplineSeries. QSplineSeries automatically calculates spline segment control points that are needed to properly draw the spline.
sauimone
fixed example paths in doc
r496 \snippet ../examples/splinechart/splinewidget.cpp 1
Marek Rosa
Added missing example files
r435
Customize the look of the spline, by setting its pen's color and pen's width
sauimone
fixed example paths in doc
r496 \snippet ../examples/splinechart/splinewidget.cpp 2
Marek Rosa
Added missing example files
r435
Now lets add some data points to the series.
sauimone
fixed example paths in doc
r496 \snippet ../examples/splinechart/splinewidget.cpp add points to series
Marek Rosa
Added missing example files
r435
The data series has been populated. To display it on a chart we create QChartView object and add the data series to it. We also set the ranges on both axises, so that our chart is fully visible and there is some excess of space for adding more data points.
sauimone
fixed example paths in doc
r496 \snippet ../examples/splinechart/splinewidget.cpp 3
Marek Rosa
Added missing example files
r435
Then we add two buttons for adding and removing data points. Buttons clicked() signals are connected to handler functions.
sauimone
fixed example paths in doc
r496 \snippet ../examples/splinechart/splinewidget.cpp 4
Marek Rosa
Added missing example files
r435
In the end we add the chart and the buttons to the widget's layout.
sauimone
fixed example paths in doc
r496 \snippet ../examples/splinechart/splinewidget.cpp 5
Marek Rosa
Added missing example files
r435
Here is the handler function for add new data point button:
sauimone
fixed example paths in doc
r496 \snippet ../examples/splinechart/splinewidget.cpp add point
Marek Rosa
Added missing example files
r435
And here is one for remove the last data point in the series:
sauimone
fixed example paths in doc
r496 \snippet ../examples/splinechart/splinewidget.cpp remove point
Marek Rosa
Added missing example files
r435
*/