##// END OF EJS Templates
politically correct names for barchart examples
sauimone -
r881:2ca079d192f8
parent child
Show More
@@ -1,73 +1,73
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 //![1]
32 //![1]
33 QBarCategories categories;
33 QBarCategories categories;
34 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
34 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
35 //![1]
35 //![1]
36 //![2]
36 //![2]
37 QBarSet *set0 = new QBarSet("Bub");
37 QBarSet *set0 = new QBarSet("Jane");
38 QBarSet *set1 = new QBarSet("Bob");
38 QBarSet *set1 = new QBarSet("John");
39 QBarSet *set2 = new QBarSet("Guybrush");
39 QBarSet *set2 = new QBarSet("Axel");
40 QBarSet *set3 = new QBarSet("Larry");
40 QBarSet *set3 = new QBarSet("Mary");
41 QBarSet *set4 = new QBarSet("Zak");
41 QBarSet *set4 = new QBarSet("Samantha");
42
42
43 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
43 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
44 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
44 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
45 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
45 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
46 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
46 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
47 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
47 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
48 //![2]
48 //![2]
49 //![3]
49 //![3]
50 QBarSeries* series = new QBarSeries(categories);
50 QBarSeries* series = new QBarSeries(categories);
51 series->appendBarSet(set0);
51 series->appendBarSet(set0);
52 series->appendBarSet(set1);
52 series->appendBarSet(set1);
53 series->appendBarSet(set2);
53 series->appendBarSet(set2);
54 series->appendBarSet(set3);
54 series->appendBarSet(set3);
55 series->appendBarSet(set4);
55 series->appendBarSet(set4);
56 //![3]
56 //![3]
57 //![4]
57 //![4]
58 QChart* chart = new QChart();
58 QChart* chart = new QChart();
59 chart->addSeries(series);
59 chart->addSeries(series);
60 chart->setTitle("Simple barchart example");
60 chart->setTitle("Simple barchart example");
61 //![4]
61 //![4]
62 //![5]
62 //![5]
63 QChartView* chartView = new QChartView(chart);
63 QChartView* chartView = new QChartView(chart);
64 chartView->setRenderHint(QPainter::Antialiasing);
64 chartView->setRenderHint(QPainter::Antialiasing);
65 //![5]
65 //![5]
66 //![6]
66 //![6]
67 QMainWindow window;
67 QMainWindow window;
68 window.setCentralWidget(chartView);
68 window.setCentralWidget(chartView);
69 window.resize(400, 300);
69 window.resize(400, 300);
70 window.show();
70 window.show();
71 //![6]
71 //![6]
72 return a.exec();
72 return a.exec();
73 }
73 }
@@ -1,74 +1,74
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 //![1]
32 //![1]
33 QBarCategories categories;
33 QBarCategories categories;
34 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
34 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
35 //![1]
35 //![1]
36 //![2]
36 //![2]
37 QBarSet *set0 = new QBarSet("Bub");
37 QBarSet *set0 = new QBarSet("Jane");
38 QBarSet *set1 = new QBarSet("Bob");
38 QBarSet *set1 = new QBarSet("John");
39 QBarSet *set2 = new QBarSet("Guybrush");
39 QBarSet *set2 = new QBarSet("Axel");
40 QBarSet *set3 = new QBarSet("Larry");
40 QBarSet *set3 = new QBarSet("Mary");
41 QBarSet *set4 = new QBarSet("Zak");
41 QBarSet *set4 = new QBarSet("Samantha");
42
42
43 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
43 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
44 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
44 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
45 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
45 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
46 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
46 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
47 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
47 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
48 //![2]
48 //![2]
49 //![3]
49 //![3]
50 QPercentBarSeries* series = new QPercentBarSeries(categories);
50 QPercentBarSeries* series = new QPercentBarSeries(categories);
51 series->appendBarSet(set0);
51 series->appendBarSet(set0);
52 series->appendBarSet(set1);
52 series->appendBarSet(set1);
53 series->appendBarSet(set2);
53 series->appendBarSet(set2);
54 series->appendBarSet(set3);
54 series->appendBarSet(set3);
55 series->appendBarSet(set4);
55 series->appendBarSet(set4);
56 //![3]
56 //![3]
57 //![4]
57 //![4]
58 QChart* chart = new QChart();
58 QChart* chart = new QChart();
59 chart->addSeries(series);
59 chart->addSeries(series);
60 chart->setTitle("Simple precentbarchart example");
60 chart->setTitle("Simple precentbarchart example");
61 //![4]
61 //![4]
62 //![5]
62 //![5]
63 QChartView* chartView = new QChartView(chart);
63 QChartView* chartView = new QChartView(chart);
64 chartView->setRenderHint(QPainter::Antialiasing);
64 chartView->setRenderHint(QPainter::Antialiasing);
65 //![5]
65 //![5]
66 //![6]
66 //![6]
67 QMainWindow window;
67 QMainWindow window;
68 window.setCentralWidget(chartView);
68 window.setCentralWidget(chartView);
69 window.resize(400, 300);
69 window.resize(400, 300);
70 window.show();
70 window.show();
71 //![6]
71 //![6]
72 return a.exec();
72 return a.exec();
73 }
73 }
74
74
@@ -1,74 +1,74
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 //![1]
32 //![1]
33 QBarCategories categories;
33 QBarCategories categories;
34 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
34 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
35 //![1]
35 //![1]
36 //![2]
36 //![2]
37 QBarSet *set0 = new QBarSet("Bub");
37 QBarSet *set0 = new QBarSet("Jane");
38 QBarSet *set1 = new QBarSet("Bob");
38 QBarSet *set1 = new QBarSet("John");
39 QBarSet *set2 = new QBarSet("Guybrush");
39 QBarSet *set2 = new QBarSet("Axel");
40 QBarSet *set3 = new QBarSet("Larry");
40 QBarSet *set3 = new QBarSet("Mary");
41 QBarSet *set4 = new QBarSet("Zak");
41 QBarSet *set4 = new QBarSet("Samantha");
42
42
43 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
43 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
44 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
44 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
45 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
45 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
46 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
46 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
47 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
47 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
48 //![2]
48 //![2]
49 //![3]
49 //![3]
50 QStackedBarSeries* series = new QStackedBarSeries(categories);
50 QStackedBarSeries* series = new QStackedBarSeries(categories);
51 series->appendBarSet(set0);
51 series->appendBarSet(set0);
52 series->appendBarSet(set1);
52 series->appendBarSet(set1);
53 series->appendBarSet(set2);
53 series->appendBarSet(set2);
54 series->appendBarSet(set3);
54 series->appendBarSet(set3);
55 series->appendBarSet(set4);
55 series->appendBarSet(set4);
56 //![3]
56 //![3]
57 //![4]
57 //![4]
58 QChart* chart = new QChart();
58 QChart* chart = new QChart();
59 chart->addSeries(series);
59 chart->addSeries(series);
60 chart->setTitle("Simple stackedbarchart example");
60 chart->setTitle("Simple stackedbarchart example");
61 //![4]
61 //![4]
62 //![5]
62 //![5]
63 QChartView* chartView = new QChartView(chart);
63 QChartView* chartView = new QChartView(chart);
64 chartView->setRenderHint(QPainter::Antialiasing);
64 chartView->setRenderHint(QPainter::Antialiasing);
65 //![5]
65 //![5]
66 //![6]
66 //![6]
67 QMainWindow window;
67 QMainWindow window;
68 window.setCentralWidget(chartView);
68 window.setCentralWidget(chartView);
69 window.resize(400, 300);
69 window.resize(400, 300);
70 window.show();
70 window.show();
71 //![6]
71 //![6]
72 return a.exec();
72 return a.exec();
73 }
73 }
74
74
General Comments 0
You need to be logged in to leave comments. Login now