@@ -1,57 +1,94 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE:BSD$ | |||
|
10 | ** You may use this file under the terms of the BSD license as follows: | |||
|
11 | ** | |||
|
12 | ** "Redistribution and use in source and binary forms, with or without | |||
|
13 | ** modification, are permitted provided that the following conditions are | |||
|
14 | ** met: | |||
|
15 | ** * Redistributions of source code must retain the above copyright | |||
|
16 | ** notice, this list of conditions and the following disclaimer. | |||
|
17 | ** * Redistributions in binary form must reproduce the above copyright | |||
|
18 | ** notice, this list of conditions and the following disclaimer in | |||
|
19 | ** the documentation and/or other materials provided with the | |||
|
20 | ** distribution. | |||
|
21 | ** * Neither the name of Digia nor the names of its contributors | |||
|
22 | ** may be used to endorse or promote products derived from this | |||
|
23 | ** software without specific prior written permission. | |||
|
24 | ** | |||
|
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
|
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
|
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
|
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
|
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
|
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
|
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
|
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
|
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
|
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
|
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." | |||
|
36 | ** $QT_END_LICENSE$ | |||
|
37 | ** | |||
|
38 | ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). | |||
|
39 | ** | |||
|
40 | ****************************************************************************/ | |||
|
41 | ||||
1 | #include <QApplication> |
|
42 | #include <QApplication> | |
2 | #include <QMainWindow> |
|
43 | #include <QMainWindow> | |
3 | #include <QChartView> |
|
44 | #include <QChartView> | |
4 | #include <QLineSeries> |
|
45 | #include <QLineSeries> | |
5 | #include <QAreaSeries> |
|
46 | #include <QAreaSeries> | |
6 | #include <cmath> |
|
|||
7 |
|
47 | |||
8 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
48 | QTCOMMERCIALCHART_USE_NAMESPACE | |
9 |
|
49 | |||
10 | int main(int argc, char *argv[]) |
|
50 | int main(int argc, char *argv[]) | |
11 | { |
|
51 | { | |
12 | QApplication a(argc, argv); |
|
52 | QApplication a(argc, argv); | |
13 |
|
||||
14 | //![1] |
|
53 | //![1] | |
15 |
|
||||
16 | QLineSeries* series0 = new QLineSeries(); |
|
54 | QLineSeries* series0 = new QLineSeries(); | |
17 | QLineSeries* series1 = new QLineSeries(); |
|
55 | QLineSeries* series1 = new QLineSeries(); | |
18 |
|
||||
19 | //![1] |
|
56 | //![1] | |
20 |
|
57 | |||
21 | //![2] |
|
58 | //![2] | |
22 |
*series0 << QPointF(1, 5) << QPointF(3, 7) << QPointF(7, 6) << QPointF(9, 7) << QPointF(12,6) |
|
59 | *series0 << QPointF(1, 5) << QPointF(3, 7) << QPointF(7, 6) << QPointF(9, 7) << QPointF(12, 6) | |
23 | *series1 << QPointF(1, 3) << QPointF(3, 4) << QPointF(7, 3) << QPointF(8, 2) << QPointF(12,3) << QPointF(16,4) << QPointF(18,3); |
|
60 | << QPointF(16, 7) << QPointF(18, 5); | |
|
61 | *series1 << QPointF(1, 3) << QPointF(3, 4) << QPointF(7, 3) << QPointF(8, 2) << QPointF(12, 3) | |||
|
62 | << QPointF(16, 4) << QPointF(18, 3); | |||
24 | //![2] |
|
63 | //![2] | |
25 | //![3] |
|
64 | //![3] | |
26 |
|
65 | QAreaSeries* series = new QAreaSeries(series0, series1); | ||
27 | QAreaSeries* series = new QAreaSeries(series0,series1); |
|
|||
28 | QPen pen(0x059605); |
|
66 | QPen pen(0x059605); | |
29 | pen.setWidth(3); |
|
67 | pen.setWidth(3); | |
30 | series->setPen(pen); |
|
68 | series->setPen(pen); | |
31 |
|
69 | |||
32 | QLinearGradient gradient(QPointF(0, 0), QPointF(0, 1)); |
|
70 | QLinearGradient gradient(QPointF(0, 0), QPointF(0, 1)); | |
33 | gradient.setColorAt(0.0,0x3cc63c); |
|
71 | gradient.setColorAt(0.0, 0x3cc63c); | |
34 | gradient.setColorAt(1.0, 0x26f626); |
|
72 | gradient.setColorAt(1.0, 0x26f626); | |
35 | gradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
73 | gradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
36 | series->setBrush(gradient); |
|
74 | series->setBrush(gradient); | |
37 |
|
||||
38 | //![3] |
|
75 | //![3] | |
39 | //![4] |
|
76 | //![4] | |
40 | QMainWindow window; |
|
77 | QChart* chart = new QChart(); | |
41 | QChartView* chartView = new QChartView(&window); |
|
78 | chart->addSeries(series); | |
42 |
|
79 | chart->setTitle("Simple areachart example"); | ||
43 | chartView->setChartTitle("Simple area chart example"); |
|
80 | chart->axisX()->setRange(0, 20); | |
44 | chartView->setRenderHint(QPainter::Antialiasing); |
|
81 | chart->axisY()->setRange(0, 10); | |
45 |
|
||||
46 | chartView->addSeries(series); |
|
|||
47 | chartView->axisX()->setRange(0,20); |
|
|||
48 | chartView->axisY()->setRange(0,10); |
|
|||
49 | //![4] |
|
82 | //![4] | |
50 | //![5] |
|
83 | //![5] | |
|
84 | QChartView* chartView = new QChartView(chart); | |||
|
85 | chartView->setRenderHint(QPainter::Antialiasing); | |||
|
86 | //![5] | |||
|
87 | //![6] | |||
|
88 | QMainWindow window; | |||
51 | window.setCentralWidget(chartView); |
|
89 | window.setCentralWidget(chartView); | |
52 | window.resize(400, 300); |
|
90 | window.resize(400, 300); | |
53 | window.show(); |
|
91 | window.show(); | |
54 |
//![ |
|
92 | //![6] | |
55 |
|
||||
56 | return a.exec(); |
|
93 | return a.exec(); | |
57 | } |
|
94 | } |
@@ -3,8 +3,5 | |||||
3 | } |
|
3 | } | |
4 |
|
4 | |||
5 | TARGET = barchart |
|
5 | TARGET = barchart | |
6 |
SOURCES += main.cpp |
|
6 | SOURCES += main.cpp | |
7 | chartwidget.cpp |
|
|||
8 | HEADERS += \ |
|
|||
9 | chartwidget.h |
|
|||
10 |
|
7 |
@@ -1,27 +1,60 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE:BSD$ | |||
|
10 | ** You may use this file under the terms of the BSD license as follows: | |||
|
11 | ** | |||
|
12 | ** "Redistribution and use in source and binary forms, with or without | |||
|
13 | ** modification, are permitted provided that the following conditions are | |||
|
14 | ** met: | |||
|
15 | ** * Redistributions of source code must retain the above copyright | |||
|
16 | ** notice, this list of conditions and the following disclaimer. | |||
|
17 | ** * Redistributions in binary form must reproduce the above copyright | |||
|
18 | ** notice, this list of conditions and the following disclaimer in | |||
|
19 | ** the documentation and/or other materials provided with the | |||
|
20 | ** distribution. | |||
|
21 | ** * Neither the name of Digia nor the names of its contributors | |||
|
22 | ** may be used to endorse or promote products derived from this | |||
|
23 | ** software without specific prior written permission. | |||
|
24 | ** | |||
|
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
|
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
|
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
|
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
|
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
|
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
|
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
|
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
|
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
|
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
|
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." | |||
|
36 | ** $QT_END_LICENSE$ | |||
|
37 | ** | |||
|
38 | ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). | |||
|
39 | ** | |||
|
40 | ****************************************************************************/ | |||
|
41 | ||||
1 | #include <QApplication> |
|
42 | #include <QApplication> | |
2 | #include <QMainWindow> |
|
43 | #include <QMainWindow> | |
3 |
#include < |
|
44 | #include <QChartView> | |
4 |
#include < |
|
45 | #include <QBarSeries> | |
5 |
#include < |
|
46 | #include <QBarSet> | |
6 | #include <qchartaxis.h> |
|
|||
7 | #include <QStringList> |
|
|||
8 |
|
47 | |||
9 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
48 | QTCOMMERCIALCHART_USE_NAMESPACE | |
10 |
|
49 | |||
11 | int main(int argc, char *argv[]) |
|
50 | int main(int argc, char *argv[]) | |
12 | { |
|
51 | { | |
13 | QApplication a(argc, argv); |
|
52 | QApplication a(argc, argv); | |
14 | QMainWindow window; |
|
53 | //![1] | |
15 |
|
54 | QBarCategories categories; | ||
16 | //! [1] |
|
|||
17 | // Define categories |
|
|||
18 | QStringList categories; |
|
|||
19 | categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; |
|
55 | categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; | |
20 |
|
|
56 | //![1] | |
21 |
|
57 | //![2] | ||
22 | //! [2] |
|
|||
23 | // Create some test sets for chat |
|
|||
24 |
|
||||
25 | QBarSet *set0 = new QBarSet("Bub"); |
|
58 | QBarSet *set0 = new QBarSet("Bub"); | |
26 | QBarSet *set1 = new QBarSet("Bob"); |
|
59 | QBarSet *set1 = new QBarSet("Bob"); | |
27 | QBarSet *set2 = new QBarSet("Guybrush"); |
|
60 | QBarSet *set2 = new QBarSet("Guybrush"); | |
@@ -33,48 +66,29 int main(int argc, char *argv[]) | |||||
33 | *set2 << 3 << 5 << 8 << 13 << 8 << 5; |
|
66 | *set2 << 3 << 5 << 8 << 13 << 8 << 5; | |
34 | *set3 << 5 << 6 << 7 << 3 << 4 << 5; |
|
67 | *set3 << 5 << 6 << 7 << 3 << 4 << 5; | |
35 | *set4 << 9 << 7 << 5 << 3 << 1 << 2; |
|
68 | *set4 << 9 << 7 << 5 << 3 << 1 << 2; | |
36 |
|
|
69 | //![2] | |
37 |
|
70 | //![3] | ||
38 | //! [3] |
|
71 | QBarSeries* series = new QBarSeries(categories); | |
39 | // Create series and add sets to it |
|
|||
40 | QBarSeries* series= new QBarSeries(categories); |
|
|||
41 |
|
||||
42 | series->addBarSet(set0); |
|
72 | series->addBarSet(set0); | |
43 | series->addBarSet(set1); |
|
73 | series->addBarSet(set1); | |
44 | series->addBarSet(set2); |
|
74 | series->addBarSet(set2); | |
45 | series->addBarSet(set3); |
|
75 | series->addBarSet(set3); | |
46 | series->addBarSet(set4); |
|
76 | series->addBarSet(set4); | |
47 |
|
|
77 | //![3] | |
48 |
|
78 | //![4] | ||
49 | //! [4] |
|
79 | QChart* chart = new QChart(); | |
50 | // Enable tooltip |
|
80 | chart->addSeries(series); | |
51 | series->setToolTipEnabled(); |
|
81 | chart->setTitle("Simple barchart example"); | |
52 |
|
82 | //![4] | ||
53 | // Connect clicked signal of set to toggle floating values of set. |
|
83 | //![5] | |
54 | QObject::connect(set0,SIGNAL(clicked(QString)),set0,SIGNAL(toggleFloatingValues())); |
|
84 | QChartView* chartView = new QChartView(chart); | |
55 | QObject::connect(set1,SIGNAL(clicked(QString)),set1,SIGNAL(toggleFloatingValues())); |
|
85 | chartView->setRenderHint(QPainter::Antialiasing); | |
56 | QObject::connect(set2,SIGNAL(clicked(QString)),set2,SIGNAL(toggleFloatingValues())); |
|
86 | //![5] | |
57 | QObject::connect(set3,SIGNAL(clicked(QString)),set3,SIGNAL(toggleFloatingValues())); |
|
87 | //![6] | |
58 | QObject::connect(set4,SIGNAL(clicked(QString)),set4,SIGNAL(toggleFloatingValues())); |
|
88 | QMainWindow window; | |
59 | //! [4] |
|
|||
60 |
|
||||
61 | //! [5] |
|
|||
62 | // Create view for chart and add series to it. Apply theme. |
|
|||
63 |
|
||||
64 | QChartView* chartView = new QChartView(&window); |
|
|||
65 | chartView->addSeries(series); |
|
|||
66 | chartView->setChartTitle("simple barchart"); |
|
|||
67 | chartView->setChartTheme(QChart::ChartThemeIcy); |
|
|||
68 | //! [5] |
|
|||
69 |
|
||||
70 | //! [6] |
|
|||
71 | chartView->axisX()->setGridLineVisible(false); |
|
|||
72 | //! [6] |
|
|||
73 |
|
||||
74 | window.setCentralWidget(chartView); |
|
89 | window.setCentralWidget(chartView); | |
75 | window.resize(400, 300); |
|
90 | window.resize(400, 300); | |
76 | window.show(); |
|
91 | window.show(); | |
77 |
|
92 | //![6] | ||
78 | return a.exec(); |
|
93 | return a.exec(); | |
79 | } |
|
94 | } | |
80 |
|
@@ -1,55 +1,95 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE:BSD$ | |||
|
10 | ** You may use this file under the terms of the BSD license as follows: | |||
|
11 | ** | |||
|
12 | ** "Redistribution and use in source and binary forms, with or without | |||
|
13 | ** modification, are permitted provided that the following conditions are | |||
|
14 | ** met: | |||
|
15 | ** * Redistributions of source code must retain the above copyright | |||
|
16 | ** notice, this list of conditions and the following disclaimer. | |||
|
17 | ** * Redistributions in binary form must reproduce the above copyright | |||
|
18 | ** notice, this list of conditions and the following disclaimer in | |||
|
19 | ** the documentation and/or other materials provided with the | |||
|
20 | ** distribution. | |||
|
21 | ** * Neither the name of Digia nor the names of its contributors | |||
|
22 | ** may be used to endorse or promote products derived from this | |||
|
23 | ** software without specific prior written permission. | |||
|
24 | ** | |||
|
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
|
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
|
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
|
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
|
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
|
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
|
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
|
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
|
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
|
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
|
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." | |||
|
36 | ** $QT_END_LICENSE$ | |||
|
37 | ** | |||
|
38 | ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). | |||
|
39 | ** | |||
|
40 | ****************************************************************************/ | |||
|
41 | ||||
1 | #include <QApplication> |
|
42 | #include <QApplication> | |
2 | #include <QMainWindow> |
|
43 | #include <QMainWindow> | |
3 |
#include < |
|
44 | #include <QChartView> | |
4 |
#include < |
|
45 | #include <QLineSeries> | |
5 | #include <qchart.h> |
|
|||
6 | #include <cmath> |
|
|||
7 |
|
46 | |||
8 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
47 | QTCOMMERCIALCHART_USE_NAMESPACE | |
9 |
|
48 | |||
10 | #define PI 3.14159265358979 |
|
|||
11 |
|
||||
12 | int main(int argc, char *argv[]) |
|
49 | int main(int argc, char *argv[]) | |
13 | { |
|
50 | { | |
14 | QApplication a(argc, argv); |
|
51 | QApplication a(argc, argv); | |
15 |
|
52 | |||
16 | QMainWindow window; |
|
53 | //![1] | |
17 |
|
54 | QLineSeries* series = new QLineSeries(); | ||
18 | QLineSeries* series0 = new QLineSeries(); |
|
|||
19 | QPen blue(Qt::blue); |
|
55 | QPen blue(Qt::blue); | |
20 | blue.setWidth(3); |
|
56 | blue.setWidth(3); | |
21 |
series |
|
57 | series->setPen(blue); | |
22 | QLineSeries* series1 = new QLineSeries(); |
|
58 | //![1] | |
23 | QPen red(Qt::red); |
|
59 | //![2] | |
24 | red.setWidth(3); |
|
60 | *series << QPointF(0, 6) << QPointF(2, 4) << QPointF(3, 8) << QPointF(7, 4) << QPointF(10,5); | |
25 | series1->setPen(red); |
|
61 | //![2] | |
26 |
|
62 | //![3] | ||
27 | int numPoints = 100; |
|
63 | QChart* chart = new QChart(); | |
28 |
|
64 | chart->addSeries(series); | ||
29 | for (int x = 0; x <= numPoints; ++x) { |
|
65 | chart->setTitle("Custom colors example"); | |
30 | series0->add(x, fabs(sin(PI/50*x)*100)); |
|
66 | //![3] | |
31 | series1->add(x, fabs(cos(PI/50*x)*100)); |
|
67 | //![4] | |
32 | } |
|
|||
33 |
|
||||
34 | QChartView* chartView = new QChartView(&window); |
|
|||
35 | chartView->setRenderHint(QPainter::Antialiasing); |
|
|||
36 |
|
||||
37 | QFont font; |
|
68 | QFont font; | |
38 | font.setPixelSize(18); |
|
69 | font.setPixelSize(18); | |
39 |
chart |
|
70 | chart->setTitleFont(font); | |
40 | chartView->setChartTitle("Custom color line chart example"); |
|
71 | chart->setTitleBrush(Qt::red); | |
41 | chartView->addSeries(series0); |
|
|||
42 | chartView->addSeries(series1); |
|
|||
43 |
|
72 | |||
44 | QLinearGradient backgroundGradient; |
|
73 | QLinearGradient backgroundGradient; | |
45 |
backgroundGradient.setColorAt(0.0, Qt:: |
|
74 | backgroundGradient.setColorAt(0.0, Qt::lightGray); | |
46 |
backgroundGradient.setColorAt(1.0, Qt:: |
|
75 | backgroundGradient.setColorAt(1.0, Qt::white); | |
47 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
76 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
48 |
chart |
|
77 | chart->setBackgroundBrush(backgroundGradient); | |
49 |
|
78 | |||
|
79 | QPen black(Qt::black); | |||
|
80 | chart->axisX()->setGridLinePen(black); | |||
|
81 | chart->axisX()->setAxisPen(black); | |||
|
82 | chart->axisY()->setGridLinePen(black); | |||
|
83 | chart->axisY()->setAxisPen(black); | |||
|
84 | //![4] | |||
|
85 | //![5] | |||
|
86 | QChartView* chartView = new QChartView(chart); | |||
|
87 | chartView->setRenderHint(QPainter::Antialiasing); | |||
|
88 | //![5] | |||
|
89 | QMainWindow window; | |||
50 | window.setCentralWidget(chartView); |
|
90 | window.setCentralWidget(chartView); | |
51 | window.resize(400, 300); |
|
91 | window.resize(400, 300); | |
52 | window.show(); |
|
92 | window.show(); | |
53 |
|
93 | //![5] | ||
54 | return a.exec(); |
|
94 | return a.exec(); | |
55 | } |
|
95 | } |
@@ -1,23 +1,32 | |||||
1 | TEMPLATE = subdirs |
|
1 | TEMPLATE = subdirs | |
2 |
SUBDIRS += |
|
2 | SUBDIRS += \ | |
3 |
|
|
3 | areachart \ | |
4 |
|
|
4 | #axischart \ | |
5 | barchart \ |
|
5 | barchart \ | |
6 |
|
|
6 | #chartview \ | |
|
7 | colorlinechart \ | |||
|
8 | #customcolors \ | |||
|
9 | #dynamiclinechart \ | |||
|
10 | #ekgchart \ | |||
|
11 | #gdpbarchart \ | |||
|
12 | linechart \ | |||
|
13 | #multichart \ | |||
7 | percentbarchart \ |
|
14 | percentbarchart \ | |
8 | scatterchart \ |
|
|||
9 | piechart \ |
|
15 | piechart \ | |
10 | piechartdrilldown \ |
|
16 | #piechartdrilldown \ | |
11 |
|
|
17 | #presenterchart \ | |
12 |
|
|
18 | scatterchart \ | |
13 | multichart \ |
|
19 | #scatterinteractions \ | |
14 |
|
|
20 | #splinechart \ | |
15 |
|
|
21 | stackedbarchart \ | |
16 |
|
|
22 | #stackedbarchartdrilldown \ | |
17 | scatterinteractions \ |
|
23 | #tablemodelchart \ | |
18 |
|
|
24 | zoomlinechart | |
19 |
|
|
25 | ||
20 | stackedbarchartdrilldown \ |
|
26 | ||
21 | customcolors \ |
|
27 | ||
22 | tablemodelchart \ |
|
28 | ||
23 |
|
|
29 | ||
|
30 | ||||
|
31 | ||||
|
32 |
@@ -1,15 +1,54 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE:BSD$ | |||
|
10 | ** You may use this file under the terms of the BSD license as follows: | |||
|
11 | ** | |||
|
12 | ** "Redistribution and use in source and binary forms, with or without | |||
|
13 | ** modification, are permitted provided that the following conditions are | |||
|
14 | ** met: | |||
|
15 | ** * Redistributions of source code must retain the above copyright | |||
|
16 | ** notice, this list of conditions and the following disclaimer. | |||
|
17 | ** * Redistributions in binary form must reproduce the above copyright | |||
|
18 | ** notice, this list of conditions and the following disclaimer in | |||
|
19 | ** the documentation and/or other materials provided with the | |||
|
20 | ** distribution. | |||
|
21 | ** * Neither the name of Digia nor the names of its contributors | |||
|
22 | ** may be used to endorse or promote products derived from this | |||
|
23 | ** software without specific prior written permission. | |||
|
24 | ** | |||
|
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
|
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
|
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
|
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
|
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
|
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
|
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
|
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
|
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
|
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
|
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." | |||
|
36 | ** $QT_END_LICENSE$ | |||
|
37 | ** | |||
|
38 | ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). | |||
|
39 | ** | |||
|
40 | ****************************************************************************/ | |||
|
41 | ||||
1 | #include <QApplication> |
|
42 | #include <QApplication> | |
2 | #include <QMainWindow> |
|
43 | #include <QMainWindow> | |
3 | #include <QChartView> |
|
44 | #include <QChartView> | |
4 | #include <QLineSeries> |
|
45 | #include <QLineSeries> | |
5 | #include <cmath> |
|
|||
6 |
|
46 | |||
7 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
47 | QTCOMMERCIALCHART_USE_NAMESPACE | |
8 |
|
48 | |||
9 | int main(int argc, char *argv[]) |
|
49 | int main(int argc, char *argv[]) | |
10 | { |
|
50 | { | |
11 | QApplication a(argc, argv); |
|
51 | QApplication a(argc, argv); | |
12 |
|
||||
13 | //![1] |
|
52 | //![1] | |
14 | QLineSeries* series0 = new QLineSeries(); |
|
53 | QLineSeries* series0 = new QLineSeries(); | |
15 | QPen blue(Qt::blue); |
|
54 | QPen blue(Qt::blue); | |
@@ -27,25 +66,26 int main(int argc, char *argv[]) | |||||
27 | series0->add(2, 4); |
|
66 | series0->add(2, 4); | |
28 | series0->add(3, 8); |
|
67 | series0->add(3, 8); | |
29 | series0->add(7, 4); |
|
68 | series0->add(7, 4); | |
30 | series0->add(10,5); |
|
69 | series0->add(10, 5); | |
31 |
|
70 | |||
32 | *series1 << QPointF(1, 1) << QPointF(3, 3) << QPointF(7, 6) << QPointF(8, 3) << QPointF(10,2); |
|
71 | *series1 << QPointF(1, 1) << QPointF(3, 3) << QPointF(7, 6) << QPointF(8, 3) << QPointF(10, 2); | |
33 | //![2] |
|
72 | //![2] | |
34 | //![3] |
|
73 | //![3] | |
35 | QMainWindow window; |
|
74 | QChart* chart = new QChart(); | |
36 | QChartView* chartView = new QChartView(&window); |
|
|||
37 |
|
||||
38 | chartView->setChartTitle("Simple line chart"); |
|
|||
39 | chartView->setRenderHint(QPainter::Antialiasing); |
|
|||
40 |
|
75 | |||
41 |
chart |
|
76 | chart->addSeries(series0); | |
42 |
chart |
|
77 | chart->addSeries(series1); | |
|
78 | chart->setTitle("Simple line chart example"); | |||
43 | //![3] |
|
79 | //![3] | |
44 | //![4] |
|
80 | //![4] | |
|
81 | QChartView* chartView = new QChartView(chart); | |||
|
82 | chartView->setRenderHint(QPainter::Antialiasing); | |||
|
83 | //![4] | |||
|
84 | //![5] | |||
|
85 | QMainWindow window; | |||
45 | window.setCentralWidget(chartView); |
|
86 | window.setCentralWidget(chartView); | |
46 | window.resize(400, 300); |
|
87 | window.resize(400, 300); | |
47 | window.show(); |
|
88 | window.show(); | |
48 |
//![ |
|
89 | //![5] | |
49 |
|
||||
50 | return a.exec(); |
|
90 | return a.exec(); | |
51 | } |
|
91 | } |
@@ -1,27 +1,60 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE:BSD$ | |||
|
10 | ** You may use this file under the terms of the BSD license as follows: | |||
|
11 | ** | |||
|
12 | ** "Redistribution and use in source and binary forms, with or without | |||
|
13 | ** modification, are permitted provided that the following conditions are | |||
|
14 | ** met: | |||
|
15 | ** * Redistributions of source code must retain the above copyright | |||
|
16 | ** notice, this list of conditions and the following disclaimer. | |||
|
17 | ** * Redistributions in binary form must reproduce the above copyright | |||
|
18 | ** notice, this list of conditions and the following disclaimer in | |||
|
19 | ** the documentation and/or other materials provided with the | |||
|
20 | ** distribution. | |||
|
21 | ** * Neither the name of Digia nor the names of its contributors | |||
|
22 | ** may be used to endorse or promote products derived from this | |||
|
23 | ** software without specific prior written permission. | |||
|
24 | ** | |||
|
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
|
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
|
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
|
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
|
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
|
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
|
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
|
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
|
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
|
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
|
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." | |||
|
36 | ** $QT_END_LICENSE$ | |||
|
37 | ** | |||
|
38 | ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). | |||
|
39 | ** | |||
|
40 | ****************************************************************************/ | |||
|
41 | ||||
1 | #include <QApplication> |
|
42 | #include <QApplication> | |
2 | #include <QMainWindow> |
|
43 | #include <QMainWindow> | |
3 |
#include <Q |
|
44 | #include <QChartView> | |
4 |
#include < |
|
45 | #include <QPercentBarSeries> | |
5 |
#include < |
|
46 | #include <QBarSet> | |
6 | #include <qbarset.h> |
|
|||
7 | #include <qchartaxis.h> |
|
|||
8 | #include <QStringList> |
|
|||
9 |
|
47 | |||
10 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
48 | QTCOMMERCIALCHART_USE_NAMESPACE | |
11 |
|
49 | |||
12 | int main(int argc, char *argv[]) |
|
50 | int main(int argc, char *argv[]) | |
13 | { |
|
51 | { | |
14 | QApplication a(argc, argv); |
|
52 | QApplication a(argc, argv); | |
15 | QMainWindow window; |
|
53 | //![1] | |
16 |
|
54 | QBarCategories categories; | ||
17 | //! [1] |
|
|||
18 | // Define categories |
|
|||
19 | QStringList categories; |
|
|||
20 | categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; |
|
55 | categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; | |
21 |
|
|
56 | //![1] | |
22 |
|
57 | //![2] | ||
23 | //! [2] |
|
|||
24 | // Create some test sets for chat |
|
|||
25 | QBarSet *set0 = new QBarSet("Bub"); |
|
58 | QBarSet *set0 = new QBarSet("Bub"); | |
26 | QBarSet *set1 = new QBarSet("Bob"); |
|
59 | QBarSet *set1 = new QBarSet("Bob"); | |
27 | QBarSet *set2 = new QBarSet("Guybrush"); |
|
60 | QBarSet *set2 = new QBarSet("Guybrush"); | |
@@ -33,51 +66,30 int main(int argc, char *argv[]) | |||||
33 | *set2 << 3 << 5 << 8 << 13 << 8 << 5; |
|
66 | *set2 << 3 << 5 << 8 << 13 << 8 << 5; | |
34 | *set3 << 5 << 6 << 7 << 3 << 4 << 5; |
|
67 | *set3 << 5 << 6 << 7 << 3 << 4 << 5; | |
35 | *set4 << 9 << 7 << 5 << 3 << 1 << 2; |
|
68 | *set4 << 9 << 7 << 5 << 3 << 1 << 2; | |
36 |
|
|
69 | //![2] | |
37 |
|
70 | //![3] | ||
38 | //! [3] |
|
|||
39 | // Create series and add sets to it |
|
|||
40 | QPercentBarSeries* series = new QPercentBarSeries(categories); |
|
71 | QPercentBarSeries* series = new QPercentBarSeries(categories); | |
41 |
|
||||
42 | series->addBarSet(set0); |
|
72 | series->addBarSet(set0); | |
43 | series->addBarSet(set1); |
|
73 | series->addBarSet(set1); | |
44 | series->addBarSet(set2); |
|
74 | series->addBarSet(set2); | |
45 | series->addBarSet(set3); |
|
75 | series->addBarSet(set3); | |
46 | series->addBarSet(set4); |
|
76 | series->addBarSet(set4); | |
47 |
|
|
77 | //! [3] | |
48 |
|
78 | //![4] | ||
49 | //! [4] |
|
79 | QChart* chart = new QChart(); | |
50 | // Enable tooltip |
|
80 | chart->addSeries(series); | |
51 | series->setToolTipEnabled(); |
|
81 | chart->setTitle("Simple precentbarchart example"); | |
52 |
|
82 | //![4] | ||
53 | // Connect clicked signal of set to toggle floating values of set. |
|
83 | //![5] | |
54 | // Note that we leave QBarset "Zak" unconnected here, so clicking on it doesn't toggle values. |
|
84 | QChartView* chartView = new QChartView(chart); | |
55 | QObject::connect(set0,SIGNAL(clicked(QString)),set0,SIGNAL(toggleFloatingValues())); |
|
85 | chartView->setRenderHint(QPainter::Antialiasing); | |
56 | QObject::connect(set1,SIGNAL(clicked(QString)),set1,SIGNAL(toggleFloatingValues())); |
|
86 | //![5] | |
57 | QObject::connect(set2,SIGNAL(clicked(QString)),set2,SIGNAL(toggleFloatingValues())); |
|
87 | //![6] | |
58 | QObject::connect(set3,SIGNAL(clicked(QString)),set3,SIGNAL(toggleFloatingValues())); |
|
88 | QMainWindow window; | |
59 | QObject::connect(set4,SIGNAL(clicked(QString)),set4,SIGNAL(toggleFloatingValues())); |
|
|||
60 | //! [4] |
|
|||
61 |
|
||||
62 | //! [5] |
|
|||
63 | // Create view for chart and add series to it. Apply theme. |
|
|||
64 |
|
||||
65 | QChartView* chartView = new QChartView(&window); |
|
|||
66 | chartView->addSeries(series); |
|
|||
67 | chartView->setChartTitle("simple percent barchart"); |
|
|||
68 | chartView->setChartTheme(QChart::ChartThemeIcy); |
|
|||
69 | //! [5] |
|
|||
70 |
|
||||
71 | //! [6] |
|
|||
72 | //chartView->axisX()->setAxisVisible(false); |
|
|||
73 | chartView->axisX()->setGridLineVisible(false); |
|
|||
74 | chartView->axisX()->setLabelsVisible(false); |
|
|||
75 | //! [6] |
|
|||
76 |
|
||||
77 | window.setCentralWidget(chartView); |
|
89 | window.setCentralWidget(chartView); | |
78 | window.resize(400, 300); |
|
90 | window.resize(400, 300); | |
79 | window.show(); |
|
91 | window.show(); | |
80 |
|
92 | //![6] | ||
81 | return a.exec(); |
|
93 | return a.exec(); | |
82 | } |
|
94 | } | |
83 |
|
95 |
@@ -3,8 +3,5 | |||||
3 | } |
|
3 | } | |
4 |
|
4 | |||
5 | TARGET = percentbarchart |
|
5 | TARGET = percentbarchart | |
6 |
SOURCES += main.cpp |
|
6 | SOURCES += main.cpp | |
7 | chartwidget.cpp |
|
|||
8 | HEADERS += \ |
|
|||
9 | chartwidget.h |
|
|||
10 |
|
7 |
@@ -1,9 +1,49 | |||||
1 | #include <QtGui/QApplication> |
|
1 | /**************************************************************************** | |
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE:BSD$ | |||
|
10 | ** You may use this file under the terms of the BSD license as follows: | |||
|
11 | ** | |||
|
12 | ** "Redistribution and use in source and binary forms, with or without | |||
|
13 | ** modification, are permitted provided that the following conditions are | |||
|
14 | ** met: | |||
|
15 | ** * Redistributions of source code must retain the above copyright | |||
|
16 | ** notice, this list of conditions and the following disclaimer. | |||
|
17 | ** * Redistributions in binary form must reproduce the above copyright | |||
|
18 | ** notice, this list of conditions and the following disclaimer in | |||
|
19 | ** the documentation and/or other materials provided with the | |||
|
20 | ** distribution. | |||
|
21 | ** * Neither the name of Digia nor the names of its contributors | |||
|
22 | ** may be used to endorse or promote products derived from this | |||
|
23 | ** software without specific prior written permission. | |||
|
24 | ** | |||
|
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
|
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
|
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
|
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
|
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
|
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
|
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
|
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
|
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
|
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
|
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." | |||
|
36 | ** $QT_END_LICENSE$ | |||
|
37 | ** | |||
|
38 | ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). | |||
|
39 | ** | |||
|
40 | ****************************************************************************/ | |||
|
41 | ||||
|
42 | #include <QApplication> | |||
2 | #include <QMainWindow> |
|
43 | #include <QMainWindow> | |
3 |
#include < |
|
44 | #include <QChartView> | |
4 | #include <qchartview.h> |
|
45 | #include <QPieSeries> | |
5 |
#include < |
|
46 | #include <QPieSlice> | |
6 | #include <qpieslice.h> |
|
|||
7 |
|
47 | |||
8 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
48 | QTCOMMERCIALCHART_USE_NAMESPACE | |
9 |
|
49 | |||
@@ -11,34 +51,36 int main(int argc, char *argv[]) | |||||
11 | { |
|
51 | { | |
12 | QApplication a(argc, argv); |
|
52 | QApplication a(argc, argv); | |
13 |
|
53 | |||
14 | QMainWindow window; |
|
54 | //![1] | |
15 |
|
||||
16 | QChartView* chartView = new QChartView(&window); |
|
|||
17 | chartView->setRenderHint(QPainter::Antialiasing); |
|
|||
18 | chartView->setChartTitle("Simple pie chart"); |
|
|||
19 |
|
||||
20 | //! [1] |
|
|||
21 | QPieSeries *series = new QPieSeries(); |
|
55 | QPieSeries *series = new QPieSeries(); | |
22 | series->add(1, "Slice 1"); |
|
56 | series->add(1, "Slice 1"); | |
23 | series->add(2, "Slice 2"); |
|
57 | series->add(2, "Slice 2"); | |
24 | series->add(3, "Slice 3"); |
|
58 | series->add(3, "Slice 3"); | |
25 | series->add(4, "Slice 4"); |
|
59 | series->add(4, "Slice 4"); | |
26 | series->add(5, "Slice 5"); |
|
60 | series->add(5, "Slice 5"); | |
27 |
|
|
61 | //![1] | |
28 |
|
62 | |||
29 |
|
|
63 | //![2] | |
30 | QPieSlice *slice = series->slices().first(); |
|
64 | QPieSlice *slice = series->slices().first(); | |
31 | slice->setExploded(); |
|
65 | slice->setExploded(); | |
32 | slice->setLabelVisible(); |
|
66 | slice->setLabelVisible(); | |
33 | slice->setSlicePen(QPen(Qt::darkGreen, 2)); |
|
67 | slice->setSlicePen(QPen(Qt::darkGreen, 2)); | |
34 | slice->setSliceBrush(Qt::green); |
|
68 | slice->setSliceBrush(Qt::green); | |
35 |
|
|
69 | //![2] | |
36 |
|
70 | //![3] | ||
37 | chartView->addSeries(series); |
|
71 | QChart* chart = new QChart(); | |
38 |
|
72 | chart->addSeries(series); | ||
|
73 | chart->setTitle("Simple piechart example"); | |||
|
74 | //![3] | |||
|
75 | //![4] | |||
|
76 | QChartView* chartView = new QChartView(chart); | |||
|
77 | chartView->setRenderHint(QPainter::Antialiasing); | |||
|
78 | //![4] | |||
|
79 | //![5] | |||
|
80 | QMainWindow window; | |||
39 | window.setCentralWidget(chartView); |
|
81 | window.setCentralWidget(chartView); | |
40 |
window.resize( |
|
82 | window.resize(400, 300); | |
41 | window.show(); |
|
83 | window.show(); | |
42 |
|
84 | //![5] | ||
43 | return a.exec(); |
|
85 | return a.exec(); | |
44 | } |
|
86 | } |
@@ -1,3 +1,44 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE:BSD$ | |||
|
10 | ** You may use this file under the terms of the BSD license as follows: | |||
|
11 | ** | |||
|
12 | ** "Redistribution and use in source and binary forms, with or without | |||
|
13 | ** modification, are permitted provided that the following conditions are | |||
|
14 | ** met: | |||
|
15 | ** * Redistributions of source code must retain the above copyright | |||
|
16 | ** notice, this list of conditions and the following disclaimer. | |||
|
17 | ** * Redistributions in binary form must reproduce the above copyright | |||
|
18 | ** notice, this list of conditions and the following disclaimer in | |||
|
19 | ** the documentation and/or other materials provided with the | |||
|
20 | ** distribution. | |||
|
21 | ** * Neither the name of Digia nor the names of its contributors | |||
|
22 | ** may be used to endorse or promote products derived from this | |||
|
23 | ** software without specific prior written permission. | |||
|
24 | ** | |||
|
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
|
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
|
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
|
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
|
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
|
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
|
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
|
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
|
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
|
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
|
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." | |||
|
36 | ** $QT_END_LICENSE$ | |||
|
37 | ** | |||
|
38 | ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). | |||
|
39 | ** | |||
|
40 | ****************************************************************************/ | |||
|
41 | ||||
1 | #include <QtGui/QApplication> |
|
42 | #include <QtGui/QApplication> | |
2 | #include <QMainWindow> |
|
43 | #include <QMainWindow> | |
3 | #include <QChartView> |
|
44 | #include <QChartView> | |
@@ -8,41 +49,50 QTCOMMERCIALCHART_USE_NAMESPACE | |||||
8 | int main(int argc, char *argv[]) |
|
49 | int main(int argc, char *argv[]) | |
9 | { |
|
50 | { | |
10 | QApplication a(argc, argv); |
|
51 | QApplication a(argc, argv); | |
11 |
|
52 | //![1] | ||
12 | //! [1] |
|
|||
13 | QScatterSeries *scatter = new QScatterSeries(); |
|
|||
14 |
|
||||
15 | QBrush brush(Qt::red); |
|
|||
16 | QPen pen(Qt::black); |
|
53 | QPen pen(Qt::black); | |
17 | pen.setWidth(2); |
|
54 | pen.setWidth(2); | |
|
55 | QBrush blue(Qt::blue); | |||
|
56 | QBrush red(Qt::red); | |||
18 |
|
57 | |||
19 | scatter->setPen(pen); |
|
58 | QScatterSeries *series0 = new QScatterSeries(); | |
20 | scatter->setBrush(brush); |
|
59 | series0->setPen(pen); | |
21 | scatter->setShape(QScatterSeries::MarkerShapeCircle); |
|
60 | series0->setBrush(blue); | |
22 | scatter->setSize(15.0); |
|
61 | series0->setShape(QScatterSeries::MarkerShapeCircle); | |
23 | //! [1] |
|
62 | series0->setSize(15.0); | |
24 |
|
||||
25 | //! [2] |
|
|||
26 | for (qreal i(0.0); i < 20; i += 0.5) { |
|
|||
27 | qreal x = i + (qreal) (rand() % 100) / 100.0; |
|
|||
28 | qreal y = i + (qreal) (rand() % 100) / 100.0; |
|
|||
29 | scatter->add(x, y); |
|
|||
30 | } |
|
|||
31 | *scatter << QPointF(2.0, 5.5) << QPointF(2.2, 5.4); |
|
|||
32 | //! [2] |
|
|||
33 |
|
||||
34 | //! [3] |
|
|||
35 | QMainWindow window; |
|
|||
36 | QChartView *chartView = new QChartView(&window); |
|
|||
37 | chartView->setRenderHint(QPainter::Antialiasing); |
|
|||
38 | chartView->setChartTitle("Simple scatter chart example"); |
|
|||
39 | chartView->addSeries(scatter); |
|
|||
40 | //! [3] |
|
|||
41 |
|
63 | |||
42 | //! [4] |
|
64 | QScatterSeries *series1 = new QScatterSeries(); | |
|
65 | series1->setPen(pen); | |||
|
66 | series1->setBrush(red); | |||
|
67 | series1->setShape(QScatterSeries::MarkerShapeCircle); | |||
|
68 | series1->setSize(15.0); | |||
|
69 | //![1] | |||
|
70 | ||||
|
71 | //![2] | |||
|
72 | series0->add(0, 6); | |||
|
73 | series0->add(2, 4); | |||
|
74 | series0->add(3, 8); | |||
|
75 | series0->add(7, 4); | |||
|
76 | series0->add(10, 5); | |||
|
77 | ||||
|
78 | *series1 << QPointF(1, 1) << QPointF(3, 3) << QPointF(7, 6) << QPointF(8, 3) << QPointF(10, 2); | |||
|
79 | //![2] | |||
|
80 | //![3] | |||
|
81 | QChart* chart = new QChart(); | |||
|
82 | ||||
|
83 | chart->addSeries(series0); | |||
|
84 | chart->addSeries(series1); | |||
|
85 | chart->setTitle("Simple scatterchart example"); | |||
|
86 | //![3] | |||
|
87 | //![4] | |||
|
88 | QChartView* chartView = new QChartView(chart); | |||
|
89 | chartView->setRenderHint(QPainter::Antialiasing); | |||
|
90 | //![4] | |||
|
91 | //![5] | |||
|
92 | QMainWindow window; | |||
43 | window.setCentralWidget(chartView); |
|
93 | window.setCentralWidget(chartView); | |
44 | window.resize(400, 300); |
|
94 | window.resize(400, 300); | |
45 | window.show(); |
|
95 | window.show(); | |
46 |
//! |
|
96 | //![5] | |
47 | return a.exec(); |
|
97 | return a.exec(); | |
48 | } |
|
98 | } |
@@ -1,26 +1,60 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE:BSD$ | |||
|
10 | ** You may use this file under the terms of the BSD license as follows: | |||
|
11 | ** | |||
|
12 | ** "Redistribution and use in source and binary forms, with or without | |||
|
13 | ** modification, are permitted provided that the following conditions are | |||
|
14 | ** met: | |||
|
15 | ** * Redistributions of source code must retain the above copyright | |||
|
16 | ** notice, this list of conditions and the following disclaimer. | |||
|
17 | ** * Redistributions in binary form must reproduce the above copyright | |||
|
18 | ** notice, this list of conditions and the following disclaimer in | |||
|
19 | ** the documentation and/or other materials provided with the | |||
|
20 | ** distribution. | |||
|
21 | ** * Neither the name of Digia nor the names of its contributors | |||
|
22 | ** may be used to endorse or promote products derived from this | |||
|
23 | ** software without specific prior written permission. | |||
|
24 | ** | |||
|
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
|
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
|
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
|
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
|
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
|
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
|
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
|
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
|
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
|
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
|
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." | |||
|
36 | ** $QT_END_LICENSE$ | |||
|
37 | ** | |||
|
38 | ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). | |||
|
39 | ** | |||
|
40 | ****************************************************************************/ | |||
|
41 | ||||
1 | #include <QApplication> |
|
42 | #include <QApplication> | |
2 | #include <QMainWindow> |
|
43 | #include <QMainWindow> | |
3 |
#include < |
|
44 | #include <QChartView> | |
4 |
#include < |
|
45 | #include <QStackedBarSeries> | |
5 |
#include < |
|
46 | #include <QBarSet> | |
6 | #include <qchartaxis.h> |
|
|||
7 | #include <QStringList> |
|
|||
8 |
|
47 | |||
9 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
48 | QTCOMMERCIALCHART_USE_NAMESPACE | |
10 |
|
49 | |||
11 | int main(int argc, char *argv[]) |
|
50 | int main(int argc, char *argv[]) | |
12 | { |
|
51 | { | |
13 | QApplication a(argc, argv); |
|
52 | QApplication a(argc, argv); | |
14 | QMainWindow window; |
|
53 | //![1] | |
15 |
|
54 | QBarCategories categories; | ||
16 | //! [1] |
|
|||
17 | // Define categories |
|
|||
18 | QStringList categories; |
|
|||
19 | categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; |
|
55 | categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; | |
20 |
|
|
56 | //![1] | |
21 |
|
57 | //![2] | ||
22 | //! [2] |
|
|||
23 | // Create some test sets for chat |
|
|||
24 | QBarSet *set0 = new QBarSet("Bub"); |
|
58 | QBarSet *set0 = new QBarSet("Bub"); | |
25 | QBarSet *set1 = new QBarSet("Bob"); |
|
59 | QBarSet *set1 = new QBarSet("Bob"); | |
26 | QBarSet *set2 = new QBarSet("Guybrush"); |
|
60 | QBarSet *set2 = new QBarSet("Guybrush"); | |
@@ -32,48 +66,30 int main(int argc, char *argv[]) | |||||
32 | *set2 << 3 << 5 << 8 << 13 << 8 << 5; |
|
66 | *set2 << 3 << 5 << 8 << 13 << 8 << 5; | |
33 | *set3 << 5 << 6 << 7 << 3 << 4 << 5; |
|
67 | *set3 << 5 << 6 << 7 << 3 << 4 << 5; | |
34 | *set4 << 9 << 7 << 5 << 3 << 1 << 2; |
|
68 | *set4 << 9 << 7 << 5 << 3 << 1 << 2; | |
35 |
|
|
69 | //![2] | |
36 |
|
70 | //![3] | ||
37 | //! [3] |
|
|||
38 | // Create series and add sets to it |
|
|||
39 | QStackedBarSeries* series = new QStackedBarSeries(categories); |
|
71 | QStackedBarSeries* series = new QStackedBarSeries(categories); | |
40 |
|
||||
41 | series->addBarSet(set0); |
|
72 | series->addBarSet(set0); | |
42 | series->addBarSet(set1); |
|
73 | series->addBarSet(set1); | |
43 | series->addBarSet(set2); |
|
74 | series->addBarSet(set2); | |
44 | series->addBarSet(set3); |
|
75 | series->addBarSet(set3); | |
45 | series->addBarSet(set4); |
|
76 | series->addBarSet(set4); | |
46 |
|
|
77 | //![3] | |
47 |
|
78 | //![4] | ||
48 | //! [4] |
|
79 | QChart* chart = new QChart(); | |
49 | // Enable tooltip |
|
80 | chart->addSeries(series); | |
50 | series->setToolTipEnabled(); |
|
81 | chart->setTitle("Simple stackedbarchart example"); | |
51 |
|
82 | //![4] | ||
52 | // Connect clicked signal of set to toggle floating values of set. |
|
83 | //![5] | |
53 | QObject::connect(set0,SIGNAL(clicked(QString)),set0,SIGNAL(toggleFloatingValues())); |
|
84 | QChartView* chartView = new QChartView(chart); | |
54 | QObject::connect(set1,SIGNAL(clicked(QString)),set1,SIGNAL(toggleFloatingValues())); |
|
85 | chartView->setRenderHint(QPainter::Antialiasing); | |
55 | QObject::connect(set2,SIGNAL(clicked(QString)),set2,SIGNAL(toggleFloatingValues())); |
|
86 | //![5] | |
56 | QObject::connect(set3,SIGNAL(clicked(QString)),set3,SIGNAL(toggleFloatingValues())); |
|
87 | //![6] | |
57 | QObject::connect(set4,SIGNAL(clicked(QString)),set4,SIGNAL(toggleFloatingValues())); |
|
88 | QMainWindow window; | |
58 | //! [4] |
|
|||
59 |
|
||||
60 | //! [5] |
|
|||
61 | // Create view for chart and add series to it. Apply theme. |
|
|||
62 |
|
||||
63 | QChartView* chartView = new QChartView(&window); |
|
|||
64 | chartView->addSeries(series); |
|
|||
65 | chartView->setChartTitle("simple stacked barchart"); |
|
|||
66 | chartView->setChartTheme(QChart::ChartThemeIcy); |
|
|||
67 | //! [5] |
|
|||
68 |
|
||||
69 | //! [6] |
|
|||
70 | chartView->axisX()->setGridLineVisible(false); |
|
|||
71 | //! [6] |
|
|||
72 |
|
||||
73 | window.setCentralWidget(chartView); |
|
89 | window.setCentralWidget(chartView); | |
74 | window.resize(400, 300); |
|
90 | window.resize(400, 300); | |
75 | window.show(); |
|
91 | window.show(); | |
76 |
|
92 | //![6] | ||
77 | return a.exec(); |
|
93 | return a.exec(); | |
78 | } |
|
94 | } | |
79 |
|
95 |
@@ -2,8 +2,4 | |||||
2 | error( "Couldn't find the examples.pri file!" ) |
|
2 | error( "Couldn't find the examples.pri file!" ) | |
3 | } |
|
3 | } | |
4 | TARGET = stackedbarchart |
|
4 | TARGET = stackedbarchart | |
5 |
SOURCES += main.cpp |
|
5 | SOURCES += main.cpp No newline at end of file | |
6 | chartwidget.cpp |
|
|||
7 | HEADERS += \ |
|
|||
8 | chartwidget.h |
|
|||
9 |
|
@@ -1,6 +1,6 | |||||
1 | #include "chartwidget.h" |
|
1 | #include "chartwidget.h" | |
2 |
|
2 | |||
3 |
Chart |
|
3 | ChartView::ChartView(QWidget *parent) : | |
4 | QChartView(parent) |
|
4 | QChartView(parent) | |
5 | { |
|
5 | { | |
6 | } |
|
6 | } |
@@ -6,11 +6,11 | |||||
6 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
6 | QTCOMMERCIALCHART_USE_NAMESPACE | |
7 |
|
7 | |||
8 |
|
8 | |||
9 |
class Chart |
|
9 | class ChartView : public QChartView | |
10 | { |
|
10 | { | |
11 | Q_OBJECT |
|
11 | Q_OBJECT | |
12 | public: |
|
12 | public: | |
13 |
explicit Chart |
|
13 | explicit ChartView(QWidget *parent = 0); | |
14 |
|
14 | |||
15 | signals: |
|
15 | signals: | |
16 |
|
16 |
@@ -1,45 +1,87 | |||||
1 | #include "chartwidget.h" |
|
1 | /**************************************************************************** | |
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE:BSD$ | |||
|
10 | ** You may use this file under the terms of the BSD license as follows: | |||
|
11 | ** | |||
|
12 | ** "Redistribution and use in source and binary forms, with or without | |||
|
13 | ** modification, are permitted provided that the following conditions are | |||
|
14 | ** met: | |||
|
15 | ** * Redistributions of source code must retain the above copyright | |||
|
16 | ** notice, this list of conditions and the following disclaimer. | |||
|
17 | ** * Redistributions in binary form must reproduce the above copyright | |||
|
18 | ** notice, this list of conditions and the following disclaimer in | |||
|
19 | ** the documentation and/or other materials provided with the | |||
|
20 | ** distribution. | |||
|
21 | ** * Neither the name of Digia nor the names of its contributors | |||
|
22 | ** may be used to endorse or promote products derived from this | |||
|
23 | ** software without specific prior written permission. | |||
|
24 | ** | |||
|
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
|
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
|
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
|
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
|
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
|
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
|
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
|
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
|
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
|
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
|
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." | |||
|
36 | ** $QT_END_LICENSE$ | |||
|
37 | ** | |||
|
38 | ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). | |||
|
39 | ** | |||
|
40 | ****************************************************************************/ | |||
|
41 | ||||
|
42 | #include "chartview.h" | |||
2 | #include <QApplication> |
|
43 | #include <QApplication> | |
3 | #include <QMainWindow> |
|
44 | #include <QMainWindow> | |
4 | #include <QLineSeries> |
|
45 | #include <QLineSeries> | |
5 | #include <cmath> |
|
|||
6 |
|
46 | |||
7 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
47 | QTCOMMERCIALCHART_USE_NAMESPACE | |
8 |
|
48 | |||
9 | #define PI 3.14159265358979 |
|
|||
10 |
|
||||
11 | int main(int argc, char *argv[]) |
|
49 | int main(int argc, char *argv[]) | |
12 | { |
|
50 | { | |
13 | QApplication a(argc, argv); |
|
51 | QApplication a(argc, argv); | |
14 |
|
52 | |||
15 | QMainWindow window; |
|
53 | //![1] | |
16 |
|
||||
17 | QLineSeries* series0 = new QLineSeries(); |
|
54 | QLineSeries* series0 = new QLineSeries(); | |
18 | QPen blue(Qt::blue); |
|
55 | QPen blue(Qt::blue); | |
19 | blue.setWidth(3); |
|
56 | blue.setWidth(3); | |
20 | series0->setPen(blue); |
|
57 | series0->setPen(blue); | |
|
58 | ||||
21 | QLineSeries* series1 = new QLineSeries(); |
|
59 | QLineSeries* series1 = new QLineSeries(); | |
22 | QPen red(Qt::red); |
|
60 | QPen red(Qt::red); | |
23 | red.setWidth(3); |
|
61 | red.setWidth(3); | |
24 | series1->setPen(red); |
|
62 | series1->setPen(red); | |
|
63 | //![1] | |||
|
64 | //![2] | |||
|
65 | *series0 << QPointF(0, 6) << QPointF(2, 4) << QPointF(3, 8) << QPointF(7, 4) << QPointF(10, 5); | |||
|
66 | *series1 << QPointF(1, 1) << QPointF(3, 3) << QPointF(7, 6) << QPointF(8, 3) << QPointF(10, 2); | |||
|
67 | //![2] | |||
|
68 | //![3] | |||
|
69 | QChart* chart = new QChart(); | |||
25 |
|
70 | |||
26 | int numPoints = 100; |
|
71 | chart->addSeries(series0); | |
27 |
|
72 | chart->addSeries(series1); | ||
28 | for (int x = 0; x <= numPoints; ++x) { |
|
73 | chart->setTitle("Zoom in/out chart example"); | |
29 | series0->add(x, fabs(sin(PI/50*x)*100)); |
|
74 | chart->setAnimationOptions(QChart::AllAnimations); | |
30 | series1->add(x, fabs(cos(PI/50*x)*100)); |
|
75 | //![3] | |
31 | } |
|
76 | //![4] | |
32 |
|
77 | ChartView* chartView = new ChartView(chart); | ||
33 | ChartWidget* chartWidget = new ChartWidget(&window); |
|
78 | chartView->setRenderHint(QPainter::Antialiasing); | |
34 | chartWidget->setRenderHint(QPainter::Antialiasing); |
|
79 | //![4] | |
35 | chartWidget->setChartTitle("Zoom in/out line chart example"); |
|
80 | //![5] | |
36 | chartWidget->setAnimationOptions(QChart::AllAnimations); |
|
81 | QMainWindow window; | |
37 | chartWidget->addSeries(series0); |
|
82 | window.setCentralWidget(chartView); | |
38 | chartWidget->addSeries(series1); |
|
83 | window.resize(400, 300); | |
39 |
|
84 | window.show(); | ||
40 | window.setCentralWidget(chartWidget); |
|
85 | //![5] | |
41 | window.resize(400, 300); |
|
|||
42 | window.show(); |
|
|||
43 |
|
||||
44 | return a.exec(); |
|
86 | return a.exec(); | |
45 | } |
|
87 | } |
@@ -2,8 +2,8 | |||||
2 | error( "Couldn't find the examples.pri file!" ) |
|
2 | error( "Couldn't find the examples.pri file!" ) | |
3 | } |
|
3 | } | |
4 | TARGET = zoomlinechart |
|
4 | TARGET = zoomlinechart | |
5 |
HEADERS += chart |
|
5 | HEADERS += chartview.h | |
6 |
SOURCES += main.cpp chart |
|
6 | SOURCES += main.cpp chartview.cpp | |
7 |
|
7 | |||
8 |
|
8 | |||
9 |
|
9 |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now