@@ -1,70 +1,61 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #include <QApplication> |
|
22 | 22 | #include <QMainWindow> |
|
23 | 23 | #include <QChartView> |
|
24 | 24 | #include <QLineSeries> |
|
25 | 25 | |
|
26 | 26 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
27 | 27 | |
|
28 | 28 | int main(int argc, char *argv[]) |
|
29 | 29 | { |
|
30 | 30 | QApplication a(argc, argv); |
|
31 | 31 | //![1] |
|
32 |
QLineSeries* series |
|
|
33 | QPen blue(Qt::blue); | |
|
34 | blue.setWidth(3); | |
|
35 | series0->setPen(blue); | |
|
36 | ||
|
37 | QLineSeries* series1 = new QLineSeries(); | |
|
32 | QLineSeries* series = new QLineSeries(); | |
|
38 | 33 | QPen red(Qt::red); |
|
39 | 34 | red.setWidth(3); |
|
40 |
series |
|
|
35 | series->setPen(red); | |
|
41 | 36 | //![1] |
|
42 | ||
|
43 | 37 | //![2] |
|
44 |
series |
|
|
45 |
series |
|
|
46 |
series |
|
|
47 |
series |
|
|
48 |
series |
|
|
49 | ||
|
50 | *series1 << QPointF(1, 1) << QPointF(3, 3) << QPointF(7, 6) << QPointF(8, 3) << QPointF(10, 2); | |
|
38 | series->append(0, 6); | |
|
39 | series->append(2, 4); | |
|
40 | series->append(3, 8); | |
|
41 | series->append(7, 4); | |
|
42 | series->append(10, 5); | |
|
43 | *series << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2); | |
|
51 | 44 | //![2] |
|
52 | 45 | //![3] |
|
53 | 46 | QChart* chart = new QChart(); |
|
54 | ||
|
55 | chart->addSeries(series0); | |
|
56 | chart->addSeries(series1); | |
|
47 | chart->addSeries(series); | |
|
57 | 48 | chart->setTitle("Simple line chart example"); |
|
58 | 49 | //![3] |
|
59 | 50 | //![4] |
|
60 | 51 | QChartView* chartView = new QChartView(chart); |
|
61 | 52 | chartView->setRenderHint(QPainter::Antialiasing); |
|
62 | 53 | //![4] |
|
63 | 54 | //![5] |
|
64 | 55 | QMainWindow window; |
|
65 | 56 | window.setCentralWidget(chartView); |
|
66 | 57 | window.resize(400, 300); |
|
67 | 58 | window.show(); |
|
68 | 59 | //![5] |
|
69 | 60 | return a.exec(); |
|
70 | 61 | } |
General Comments 0
You need to be logged in to leave comments.
Login now