@@ -0,0 +1,83 | |||
|
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$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | #include "charts.h" | |
|
22 | #include "qchart.h" | |
|
23 | #include "qlineseries.h" | |
|
24 | #include "qvalueaxis.h" | |
|
25 | #include "qcategoryaxis.h" | |
|
26 | ||
|
27 | class MultiValueAxis2: public Chart | |
|
28 | { | |
|
29 | public: | |
|
30 | QString name() | |
|
31 | { | |
|
32 | return "AxisSet 2"; | |
|
33 | } | |
|
34 | QString category() | |
|
35 | { | |
|
36 | return QObject::tr("Axis"); | |
|
37 | } | |
|
38 | QString subCategory() | |
|
39 | { | |
|
40 | return "MultiValueAxis"; | |
|
41 | } | |
|
42 | ||
|
43 | QChart *createChart(const DataTable &table) | |
|
44 | { | |
|
45 | QChart *chart = new QChart(); | |
|
46 | QValueAxis *axisX; | |
|
47 | QValueAxis *axisY; | |
|
48 | ||
|
49 | chart->setTitle("MultiValueAxis2"); | |
|
50 | ||
|
51 | QString name("Series"); | |
|
52 | int nameIndex = 1; | |
|
53 | foreach (DataList list, table) { | |
|
54 | QLineSeries *series = new QLineSeries(chart); | |
|
55 | foreach (Data data, list) | |
|
56 | series->append(data.first); | |
|
57 | series->setName(name + QString::number(nameIndex)); | |
|
58 | ||
|
59 | chart->addSeries(series); | |
|
60 | axisX = new QValueAxis(); | |
|
61 | axisX->setLinePenColor(series->pen().color()); | |
|
62 | if (nameIndex % 2) | |
|
63 | axisX->setAlignment(Qt::AlignTop); | |
|
64 | else | |
|
65 | axisX->setAlignment(Qt::AlignBottom); | |
|
66 | axisY = new QValueAxis(); | |
|
67 | axisY->setLinePenColor(series->pen().color()); | |
|
68 | ||
|
69 | if (nameIndex % 2) | |
|
70 | axisY->setAlignment(Qt::AlignRight); | |
|
71 | else | |
|
72 | axisY->setAlignment(Qt::AlignLeft); | |
|
73 | ||
|
74 | chart->setAxisX(axisX, series); | |
|
75 | chart->setAxisY(axisY, series); | |
|
76 | nameIndex++; | |
|
77 | } | |
|
78 | ||
|
79 | return chart; | |
|
80 | } | |
|
81 | }; | |
|
82 | ||
|
83 | DECLARE_CHART(MultiValueAxis2); |
@@ -0,0 +1,88 | |||
|
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$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | #include "charts.h" | |
|
22 | #include "qchart.h" | |
|
23 | #include "qlineseries.h" | |
|
24 | #include "qvalueaxis.h" | |
|
25 | #include "qcategoryaxis.h" | |
|
26 | ||
|
27 | class MultiValueAxis3: public Chart | |
|
28 | { | |
|
29 | public: | |
|
30 | QString name() | |
|
31 | { | |
|
32 | return "AxisSet 3"; | |
|
33 | } | |
|
34 | QString category() | |
|
35 | { | |
|
36 | return QObject::tr("Axis"); | |
|
37 | } | |
|
38 | QString subCategory() | |
|
39 | { | |
|
40 | return "MultiValueAxis"; | |
|
41 | } | |
|
42 | ||
|
43 | QChart *createChart(const DataTable &table) | |
|
44 | { | |
|
45 | QChart *chart = new QChart(); | |
|
46 | QValueAxis *axisX; | |
|
47 | QValueAxis *axisY; | |
|
48 | ||
|
49 | chart->setTitle("MultiValueAxis3"); | |
|
50 | ||
|
51 | QString name("Series"); | |
|
52 | int nameIndex = 0; | |
|
53 | foreach (DataList list, table) { | |
|
54 | QLineSeries *series = new QLineSeries(chart); | |
|
55 | foreach (Data data, list) | |
|
56 | series->append(data.first); | |
|
57 | series->setName(name + QString::number(nameIndex)); | |
|
58 | ||
|
59 | chart->addSeries(series); | |
|
60 | axisX = new QValueAxis(); | |
|
61 | axisX->setLinePenColor(series->pen().color()); | |
|
62 | if (nameIndex % 2){ | |
|
63 | axisX->setAlignment(Qt::AlignTop); | |
|
64 | } else{ | |
|
65 | axisX->setAlignment(Qt::AlignBottom); | |
|
66 | } | |
|
67 | axisX->setTitle("ValueAxis for series" + QString::number(nameIndex)); | |
|
68 | ||
|
69 | axisY = new QValueAxis(); | |
|
70 | axisY->setLinePenColor(series->pen().color()); | |
|
71 | ||
|
72 | if (nameIndex % 2){ | |
|
73 | axisY->setAlignment(Qt::AlignRight); | |
|
74 | }else{ | |
|
75 | axisY->setAlignment(Qt::AlignLeft); | |
|
76 | } | |
|
77 | axisY->setTitle("ValueAxis for series" + QString::number(nameIndex)); | |
|
78 | ||
|
79 | chart->setAxisX(axisX, series); | |
|
80 | chart->setAxisY(axisY, series); | |
|
81 | nameIndex++; | |
|
82 | } | |
|
83 | ||
|
84 | return chart; | |
|
85 | } | |
|
86 | }; | |
|
87 | ||
|
88 | DECLARE_CHART(MultiValueAxis3); |
@@ -0,0 +1,85 | |||
|
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$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | #include "charts.h" | |
|
22 | #include "qchart.h" | |
|
23 | #include "qlineseries.h" | |
|
24 | #include "qvalueaxis.h" | |
|
25 | #include "qcategoryaxis.h" | |
|
26 | ||
|
27 | class MultiValueAxis4: public Chart | |
|
28 | { | |
|
29 | public: | |
|
30 | QString name() | |
|
31 | { | |
|
32 | return "AxisSet 4"; | |
|
33 | } | |
|
34 | QString category() | |
|
35 | { | |
|
36 | return QObject::tr("Axis"); | |
|
37 | } | |
|
38 | QString subCategory() | |
|
39 | { | |
|
40 | return "MultiValueAxis"; | |
|
41 | } | |
|
42 | ||
|
43 | QChart *createChart(const DataTable &table) | |
|
44 | { | |
|
45 | QChart *chart = new QChart(); | |
|
46 | QValueAxis *axisX; | |
|
47 | QValueAxis *axisY; | |
|
48 | ||
|
49 | chart->setTitle("MultiValueAxis4"); | |
|
50 | ||
|
51 | QString name("Series"); | |
|
52 | int nameIndex = 1; | |
|
53 | foreach (DataList list, table) { | |
|
54 | QLineSeries *series = new QLineSeries(chart); | |
|
55 | foreach (Data data, list) | |
|
56 | series->append(data.first); | |
|
57 | series->setName(name + QString::number(nameIndex)); | |
|
58 | ||
|
59 | chart->addSeries(series); | |
|
60 | axisX = new QValueAxis(); | |
|
61 | axisX->setLinePenColor(series->pen().color()); | |
|
62 | axisX->setTitle("ValueAxis for series" + QString::number(nameIndex)); | |
|
63 | if (nameIndex % 2) | |
|
64 | axisX->setAlignment(Qt::AlignTop); | |
|
65 | else | |
|
66 | axisX->setAlignment(Qt::AlignBottom); | |
|
67 | axisY = new QValueAxis(); | |
|
68 | axisY->setLinePenColor(series->pen().color()); | |
|
69 | axisY->setTitle("ValueAxis for series" + QString::number(nameIndex)); | |
|
70 | ||
|
71 | if (nameIndex % 2) | |
|
72 | axisY->setAlignment(Qt::AlignRight); | |
|
73 | else | |
|
74 | axisY->setAlignment(Qt::AlignLeft); | |
|
75 | ||
|
76 | chart->setAxisX(axisX, series); | |
|
77 | chart->setAxisY(axisY, series); | |
|
78 | nameIndex++; | |
|
79 | } | |
|
80 | ||
|
81 | return chart; | |
|
82 | } | |
|
83 | }; | |
|
84 | ||
|
85 | DECLARE_CHART(MultiValueAxis4); |
@@ -29,7 +29,7 class MultiValueAxis: public Chart | |||
|
29 | 29 | public: |
|
30 | 30 | QString name() |
|
31 | 31 | { |
|
32 |
return " |
|
|
32 | return "AxisSet 1"; | |
|
33 | 33 | } |
|
34 | 34 | QString category() |
|
35 | 35 | { |
@@ -37,7 +37,7 public: | |||
|
37 | 37 | } |
|
38 | 38 | QString subCategory() |
|
39 | 39 | { |
|
40 |
return |
|
|
40 | return "MultiValueAxis"; | |
|
41 | 41 | } |
|
42 | 42 | |
|
43 | 43 | QChart *createChart(const DataTable &table) |
@@ -46,7 +46,7 public: | |||
|
46 | 46 | QValueAxis *axisX; |
|
47 | 47 | QValueAxis *axisY; |
|
48 | 48 | |
|
49 | chart->setTitle("MultiValueAxis"); | |
|
49 | chart->setTitle("MultiValueAxis1"); | |
|
50 | 50 | |
|
51 | 51 | QString name("Series"); |
|
52 | 52 | int nameIndex = 0; |
General Comments 0
You need to be logged in to leave comments.
Login now