##// END OF EJS Templates
Add newlines to examples to make docs nicer
Jani Honkonen -
r883:6a54ca9aa4b1
parent child
Show More
@@ -1,73 +1,79
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 #include <QAreaSeries>
25 #include <QAreaSeries>
26
26
27 QTCOMMERCIALCHART_USE_NAMESPACE
27 QTCOMMERCIALCHART_USE_NAMESPACE
28
28
29 int main(int argc, char *argv[])
29 int main(int argc, char *argv[])
30 {
30 {
31 QApplication a(argc, argv);
31 QApplication a(argc, argv);
32
32 //![1]
33 //![1]
33 QLineSeries* series0 = new QLineSeries();
34 QLineSeries* series0 = new QLineSeries();
34 QLineSeries* series1 = new QLineSeries();
35 QLineSeries* series1 = new QLineSeries();
35 //![1]
36 //![1]
36
37
37 //![2]
38 //![2]
38 *series0 << QPointF(1, 5) << QPointF(3, 7) << QPointF(7, 6) << QPointF(9, 7) << QPointF(12, 6)
39 *series0 << QPointF(1, 5) << QPointF(3, 7) << QPointF(7, 6) << QPointF(9, 7) << QPointF(12, 6)
39 << QPointF(16, 7) << QPointF(18, 5);
40 << QPointF(16, 7) << QPointF(18, 5);
40 *series1 << QPointF(1, 3) << QPointF(3, 4) << QPointF(7, 3) << QPointF(8, 2) << QPointF(12, 3)
41 *series1 << QPointF(1, 3) << QPointF(3, 4) << QPointF(7, 3) << QPointF(8, 2) << QPointF(12, 3)
41 << QPointF(16, 4) << QPointF(18, 3);
42 << QPointF(16, 4) << QPointF(18, 3);
42 //![2]
43 //![2]
44
43 //![3]
45 //![3]
44 QAreaSeries* series = new QAreaSeries(series0, series1);
46 QAreaSeries* series = new QAreaSeries(series0, series1);
45 QPen pen(0x059605);
47 QPen pen(0x059605);
46 pen.setWidth(3);
48 pen.setWidth(3);
47 series->setPen(pen);
49 series->setPen(pen);
48
50
49 QLinearGradient gradient(QPointF(0, 0), QPointF(0, 1));
51 QLinearGradient gradient(QPointF(0, 0), QPointF(0, 1));
50 gradient.setColorAt(0.0, 0x3cc63c);
52 gradient.setColorAt(0.0, 0x3cc63c);
51 gradient.setColorAt(1.0, 0x26f626);
53 gradient.setColorAt(1.0, 0x26f626);
52 gradient.setCoordinateMode(QGradient::ObjectBoundingMode);
54 gradient.setCoordinateMode(QGradient::ObjectBoundingMode);
53 series->setBrush(gradient);
55 series->setBrush(gradient);
54 //![3]
56 //![3]
57
55 //![4]
58 //![4]
56 QChart* chart = new QChart();
59 QChart* chart = new QChart();
57 chart->addSeries(series);
60 chart->addSeries(series);
58 chart->setTitle("Simple areachart example");
61 chart->setTitle("Simple areachart example");
59 chart->axisX()->setRange(0, 20);
62 chart->axisX()->setRange(0, 20);
60 chart->axisY()->setRange(0, 10);
63 chart->axisY()->setRange(0, 10);
61 //![4]
64 //![4]
65
62 //![5]
66 //![5]
63 QChartView* chartView = new QChartView(chart);
67 QChartView* chartView = new QChartView(chart);
64 chartView->setRenderHint(QPainter::Antialiasing);
68 chartView->setRenderHint(QPainter::Antialiasing);
65 //![5]
69 //![5]
70
66 //![6]
71 //![6]
67 QMainWindow window;
72 QMainWindow window;
68 window.setCentralWidget(chartView);
73 window.setCentralWidget(chartView);
69 window.resize(400, 300);
74 window.resize(400, 300);
70 window.show();
75 window.show();
71 //![6]
76 //![6]
77
72 return a.exec();
78 return a.exec();
73 }
79 }
@@ -1,73 +1,80
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 <QBarSeries>
24 #include <QBarSeries>
25 #include <QBarSet>
25 #include <QBarSet>
26
26
27 QTCOMMERCIALCHART_USE_NAMESPACE
27 QTCOMMERCIALCHART_USE_NAMESPACE
28
28
29 int main(int argc, char *argv[])
29 int main(int argc, char *argv[])
30 {
30 {
31 QApplication a(argc, argv);
31 QApplication a(argc, argv);
32
32 //![1]
33 //![1]
33 QBarCategories categories;
34 QBarCategories categories;
34 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
35 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
35 //![1]
36 //![1]
37
36 //![2]
38 //![2]
37 QBarSet *set0 = new QBarSet("Jane");
39 QBarSet *set0 = new QBarSet("Jane");
38 QBarSet *set1 = new QBarSet("John");
40 QBarSet *set1 = new QBarSet("John");
39 QBarSet *set2 = new QBarSet("Axel");
41 QBarSet *set2 = new QBarSet("Axel");
40 QBarSet *set3 = new QBarSet("Mary");
42 QBarSet *set3 = new QBarSet("Mary");
41 QBarSet *set4 = new QBarSet("Samantha");
43 QBarSet *set4 = new QBarSet("Samantha");
42
44
43 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
45 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
44 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
46 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
45 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
47 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
46 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
48 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
47 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
49 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
48 //![2]
50 //![2]
51
49 //![3]
52 //![3]
50 QBarSeries* series = new QBarSeries(categories);
53 QBarSeries* series = new QBarSeries(categories);
51 series->appendBarSet(set0);
54 series->appendBarSet(set0);
52 series->appendBarSet(set1);
55 series->appendBarSet(set1);
53 series->appendBarSet(set2);
56 series->appendBarSet(set2);
54 series->appendBarSet(set3);
57 series->appendBarSet(set3);
55 series->appendBarSet(set4);
58 series->appendBarSet(set4);
56 //![3]
59 //![3]
60
57 //![4]
61 //![4]
58 QChart* chart = new QChart();
62 QChart* chart = new QChart();
59 chart->addSeries(series);
63 chart->addSeries(series);
60 chart->setTitle("Simple barchart example");
64 chart->setTitle("Simple barchart example");
61 //![4]
65 //![4]
66
62 //![5]
67 //![5]
63 QChartView* chartView = new QChartView(chart);
68 QChartView* chartView = new QChartView(chart);
64 chartView->setRenderHint(QPainter::Antialiasing);
69 chartView->setRenderHint(QPainter::Antialiasing);
65 //![5]
70 //![5]
71
66 //![6]
72 //![6]
67 QMainWindow window;
73 QMainWindow window;
68 window.setCentralWidget(chartView);
74 window.setCentralWidget(chartView);
69 window.resize(400, 300);
75 window.resize(400, 300);
70 window.show();
76 window.show();
71 //![6]
77 //![6]
78
72 return a.exec();
79 return a.exec();
73 }
80 }
@@ -1,103 +1,112
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 blue(Qt::yellow);
34 QPen blue(Qt::yellow);
35 blue.setWidth(3);
35 blue.setWidth(3);
36 series->setPen(blue);
36 series->setPen(blue);
37 //![1]
37 //![1]
38
38 //![2]
39 //![2]
39 *series << QPointF(0, 6) << QPointF(2, 4) << QPointF(3, 8) << QPointF(7, 4) << QPointF(10,5);
40 *series << QPointF(0, 6) << QPointF(2, 4) << QPointF(3, 8) << QPointF(7, 4) << QPointF(10,5);
40 //![2]
41 //![2]
42
41 //![3]
43 //![3]
42 QChart* chart = new QChart();
44 QChart* chart = new QChart();
43 chart->addSeries(series);
45 chart->addSeries(series);
44 chart->setTitle("Simple customchart example");
46 chart->setTitle("Simple customchart example");
45 //![3]
47 //![3]
48
46 //![4]
49 //![4]
47 QFont font;
50 QFont font;
48 font.setPixelSize(18);
51 font.setPixelSize(18);
49 chart->setTitleFont(font);
52 chart->setTitleFont(font);
50 chart->setTitleBrush(Qt::yellow);
53 chart->setTitleBrush(Qt::yellow);
51
54
52 QLinearGradient backgroundGradient;
55 QLinearGradient backgroundGradient;
53 backgroundGradient.setStart(QPointF(0,0));
56 backgroundGradient.setStart(QPointF(0,0));
54 backgroundGradient.setFinalStop(QPointF(0,1));
57 backgroundGradient.setFinalStop(QPointF(0,1));
55 backgroundGradient.setColorAt(0.0, 0x3cc63c);
58 backgroundGradient.setColorAt(0.0, 0x3cc63c);
56 backgroundGradient.setColorAt(1.0, 0x26f626);
59 backgroundGradient.setColorAt(1.0, 0x26f626);
57 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
60 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
58 chart->setBackgroundBrush(backgroundGradient);
61 chart->setBackgroundBrush(backgroundGradient);
59 //![4]
62 //![4]
63
60 //![5]
64 //![5]
61 QPen black(Qt::black);
65 QPen black(Qt::black);
62 QChartAxis* axisX = chart->axisX();
66 QChartAxis* axisX = chart->axisX();
63 QChartAxis* axisY = chart->axisY();
67 QChartAxis* axisY = chart->axisY();
64
68
65 axisX->setAxisPen(black);
69 axisX->setAxisPen(black);
66 axisY->setAxisPen(black);
70 axisY->setAxisPen(black);
67 axisX->setGridLineVisible(false);
71 axisX->setGridLineVisible(false);
68 axisY->setGridLineVisible(false);
72 axisY->setGridLineVisible(false);
69
73
70 axisY->setShadesPen(Qt::NoPen);
74 axisY->setShadesPen(Qt::NoPen);
71 axisY->setShadesOpacity(0.5);
75 axisY->setShadesOpacity(0.5);
72 axisY->setShadesBrush(Qt::white);
76 axisY->setShadesBrush(Qt::white);
73 axisY->setShadesVisible(true);
77 axisY->setShadesVisible(true);
74 //![5]
78 //![5]
79
75 //![6]
80 //![6]
76 QChartAxisCategories* categoriesX = chart->axisX()->categories();
81 QChartAxisCategories* categoriesX = chart->axisX()->categories();
77 categoriesX->insert(1,"low");
82 categoriesX->insert(1,"low");
78 categoriesX->insert(5,"optimal");
83 categoriesX->insert(5,"optimal");
79 categoriesX->insert(10,"high");
84 categoriesX->insert(10,"high");
80
85
81 QChartAxisCategories* categoriesY = chart->axisY()->categories();
86 QChartAxisCategories* categoriesY = chart->axisY()->categories();
82 categoriesY->insert(1,"slow");
87 categoriesY->insert(1,"slow");
83 categoriesY->insert(5,"med");
88 categoriesY->insert(5,"med");
84 categoriesY->insert(10,"fast");
89 categoriesY->insert(10,"fast");
85 //![6]
90 //![6]
91
86 //![7]
92 //![7]
87 axisX->setRange(0,10);
93 axisX->setRange(0,10);
88 axisX->setTicksCount(4);
94 axisX->setTicksCount(4);
89 axisY->setRange(0,10);
95 axisY->setRange(0,10);
90 axisY->setTicksCount(4);
96 axisY->setTicksCount(4);
91 //![7]
97 //![7]
98
92 //![8]
99 //![8]
93 QChartView* chartView = new QChartView(chart);
100 QChartView* chartView = new QChartView(chart);
94 chartView->setRenderHint(QPainter::Antialiasing);
101 chartView->setRenderHint(QPainter::Antialiasing);
95 //![8]
102 //![8]
103
96 //![9]
104 //![9]
97 QMainWindow window;
105 QMainWindow window;
98 window.setCentralWidget(chartView);
106 window.setCentralWidget(chartView);
99 window.resize(400, 300);
107 window.resize(400, 300);
100 window.show();
108 window.show();
101 //![9]
109 //![9]
110
102 return a.exec();
111 return a.exec();
103 }
112 }
@@ -1,61 +1,67
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 //![1]
32 //![1]
32 QLineSeries* series = new QLineSeries();
33 QLineSeries* series = new QLineSeries();
33 QPen red(Qt::red);
34 QPen red(Qt::red);
34 red.setWidth(3);
35 red.setWidth(3);
35 series->setPen(red);
36 series->setPen(red);
36 //![1]
37 //![1]
38
37 //![2]
39 //![2]
38 series->append(0, 6);
40 series->append(0, 6);
39 series->append(2, 4);
41 series->append(2, 4);
40 series->append(3, 8);
42 series->append(3, 8);
41 series->append(7, 4);
43 series->append(7, 4);
42 series->append(10, 5);
44 series->append(10, 5);
43 *series << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2);
45 *series << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2);
44 //![2]
46 //![2]
47
45 //![3]
48 //![3]
46 QChart* chart = new QChart();
49 QChart* chart = new QChart();
47 chart->addSeries(series);
50 chart->addSeries(series);
48 chart->setTitle("Simple line chart example");
51 chart->setTitle("Simple line chart example");
49 //![3]
52 //![3]
53
50 //![4]
54 //![4]
51 QChartView* chartView = new QChartView(chart);
55 QChartView* chartView = new QChartView(chart);
52 chartView->setRenderHint(QPainter::Antialiasing);
56 chartView->setRenderHint(QPainter::Antialiasing);
53 //![4]
57 //![4]
58
54 //![5]
59 //![5]
55 QMainWindow window;
60 QMainWindow window;
56 window.setCentralWidget(chartView);
61 window.setCentralWidget(chartView);
57 window.resize(400, 300);
62 window.resize(400, 300);
58 window.show();
63 window.show();
59 //![5]
64 //![5]
65
60 return a.exec();
66 return a.exec();
61 }
67 }
@@ -1,74 +1,81
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 <QPercentBarSeries>
24 #include <QPercentBarSeries>
25 #include <QBarSet>
25 #include <QBarSet>
26
26
27 QTCOMMERCIALCHART_USE_NAMESPACE
27 QTCOMMERCIALCHART_USE_NAMESPACE
28
28
29 int main(int argc, char *argv[])
29 int main(int argc, char *argv[])
30 {
30 {
31 QApplication a(argc, argv);
31 QApplication a(argc, argv);
32
32 //![1]
33 //![1]
33 QBarCategories categories;
34 QBarCategories categories;
34 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
35 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
35 //![1]
36 //![1]
37
36 //![2]
38 //![2]
37 QBarSet *set0 = new QBarSet("Jane");
39 QBarSet *set0 = new QBarSet("Jane");
38 QBarSet *set1 = new QBarSet("John");
40 QBarSet *set1 = new QBarSet("John");
39 QBarSet *set2 = new QBarSet("Axel");
41 QBarSet *set2 = new QBarSet("Axel");
40 QBarSet *set3 = new QBarSet("Mary");
42 QBarSet *set3 = new QBarSet("Mary");
41 QBarSet *set4 = new QBarSet("Samantha");
43 QBarSet *set4 = new QBarSet("Samantha");
42
44
43 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
45 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
44 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
46 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
45 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
47 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
46 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
48 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
47 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
49 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
48 //![2]
50 //![2]
51
49 //![3]
52 //![3]
50 QPercentBarSeries* series = new QPercentBarSeries(categories);
53 QPercentBarSeries* series = new QPercentBarSeries(categories);
51 series->appendBarSet(set0);
54 series->appendBarSet(set0);
52 series->appendBarSet(set1);
55 series->appendBarSet(set1);
53 series->appendBarSet(set2);
56 series->appendBarSet(set2);
54 series->appendBarSet(set3);
57 series->appendBarSet(set3);
55 series->appendBarSet(set4);
58 series->appendBarSet(set4);
56 //![3]
59 //![3]
60
57 //![4]
61 //![4]
58 QChart* chart = new QChart();
62 QChart* chart = new QChart();
59 chart->addSeries(series);
63 chart->addSeries(series);
60 chart->setTitle("Simple precentbarchart example");
64 chart->setTitle("Simple precentbarchart example");
61 //![4]
65 //![4]
66
62 //![5]
67 //![5]
63 QChartView* chartView = new QChartView(chart);
68 QChartView* chartView = new QChartView(chart);
64 chartView->setRenderHint(QPainter::Antialiasing);
69 chartView->setRenderHint(QPainter::Antialiasing);
65 //![5]
70 //![5]
71
66 //![6]
72 //![6]
67 QMainWindow window;
73 QMainWindow window;
68 window.setCentralWidget(chartView);
74 window.setCentralWidget(chartView);
69 window.resize(400, 300);
75 window.resize(400, 300);
70 window.show();
76 window.show();
71 //![6]
77 //![6]
78
72 return a.exec();
79 return a.exec();
73 }
80 }
74
81
@@ -1,77 +1,82
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 <QtGui/QApplication>
21 #include <QtGui/QApplication>
22 #include <QMainWindow>
22 #include <QMainWindow>
23 #include <QChartView>
23 #include <QChartView>
24 #include <QScatterSeries>
24 #include <QScatterSeries>
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 //![1]
32 //![1]
32 QPen pen(Qt::black);
33 QPen pen(Qt::black);
33 pen.setWidth(2);
34 pen.setWidth(2);
34 QBrush blue(Qt::blue);
35 QBrush blue(Qt::blue);
35 QBrush red(Qt::red);
36 QBrush red(Qt::red);
36
37
37 QScatterSeries *series0 = new QScatterSeries();
38 QScatterSeries *series0 = new QScatterSeries();
38 series0->setPen(pen);
39 series0->setPen(pen);
39 series0->setBrush(blue);
40 series0->setBrush(blue);
40 series0->setShape(QScatterSeries::MarkerShapeCircle);
41 series0->setShape(QScatterSeries::MarkerShapeCircle);
41 series0->setSize(15.0);
42 series0->setSize(15.0);
42
43
43 QScatterSeries *series1 = new QScatterSeries();
44 QScatterSeries *series1 = new QScatterSeries();
44 series1->setPen(pen);
45 series1->setPen(pen);
45 series1->setBrush(red);
46 series1->setBrush(red);
46 series1->setShape(QScatterSeries::MarkerShapeCircle);
47 series1->setShape(QScatterSeries::MarkerShapeCircle);
47 series1->setSize(15.0);
48 series1->setSize(15.0);
48 //![1]
49 //![1]
49
50
50 //![2]
51 //![2]
51 series0->append(0, 6);
52 series0->append(0, 6);
52 series0->append(2, 4);
53 series0->append(2, 4);
53 series0->append(3, 8);
54 series0->append(3, 8);
54 series0->append(7, 4);
55 series0->append(7, 4);
55 series0->append(10, 5);
56 series0->append(10, 5);
56
57
57 *series1 << QPointF(1, 1) << QPointF(3, 3) << QPointF(7, 6) << QPointF(8, 3) << QPointF(10, 2);
58 *series1 << QPointF(1, 1) << QPointF(3, 3) << QPointF(7, 6) << QPointF(8, 3) << QPointF(10, 2);
58 //![2]
59 //![2]
60
59 //![3]
61 //![3]
60 QChart* chart = new QChart();
62 QChart* chart = new QChart();
61
63
62 chart->addSeries(series0);
64 chart->addSeries(series0);
63 chart->addSeries(series1);
65 chart->addSeries(series1);
64 chart->setTitle("Simple scatterchart example");
66 chart->setTitle("Simple scatterchart example");
65 //![3]
67 //![3]
68
66 //![4]
69 //![4]
67 QChartView* chartView = new QChartView(chart);
70 QChartView* chartView = new QChartView(chart);
68 chartView->setRenderHint(QPainter::Antialiasing);
71 chartView->setRenderHint(QPainter::Antialiasing);
69 //![4]
72 //![4]
73
70 //![5]
74 //![5]
71 QMainWindow window;
75 QMainWindow window;
72 window.setCentralWidget(chartView);
76 window.setCentralWidget(chartView);
73 window.resize(400, 300);
77 window.resize(400, 300);
74 window.show();
78 window.show();
75 //![5]
79 //![5]
80
76 return a.exec();
81 return a.exec();
77 }
82 }
@@ -1,74 +1,81
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 <QStackedBarSeries>
24 #include <QStackedBarSeries>
25 #include <QBarSet>
25 #include <QBarSet>
26
26
27 QTCOMMERCIALCHART_USE_NAMESPACE
27 QTCOMMERCIALCHART_USE_NAMESPACE
28
28
29 int main(int argc, char *argv[])
29 int main(int argc, char *argv[])
30 {
30 {
31 QApplication a(argc, argv);
31 QApplication a(argc, argv);
32
32 //![1]
33 //![1]
33 QBarCategories categories;
34 QBarCategories categories;
34 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
35 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
35 //![1]
36 //![1]
37
36 //![2]
38 //![2]
37 QBarSet *set0 = new QBarSet("Jane");
39 QBarSet *set0 = new QBarSet("Jane");
38 QBarSet *set1 = new QBarSet("John");
40 QBarSet *set1 = new QBarSet("John");
39 QBarSet *set2 = new QBarSet("Axel");
41 QBarSet *set2 = new QBarSet("Axel");
40 QBarSet *set3 = new QBarSet("Mary");
42 QBarSet *set3 = new QBarSet("Mary");
41 QBarSet *set4 = new QBarSet("Samantha");
43 QBarSet *set4 = new QBarSet("Samantha");
42
44
43 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
45 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
44 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
46 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
45 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
47 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
46 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
48 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
47 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
49 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
48 //![2]
50 //![2]
51
49 //![3]
52 //![3]
50 QStackedBarSeries* series = new QStackedBarSeries(categories);
53 QStackedBarSeries* series = new QStackedBarSeries(categories);
51 series->appendBarSet(set0);
54 series->appendBarSet(set0);
52 series->appendBarSet(set1);
55 series->appendBarSet(set1);
53 series->appendBarSet(set2);
56 series->appendBarSet(set2);
54 series->appendBarSet(set3);
57 series->appendBarSet(set3);
55 series->appendBarSet(set4);
58 series->appendBarSet(set4);
56 //![3]
59 //![3]
60
57 //![4]
61 //![4]
58 QChart* chart = new QChart();
62 QChart* chart = new QChart();
59 chart->addSeries(series);
63 chart->addSeries(series);
60 chart->setTitle("Simple stackedbarchart example");
64 chart->setTitle("Simple stackedbarchart example");
61 //![4]
65 //![4]
66
62 //![5]
67 //![5]
63 QChartView* chartView = new QChartView(chart);
68 QChartView* chartView = new QChartView(chart);
64 chartView->setRenderHint(QPainter::Antialiasing);
69 chartView->setRenderHint(QPainter::Antialiasing);
65 //![5]
70 //![5]
71
66 //![6]
72 //![6]
67 QMainWindow window;
73 QMainWindow window;
68 window.setCentralWidget(chartView);
74 window.setCentralWidget(chartView);
69 window.resize(400, 300);
75 window.resize(400, 300);
70 window.show();
76 window.show();
71 //![6]
77 //![6]
78
72 return a.exec();
79 return a.exec();
73 }
80 }
74
81
@@ -1,66 +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 "chartview.h"
21 #include "chartview.h"
22 #include <QApplication>
22 #include <QApplication>
23 #include <QMainWindow>
23 #include <QMainWindow>
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* series0 = new QLineSeries();
33 QLineSeries* series0 = new QLineSeries();
34 QPen blue(Qt::blue);
34 QPen blue(Qt::blue);
35 blue.setWidth(3);
35 blue.setWidth(3);
36 series0->setPen(blue);
36 series0->setPen(blue);
37
37
38 QLineSeries* series1 = new QLineSeries();
38 QLineSeries* series1 = new QLineSeries();
39 QPen red(Qt::red);
39 QPen red(Qt::red);
40 red.setWidth(3);
40 red.setWidth(3);
41 series1->setPen(red);
41 series1->setPen(red);
42 //![1]
42 //![1]
43
43 //![2]
44 //![2]
44 *series0 << QPointF(0, 6) << QPointF(2, 4) << QPointF(3, 8) << QPointF(7, 4) << QPointF(10, 5);
45 *series0 << QPointF(0, 6) << QPointF(2, 4) << QPointF(3, 8) << QPointF(7, 4) << QPointF(10, 5);
45 *series1 << QPointF(1, 1) << QPointF(3, 3) << QPointF(7, 6) << QPointF(8, 3) << QPointF(10, 2);
46 *series1 << QPointF(1, 1) << QPointF(3, 3) << QPointF(7, 6) << QPointF(8, 3) << QPointF(10, 2);
46 //![2]
47 //![2]
48
47 //![3]
49 //![3]
48 QChart* chart = new QChart();
50 QChart* chart = new QChart();
49
51
50 chart->addSeries(series0);
52 chart->addSeries(series0);
51 chart->addSeries(series1);
53 chart->addSeries(series1);
52 chart->setTitle("Zoom in/out chart example");
54 chart->setTitle("Zoom in/out chart example");
53 chart->setAnimationOptions(QChart::AllAnimations);
55 chart->setAnimationOptions(QChart::AllAnimations);
54 //![3]
56 //![3]
57
55 //![4]
58 //![4]
56 ChartView* chartView = new ChartView(chart);
59 ChartView* chartView = new ChartView(chart);
57 chartView->setRenderHint(QPainter::Antialiasing);
60 chartView->setRenderHint(QPainter::Antialiasing);
58 //![4]
61 //![4]
62
59 //![5]
63 //![5]
60 QMainWindow window;
64 QMainWindow window;
61 window.setCentralWidget(chartView);
65 window.setCentralWidget(chartView);
62 window.resize(400, 300);
66 window.resize(400, 300);
63 window.show();
67 window.show();
64 //![5]
68 //![5]
69
65 return a.exec();
70 return a.exec();
66 }
71 }
General Comments 0
You need to be logged in to leave comments. Login now