@@ -6,15 +6,15 project = QtCommercialCharts | |||||
6 | description = Library for creating charts |
|
6 | description = Library for creating charts | |
7 |
|
7 | |||
8 | sourcedirs = ../src \ |
|
8 | sourcedirs = ../src \ | |
9 | ../example \ |
|
9 | ../examples \ | |
10 | ./src |
|
10 | ./src | |
11 | headerdirs = ../src \ |
|
11 | headerdirs = ../src \ | |
12 | ../example |
|
12 | ../examples | |
13 | exampledirs = ../ \ |
|
13 | exampledirs = ../ \ | |
14 | ../src \ |
|
14 | ../src \ | |
15 | ../example |
|
15 | ../examples | |
16 |
|
16 | |||
17 | excludefiles += ../example/linechart/linechart.pro |
|
17 | excludefiles += ../examples/linechart/linechart.pro | |
18 |
|
18 | |||
19 | sources.fileextensions = *.cpp *.qdoc *.mm *.qml |
|
19 | sources.fileextensions = *.cpp *.qdoc *.mm *.qml | |
20 | headers.fileextensions = *.h *.ch *.h++ *.hh *.hpp *.hxx |
|
20 | headers.fileextensions = *.h *.ch *.h++ *.hh *.hpp *.hxx |
@@ -9,22 +9,22 | |||||
9 |
|
9 | |||
10 | To create area charts, we need two QLineSeries instances. They are going to define upper and lower boundary of the area. |
|
10 | To create area charts, we need two QLineSeries instances. They are going to define upper and lower boundary of the area. | |
11 |
|
11 | |||
12 | \snippet ../example/areachart/main.cpp 1 |
|
12 | \snippet ../examples/areachart/main.cpp 1 | |
13 |
|
13 | |||
14 | We add data to both series, we use stream operator. |
|
14 | We add data to both series, we use stream operator. | |
15 |
|
15 | |||
16 | \snippet ../example/areachart/main.cpp 2 |
|
16 | \snippet ../examples/areachart/main.cpp 2 | |
17 |
|
17 | |||
18 | Now we create QAreaSeries instance using two line series objects. We set the custom gradient fill and width of the outline. |
|
18 | Now we create QAreaSeries instance using two line series objects. We set the custom gradient fill and width of the outline. | |
19 |
|
19 | |||
20 | \snippet ../example/areachart/main.cpp 3 |
|
20 | \snippet ../examples/areachart/main.cpp 3 | |
21 |
|
21 | |||
22 | In the end we create QChartView instance, set title, set anti-aliasing and add area series. We also set the specific range for axes. |
|
22 | In the end we create QChartView instance, set title, set anti-aliasing and add area series. We also set the specific range for axes. | |
23 |
|
23 | |||
24 | \snippet ../example/areachart/main.cpp 4 |
|
24 | \snippet ../examples/areachart/main.cpp 4 | |
25 |
|
25 | |||
26 | Chart is ready to be shown. |
|
26 | Chart is ready to be shown. | |
27 |
|
27 | |||
28 | \snippet ../example/areachart/main.cpp 5 |
|
28 | \snippet ../examples/areachart/main.cpp 5 | |
29 |
|
29 | |||
30 | */ No newline at end of file |
|
30 | */ |
@@ -9,18 +9,18 | |||||
9 |
|
9 | |||
10 | To create line charts, QLineSeries instance is needed. Here we create two line series and we set the color and width of line. |
|
10 | To create line charts, QLineSeries instance is needed. Here we create two line series and we set the color and width of line. | |
11 |
|
11 | |||
12 | \snippet ../example/linechart/main.cpp 1 |
|
12 | \snippet ../examples/linechart/main.cpp 1 | |
13 |
|
13 | |||
14 | We add data to be shown to both series. We can use add() member function or use stream operator. |
|
14 | We add data to be shown to both series. We can use add() member function or use stream operator. | |
15 |
|
15 | |||
16 | \snippet ../example/linechart/main.cpp 2 |
|
16 | \snippet ../examples/linechart/main.cpp 2 | |
17 |
|
17 | |||
18 | In the end we create QChartView instance, set title, set anti-aliasing and add both series. |
|
18 | In the end we create QChartView instance, set title, set anti-aliasing and add both series. | |
19 |
|
19 | |||
20 | \snippet ../example/linechart/main.cpp 3 |
|
20 | \snippet ../examples/linechart/main.cpp 3 | |
21 |
|
21 | |||
22 | Chart is ready to be shown. |
|
22 | Chart is ready to be shown. | |
23 |
|
23 | |||
24 | \snippet ../example/linechart/main.cpp 4 |
|
24 | \snippet ../examples/linechart/main.cpp 4 | |
25 |
|
25 | |||
26 | */ No newline at end of file |
|
26 | */ |
@@ -13,25 +13,25 | |||||
13 |
|
13 | |||
14 | We create simple ChartView class which derives form QChartView. |
|
14 | We create simple ChartView class which derives form QChartView. | |
15 |
|
15 | |||
16 | \snippet ../example/presenterchart/chartview.h 1 |
|
16 | \snippet ../examples/presenterchart/chartview.h 1 | |
17 |
|
17 | |||
18 | Class will implement \c handleTimeout() slot which we are going to use to trigger switching between different chart presentations. |
|
18 | Class will implement \c handleTimeout() slot which we are going to use to trigger switching between different chart presentations. | |
19 | Class members \c m_series and \c m_titles are going to store series and related titles. In example we are going to present data as a line chart |
|
19 | Class members \c m_series and \c m_titles are going to store series and related titles. In example we are going to present data as a line chart | |
20 | using QLineSeries , as scatter chart using QScatterSeries, and as a spline chart using QSplineSeries. We create needed instances in constructor of ChartView class. |
|
20 | using QLineSeries , as scatter chart using QScatterSeries, and as a spline chart using QSplineSeries. We create needed instances in constructor of ChartView class. | |
21 | We set custom line and points colors. |
|
21 | We set custom line and points colors. | |
22 |
|
22 | |||
23 | \snippet ../example/presenterchart/chartview.cpp 1 |
|
23 | \snippet ../examples/presenterchart/chartview.cpp 1 | |
24 |
|
24 | |||
25 | We add data to all three series. We can use add() member function. If data set is large,it is wiser to use shared data model, as described here.[TODO] |
|
25 | We add data to all three series. We can use add() member function. If data set is large,it is wiser to use shared data model, as described here.[TODO] | |
26 |
|
26 | |||
27 | \snippet ../example/presenterchart/chartview.cpp 2 |
|
27 | \snippet ../examples/presenterchart/chartview.cpp 2 | |
28 |
|
28 | |||
29 | In the end we store references all the created series and matching titles. |
|
29 | In the end we store references all the created series and matching titles. | |
30 |
|
30 | |||
31 | \snippet ../example/presenterchart/chartview.cpp 3 |
|
31 | \snippet ../examples/presenterchart/chartview.cpp 3 | |
32 |
|
32 | |||
33 | In \c handleTimeout() slot we change currently displayed chart by removing previous series and adding next series from the \c m_series list. We also set proper title. |
|
33 | In \c handleTimeout() slot we change currently displayed chart by removing previous series and adding next series from the \c m_series list. We also set proper title. | |
34 |
|
34 | |||
35 | \snippet ../example/presenterchart/chartview.cpp 4 |
|
35 | \snippet ../examples/presenterchart/chartview.cpp 4 | |
36 |
|
36 | |||
37 | */ No newline at end of file |
|
37 | */ |
@@ -9,18 +9,18 | |||||
9 |
|
9 | |||
10 | To create scatter charts, QScatterSeries instance is needed. Here we create scatter series instance and we set the type, color and width of outline for scatter points. |
|
10 | To create scatter charts, QScatterSeries instance is needed. Here we create scatter series instance and we set the type, color and width of outline for scatter points. | |
11 |
|
11 | |||
12 | \snippet ../example/scatterchart/main.cpp 1 |
|
12 | \snippet ../examples/scatterchart/main.cpp 1 | |
13 |
|
13 | |||
14 | We add data to be shown. We can use add() member function or use stream operator. |
|
14 | We add data to be shown. We can use add() member function or use stream operator. | |
15 |
|
15 | |||
16 | \snippet ../example/scatterchart/main.cpp 2 |
|
16 | \snippet ../examples/scatterchart/main.cpp 2 | |
17 |
|
17 | |||
18 | In the end we create QChartView instance, set title, set anti-aliasing and add scatter series. |
|
18 | In the end we create QChartView instance, set title, set anti-aliasing and add scatter series. | |
19 |
|
19 | |||
20 | \snippet ../example/scatterchart/main.cpp 3 |
|
20 | \snippet ../examples/scatterchart/main.cpp 3 | |
21 |
|
21 | |||
22 | Chart is ready to be shown. |
|
22 | Chart is ready to be shown. | |
23 |
|
23 | |||
24 | \snippet ../example/scatterchart/main.cpp 4 |
|
24 | \snippet ../examples/scatterchart/main.cpp 4 | |
25 |
|
25 | |||
26 | */ No newline at end of file |
|
26 | */ |
@@ -9,34 +9,34 | |||||
9 |
|
9 | |||
10 | 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. |
|
10 | 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. | |
11 |
|
11 | |||
12 | \snippet ../example/splinechart/splinewidget.cpp 1 |
|
12 | \snippet ../examples/splinechart/splinewidget.cpp 1 | |
13 |
|
13 | |||
14 | Customize the look of the spline, by setting its pen's color and pen's width |
|
14 | Customize the look of the spline, by setting its pen's color and pen's width | |
15 |
|
15 | |||
16 | \snippet ../example/splinechart/splinewidget.cpp 2 |
|
16 | \snippet ../examples/splinechart/splinewidget.cpp 2 | |
17 |
|
17 | |||
18 | Now lets add some data points to the series. |
|
18 | Now lets add some data points to the series. | |
19 |
|
19 | |||
20 | \snippet ../example/splinechart/splinewidget.cpp add points to series |
|
20 | \snippet ../examples/splinechart/splinewidget.cpp add points to series | |
21 |
|
21 | |||
22 | 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. |
|
22 | 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. | |
23 |
|
23 | |||
24 | \snippet ../example/splinechart/splinewidget.cpp 3 |
|
24 | \snippet ../examples/splinechart/splinewidget.cpp 3 | |
25 |
|
25 | |||
26 | Then we add two buttons for adding and removing data points. Buttons clicked() signals are connected to handler functions. |
|
26 | Then we add two buttons for adding and removing data points. Buttons clicked() signals are connected to handler functions. | |
27 |
|
27 | |||
28 | \snippet ../example/splinechart/splinewidget.cpp 4 |
|
28 | \snippet ../examples/splinechart/splinewidget.cpp 4 | |
29 |
|
29 | |||
30 | In the end we add the chart and the buttons to the widget's layout. |
|
30 | In the end we add the chart and the buttons to the widget's layout. | |
31 |
|
31 | |||
32 | \snippet ../example/splinechart/splinewidget.cpp 5 |
|
32 | \snippet ../examples/splinechart/splinewidget.cpp 5 | |
33 |
|
33 | |||
34 | Here is the handler function for add new data point button: |
|
34 | Here is the handler function for add new data point button: | |
35 |
|
35 | |||
36 | \snippet ../example/splinechart/splinewidget.cpp add point |
|
36 | \snippet ../examples/splinechart/splinewidget.cpp add point | |
37 |
|
37 | |||
38 | And here is one for remove the last data point in the series: |
|
38 | And here is one for remove the last data point in the series: | |
39 |
|
39 | |||
40 | \snippet ../example/splinechart/splinewidget.cpp remove point |
|
40 | \snippet ../examples/splinechart/splinewidget.cpp remove point | |
41 |
|
41 | |||
42 | */ |
|
42 | */ |
@@ -4,23 +4,23 | |||||
4 | \keyword Tutorials |
|
4 | \keyword Tutorials | |
5 |
|
5 | |||
6 | For example, to create a chart with line series using a widget based application: |
|
6 | For example, to create a chart with line series using a widget based application: | |
7 | \snippet ../example/chartview/main.cpp 1 |
|
7 | \snippet ../examples/chartview/main.cpp 1 | |
8 | \image chartview_example.jpg |
|
8 | \image chartview_example.jpg | |
9 |
|
9 | |||
10 | To replace the line series with a pie series you use the dedicated QPieSeries class: |
|
10 | To replace the line series with a pie series you use the dedicated QPieSeries class: | |
11 | \snippet ../example/chartview/main.cpp 3 |
|
11 | \snippet ../examples/chartview/main.cpp 3 | |
12 | \image chartview_example_pie.jpg |
|
12 | \image chartview_example_pie.jpg | |
13 |
|
13 | |||
14 | To use a scatter series you use QScatterSeries class: |
|
14 | To use a scatter series you use QScatterSeries class: | |
15 | \snippet ../example/chartview/main.cpp 4 |
|
15 | \snippet ../examples/chartview/main.cpp 4 | |
16 | \image chartview_example_scatter.jpg |
|
16 | \image chartview_example_scatter.jpg | |
17 |
|
17 | |||
18 | And to show a bar series you use one of the bar series classes, for example QBarChartSeries: |
|
18 | And to show a bar series you use one of the bar series classes, for example QBarChartSeries: | |
19 | \snippet ../example/chartview/main.cpp 5 |
|
19 | \snippet ../examples/chartview/main.cpp 5 | |
20 | \image chartview_example_bar.jpg |
|
20 | \image chartview_example_bar.jpg | |
21 |
|
21 | |||
22 | If you need to give a more professional touch to your chart you can switch from the default |
|
22 | If you need to give a more professional touch to your chart you can switch from the default | |
23 | theme to one of the other themes: |
|
23 | theme to one of the other themes: | |
24 | \snippet ../example/chartview/main.cpp 2 |
|
24 | \snippet ../examples/chartview/main.cpp 2 | |
25 | \image chartview_example_theme.jpg |
|
25 | \image chartview_example_theme.jpg | |
26 | */ |
|
26 | */ |
General Comments 0
You need to be logged in to leave comments.
Login now