@@ -1,117 +1,118 | |||
|
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 "charts.h" |
|
22 | 22 | #include "qchart.h" |
|
23 | 23 | #include "qlineseries.h" |
|
24 | 24 | |
|
25 | 25 | class FontChart: public Chart |
|
26 | 26 | { |
|
27 | 27 | public: |
|
28 | 28 | FontChart(int fontSize):m_fontSize(fontSize){}; |
|
29 | 29 | QString name() { return QObject::tr("Font") + " " + QString::number(m_fontSize); } |
|
30 | 30 | QString category() { return QObject::tr("Font"); } |
|
31 | 31 | QString subCategory() { return QString::null; } |
|
32 | 32 | |
|
33 | 33 | QChart* createChart(const DataTable& table) { |
|
34 | 34 | |
|
35 | 35 | QChart* chart = new QChart(); |
|
36 | 36 | chart->setTitle("Font size " + QString::number(m_fontSize)); |
|
37 | 37 | |
|
38 | 38 | QString name("Series "); |
|
39 | 39 | int nameIndex = 0; |
|
40 | 40 | foreach (DataList list, table) { |
|
41 | 41 | QLineSeries *series = new QLineSeries(chart); |
|
42 | 42 | foreach (Data data, list) |
|
43 | 43 | series->append(data.first); |
|
44 | 44 | series->setName(name + QString::number(nameIndex)); |
|
45 | 45 | nameIndex++; |
|
46 | 46 | chart->addSeries(series); |
|
47 | 47 | } |
|
48 | 48 | |
|
49 | 49 | chart->createDefaultAxes(); |
|
50 | 50 | QFont font; |
|
51 | 51 | font.setPixelSize(m_fontSize); |
|
52 | 52 | chart->setTitleFont(font); |
|
53 | 53 | chart->axisX()->setLabelsFont(font); |
|
54 | 54 | chart->axisY()->setLabelsFont(font); |
|
55 | 55 | |
|
56 | 56 | return chart; |
|
57 | 57 | } |
|
58 | 58 | |
|
59 | 59 | private: |
|
60 | 60 | int m_fontSize; |
|
61 | 61 | |
|
62 | 62 | }; |
|
63 | 63 | |
|
64 |
class FontChart |
|
|
64 | class FontChart6:public FontChart{ | |
|
65 | 65 | public: |
|
66 |
FontChart |
|
|
66 | FontChart6():FontChart(6){}; | |
|
67 | 67 | }; |
|
68 | 68 | |
|
69 | 69 | class FontChart8:public FontChart{ |
|
70 | 70 | public: |
|
71 | 71 | FontChart8():FontChart(8){}; |
|
72 | 72 | }; |
|
73 | 73 | |
|
74 | 74 | class FontChart10:public FontChart{ |
|
75 | 75 | public: |
|
76 | 76 | FontChart10():FontChart(10){}; |
|
77 | 77 | }; |
|
78 | 78 | |
|
79 |
class FontChart1 |
|
|
79 | class FontChart14:public FontChart{ | |
|
80 | 80 | public: |
|
81 |
FontChart1 |
|
|
81 | FontChart14():FontChart(14){}; | |
|
82 | 82 | }; |
|
83 | 83 | |
|
84 | class FontChart15:public FontChart{ | |
|
85 | public: | |
|
86 | FontChart15():FontChart(15){}; | |
|
87 | }; | |
|
88 | 84 | |
|
89 | 85 | class FontChart18:public FontChart{ |
|
90 | 86 | public: |
|
91 | 87 | FontChart18():FontChart(18){}; |
|
92 | 88 | }; |
|
93 | 89 | |
|
94 | 90 | class FontChart20:public FontChart{ |
|
95 | 91 | public: |
|
96 | 92 | FontChart20():FontChart(20){}; |
|
97 | 93 | }; |
|
98 | 94 | |
|
99 | 95 | class FontChart24:public FontChart{ |
|
100 | 96 | public: |
|
101 | 97 | FontChart24():FontChart(24){}; |
|
102 | 98 | }; |
|
103 | 99 | |
|
104 | 100 | class FontChart28:public FontChart{ |
|
105 | 101 | public: |
|
106 | 102 | FontChart28():FontChart(28){}; |
|
107 | 103 | }; |
|
108 | 104 | |
|
109 | DECLARE_CHART(FontChart5); | |
|
105 | class FontChart32:public FontChart{ | |
|
106 | public: | |
|
107 | FontChart32():FontChart(32){}; | |
|
108 | }; | |
|
109 | ||
|
110 | DECLARE_CHART(FontChart6); | |
|
110 | 111 | DECLARE_CHART(FontChart8); |
|
111 | 112 | DECLARE_CHART(FontChart10); |
|
112 |
DECLARE_CHART(FontChart1 |
|
|
113 | DECLARE_CHART(FontChart15); | |
|
113 | DECLARE_CHART(FontChart14); | |
|
114 | 114 | DECLARE_CHART(FontChart18); |
|
115 | 115 | DECLARE_CHART(FontChart20); |
|
116 | 116 | DECLARE_CHART(FontChart24); |
|
117 | 117 | DECLARE_CHART(FontChart28); |
|
118 | DECLARE_CHART(FontChart32); |
General Comments 0
You need to be logged in to leave comments.
Login now