1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -1,33 +1,29 | |||||
1 | /*! |
|
1 | /*! | |
2 | \example examples/splinechart |
|
2 | \example examples/splinechart | |
3 | \title SplineChart Example |
|
3 | \title SplineChart Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | The example shows how to create simple spline chart. |
|
6 | The example shows how to create simple spline chart. | |
7 |
|
7 | |||
8 | \image splinechart_example |
|
8 | \image splinechart_example | |
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 ../examples/splinechart/main.cpp 1 |
|
12 | \snippet ../examples/splinechart/main.cpp 1 | |
13 |
|
13 | |||
14 | Customize the look of the spline, by setting its pen's color and pen's width |
|
|||
15 |
|
||||
16 | \snippet ../examples/splinechart/main.cpp 2 |
|
|||
17 |
|
||||
18 | Now lets add some data points to the series. |
|
14 | Now lets add some data points to the series. | |
19 |
|
15 | |||
20 | \snippet ../examples/splinechart/main.cpp 3 |
|
16 | \snippet ../examples/splinechart/main.cpp 3 | |
21 |
|
17 | |||
22 | The data series has been populated. To display it on a chart we create QChart object and add the data series to it. We also set the title and the values range on y axis, so that our chart is better visible. |
|
18 | The data series has been populated. To display it on a chart we create QChart object and add the data series to it. We also set the title and the values range on y axis, so that our chart is better visible. | |
23 |
|
19 | |||
24 | \snippet ../examples/splinechart/main.cpp 4 |
|
20 | \snippet ../examples/splinechart/main.cpp 4 | |
25 |
|
21 | |||
26 |
Then we create |
|
22 | Then we create a QChartView object with QChart as a parameter. This way we don't need to create QGraphicsView scene ourselves. We also set the Antialiasing on to have the rendered lines look nicer. | |
27 |
|
23 | |||
28 | \snippet ../examples/splinechart/main.cpp 5 |
|
24 | \snippet ../examples/splinechart/main.cpp 5 | |
29 |
|
25 | |||
30 | In the end we set the QChartView as the windows's central widget. |
|
26 | In the end we set the QChartView as the windows's central widget. | |
31 |
|
27 | |||
32 | \snippet ../examples/splinechart/main.cpp 6 |
|
28 | \snippet ../examples/splinechart/main.cpp 6 | |
33 | */ |
|
29 | */ |
@@ -1,26 +1,30 | |||||
1 | /*! |
|
1 | /*! | |
2 | \example examples/linechart |
|
2 | \example examples/linechart | |
3 | \title LineChart Example |
|
3 | \title LineChart Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | The example shows how to create simple line chart. |
|
6 | The example shows how to create simple line chart. | |
7 |
|
7 | |||
8 | \image linechart.png |
|
8 | \image linechart.png | |
9 |
|
9 | |||
10 |
To create line chart |
|
10 | To create line chart, QLineSeries instance is needed. Let's create one. | |
11 |
|
11 | |||
12 | \snippet ../examples/linechart/main.cpp 1 |
|
12 | \snippet ../examples/linechart/main.cpp 1 | |
13 |
|
13 | |||
14 |
|
|
14 | Then we add data to series. We can use add() member function or use stream operator. | |
15 |
|
15 | |||
16 | \snippet ../examples/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 | To present the data on the char we need QChart instance. We add the series to it and set the title of the chart. | |
19 |
|
19 | |||
20 | \snippet ../examples/linechart/main.cpp 3 |
|
20 | \snippet ../examples/linechart/main.cpp 3 | |
21 |
|
21 | |||
22 | Chart is ready to be shown. |
|
22 | Then we create a QChartView object with QChart as a parameter. This way we don't need to create QGraphicsView scene ourselves. We also set the Antialiasing on to have the rendered lines look nicer. | |
23 |
|
23 | |||
24 | \snippet ../examples/linechart/main.cpp 4 |
|
24 | \snippet ../examples/linechart/main.cpp 4 | |
|
25 | ||||
|
26 | Chart is ready to be shown. | |||
|
27 | ||||
|
28 | \snippet ../examples/linechart/main.cpp 5 | |||
25 |
|
29 | |||
26 | */ No newline at end of file |
|
30 | */ |
@@ -1,67 +1,64 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include <QApplication> |
|
21 | #include <QApplication> | |
22 | #include <QMainWindow> |
|
22 | #include <QMainWindow> | |
23 | #include <QChartView> |
|
23 | #include <QChartView> | |
24 | #include <QLineSeries> |
|
24 | #include <QLineSeries> | |
25 |
|
25 | |||
26 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
26 | QTCOMMERCIALCHART_USE_NAMESPACE | |
27 |
|
27 | |||
28 | int main(int argc, char *argv[]) |
|
28 | int main(int argc, char *argv[]) | |
29 | { |
|
29 | { | |
30 | QApplication a(argc, argv); |
|
30 | QApplication a(argc, argv); | |
31 |
|
31 | |||
32 | //![1] |
|
32 | //![1] | |
33 | QLineSeries* series = new QLineSeries(); |
|
33 | QLineSeries* series = new QLineSeries(); | |
34 | QPen red(Qt::red); |
|
|||
35 | red.setWidth(3); |
|
|||
36 | series->setPen(red); |
|
|||
37 | //![1] |
|
34 | //![1] | |
38 |
|
35 | |||
39 | //![2] |
|
36 | //![2] | |
40 | series->append(0, 6); |
|
37 | series->append(0, 6); | |
41 | series->append(2, 4); |
|
38 | series->append(2, 4); | |
42 | series->append(3, 8); |
|
39 | series->append(3, 8); | |
43 | series->append(7, 4); |
|
40 | series->append(7, 4); | |
44 | series->append(10, 5); |
|
41 | series->append(10, 5); | |
45 | *series << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2); |
|
42 | *series << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2); | |
46 | //![2] |
|
43 | //![2] | |
47 |
|
44 | |||
48 | //![3] |
|
45 | //![3] | |
49 | QChart* chart = new QChart(); |
|
46 | QChart* chart = new QChart(); | |
50 | chart->addSeries(series); |
|
47 | chart->addSeries(series); | |
51 | chart->setTitle("Simple line chart example"); |
|
48 | chart->setTitle("Simple line chart example"); | |
52 | //![3] |
|
49 | //![3] | |
53 |
|
50 | |||
54 | //![4] |
|
51 | //![4] | |
55 | QChartView* chartView = new QChartView(chart); |
|
52 | QChartView* chartView = new QChartView(chart); | |
56 | chartView->setRenderHint(QPainter::Antialiasing); |
|
53 | chartView->setRenderHint(QPainter::Antialiasing); | |
57 | //![4] |
|
54 | //![4] | |
58 |
|
55 | |||
59 | //![5] |
|
56 | //![5] | |
60 | QMainWindow window; |
|
57 | QMainWindow window; | |
61 | window.setCentralWidget(chartView); |
|
58 | window.setCentralWidget(chartView); | |
62 | window.resize(400, 300); |
|
59 | window.resize(400, 300); | |
63 | window.show(); |
|
60 | window.show(); | |
64 | //![5] |
|
61 | //![5] | |
65 |
|
62 | |||
66 | return a.exec(); |
|
63 | return a.exec(); | |
67 | } |
|
64 | } |
@@ -1,71 +1,71 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include <QApplication> |
|
21 | #include <QApplication> | |
22 | #include <QMainWindow> |
|
22 | #include <QMainWindow> | |
23 | #include <QChartView> |
|
23 | #include <QChartView> | |
24 | #include <QSplineSeries> |
|
24 | #include <QSplineSeries> | |
25 |
|
25 | |||
26 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
26 | QTCOMMERCIALCHART_USE_NAMESPACE | |
27 |
|
27 | |||
28 | int main(int argc, char *argv[]) |
|
28 | int main(int argc, char *argv[]) | |
29 | { |
|
29 | { | |
30 | QApplication a(argc, argv); |
|
30 | QApplication a(argc, argv); | |
31 |
|
31 | |||
32 | //![1] |
|
32 | //![1] | |
33 | QSplineSeries* series = new QSplineSeries(); |
|
33 | QSplineSeries* series = new QSplineSeries(); | |
34 | //![1] |
|
34 | //![1] | |
35 |
|
35 | |||
36 | //![2] |
|
36 | //![2] | |
37 | QPen red(Qt::red); |
|
37 | // QPen red(Qt::red); | |
38 | red.setWidth(3); |
|
38 | // red.setWidth(3); | |
39 | series->setPen(red); |
|
39 | // series->setPen(red); | |
40 | //![2] |
|
40 | //![2] | |
41 |
|
41 | |||
42 | //![3] |
|
42 | //![3] | |
43 | series->append(0, 6); |
|
43 | series->append(0, 6); | |
44 | series->append(2, 4); |
|
44 | series->append(2, 4); | |
45 | series->append(3, 8); |
|
45 | series->append(3, 8); | |
46 | series->append(7, 4); |
|
46 | series->append(7, 4); | |
47 | series->append(10, 5); |
|
47 | series->append(10, 5); | |
48 | *series << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2); |
|
48 | *series << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2); | |
49 | //![3] |
|
49 | //![3] | |
50 |
|
50 | |||
51 | //![4] |
|
51 | //![4] | |
52 | QChart* chart = new QChart(); |
|
52 | QChart* chart = new QChart(); | |
53 | chart->addSeries(series); |
|
53 | chart->addSeries(series); | |
54 | chart->setTitle("Simple spline chart example"); |
|
54 | chart->setTitle("Simple spline chart example"); | |
55 | chart->axisY()->setRange(0, 10); |
|
55 | chart->axisY()->setRange(0, 10); | |
56 | //![4] |
|
56 | //![4] | |
57 |
|
57 | |||
58 | //![5] |
|
58 | //![5] | |
59 | QChartView* chartView = new QChartView(chart); |
|
59 | QChartView* chartView = new QChartView(chart); | |
60 | chartView->setRenderHint(QPainter::Antialiasing); |
|
60 | chartView->setRenderHint(QPainter::Antialiasing); | |
61 | //![5] |
|
61 | //![5] | |
62 |
|
62 | |||
63 | //![6] |
|
63 | //![6] | |
64 | QMainWindow window; |
|
64 | QMainWindow window; | |
65 | window.setCentralWidget(chartView); |
|
65 | window.setCentralWidget(chartView); | |
66 | window.resize(400, 300); |
|
66 | window.resize(400, 300); | |
67 | window.show(); |
|
67 | window.show(); | |
68 | //![6] |
|
68 | //![6] | |
69 |
|
69 | |||
70 | return a.exec(); |
|
70 | return a.exec(); | |
71 | } |
|
71 | } |
General Comments 0
You need to be logged in to leave comments.
Login now