##// END OF EJS Templates
Marek Rosa -
r337:1f21d3bffe32 merge
parent child
Show More
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,51
1 /*!
2 \page classes.html
3 \title QtCommercial Charts API
4 \keyword All Classes
5
6 \raw HTML
7 <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
8 <tr>
9 <th class="titleheader" width="33%">
10 List of classes
11 </th>
12 </tr>
13 <tr>
14 <td valign="top">
15 <ul>
16 <li><a href="qbarcategory.html">QBarCategory</a></li>
17 <li><a href="qbarchartseries.html">QBarChartSeries</a></li>
18 <li><a href="qbarset.html">QBarSet</a></li>
19 <li><a href="qchart.html">QChart</a></li>
20 <li><a href="qchartaxis.html">QChartAxis</a></li>
21 <li><a href="qchartseries.html">QChartSeries</a></li>
22 <li><a href="qchartview.html">QChartView</a></li>
23 <li><a href="qlinechartseries.html">QLineChartSeries</a></li>
24 <li><a href="qpercentbarchartseries.html">QPercentBarChartSeries</a></li>
25 <li><a href="qpieseries.html">QPieSeries</a></li>
26 <li><a href="qpieslice.html">QPieSlice</a></li>
27 <li><a href="qscatterseries.html">QScatterSeries</a></li>
28 <li><a href="qstackedbarchartseries.html">QStackedBarChartSeries</a></li>
29 </ul>
30 </td>
31 </tr>
32 </table>
33
34 <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
35 <tr>
36 <th class="titleheader" width="33%">
37 Other files:
38 </th>
39 </tr>
40 <tr>
41 <td valign="top">
42 <ul>
43 <li><a href="qchartglobal.html">QChartGlobal</a></li>
44 </ul>
45 </td>
46 </tr>
47 </table>
48
49 \endraw
50
51 */
@@ -0,0 +1,9
1 /*!
2 \example example/barchart
3 \title LineChart Example
4 \subtitle
5
6 The example shows how to create simple bar chart.
7
8 ...
9 */ No newline at end of file
@@ -0,0 +1,9
1 /*!
2 \example example/linechart
3 \title LineChart Example
4 \subtitle
5
6 The example shows how to create simple line chart.
7
8 ...
9 */ No newline at end of file
@@ -0,0 +1,9
1 /*!
2 \example example/piechart
3 \title LineChart Example
4 \subtitle
5
6 The example shows how to create simple pie chart.
7
8 ...
9 */ No newline at end of file
@@ -0,0 +1,24
1 /*!
2 \page examples.html
3 \title Examples
4 \keyword Examples
5
6 \raw HTML
7 <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
8 <tr>
9 <th class="titleheader" width="33%">
10 List of examples
11 </th>
12 </tr>
13 <tr>
14 <td valign="top">
15 <ul>
16 <li><a href="example-barchart.html">Bar Chart example</a></li>
17 <li><a href="example-linechart.html">Line Chart example</a></li>
18 <li><a href="example-piechart.html">Pie Chart example</a></li>
19 </ul>
20 </td>
21 </tr>
22 </table>
23 \endraw
24 */
@@ -0,0 +1,26
1 /*!
2 \page tutorials.html
3 \title Tutorials
4 \keyword Tutorials
5
6 For example, to create a chart with line series using a widget based application:
7 \snippet ../example/chartview/main.cpp 1
8 \image chartview_example.jpg
9
10 To replace the line series with a pie series you use the dedicated QPieSeries class:
11 \snippet ../example/chartview/main.cpp 3
12 \image chartview_example_pie.jpg
13
14 To use a scatter series you use QScatterSeries class:
15 \snippet ../example/chartview/main.cpp 4
16 \image chartview_example_scatter.jpg
17
18 And to show a bar series you use one of the bar series classes, for example QBarChartSeries:
19 \snippet ../example/chartview/main.cpp 5
20 \image chartview_example_bar.jpg
21
22 If you need to give a more professional touch to your chart you can switch from the default
23 theme to one of the other themes:
24 \snippet ../example/chartview/main.cpp 2
25 \image chartview_example_theme.jpg
26 */
1 NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
@@ -1,49 +1,57
1 include(qt-html-default-styles.qdocconf)
1 include(qchart-html.qdocconf)
2 2
3 3 HTML.postheader = \
4 4 "<div class=\"header\" id=\"qtdocheader\">\n" \
5 5 " <div class=\"content\"> \n" \
6 " <a href=\"index.html\" class=\"qtref\"><span>QChart Reference Documentation</span></a>\n" \
6 " <img src=\"images/qcharts.png\" alt=\"qcharts\"/>\n" \
7 " <p class=\"qtref\"> \n" \
8 " <span>Reference Documentation</span>\n" \
9 " </p>\n" \
7 10 " </div>\n" \
8 11 " <div class=\"breadcrumb toolblock\">\n" \
9 12 " <ul>\n" \
10 " <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \
13 " <li class=\"first\"><a href=\"index.html\">About</a></li>\n" \
14 " <li><a href=\"classes.html\">API Classes</a></li>\n" \
15 " <li><a href=\"tutorials.html\">Tutorials</a></li>\n" \
16 " <li><a href=\"examples.html\">Examples</a></li>\n" \
11 17 " <!-- Breadcrumbs go here -->\n"
12 18
13 19 HTML.postpostheader = \
14 20 " </ul>\n" \
15 21 " </div>\n" \
16 22 "</div>\n" \
17 23 "<div class=\"content mainContent\">\n"
18 24
19 25 HTML.footer = \
20 26 " <div class=\"ft\">\n" \
21 27 " <span></span>\n" \
22 28 " </div>\n" \
23 29 "</div> \n" \
24 30 "<div class=\"footer\">\n" \
25 31 " <p>\n" \
26 32 " <acronym title=\"Copyright\">&copy;</acronym> 2012 Digia ." \
27 33 " Qt and Qt logos are trademarks of of Nokia Corporation \n" \
28 34 " in Finland and/or other countries worldwide.</p>\n" \
29 35 " <p>\n" \
30 36 " All other trademarks are property of their respective owners.</p>\n" \
31 37 " <br />\n" \
32 38 " <p>\n" \
33 39 " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \
34 40 " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \
35 41 " with the terms contained in a written agreement between you and Digia.</p>\n" \
42 " <p>\n" \
43 " <img src=\"images/digia_logo.png\" alt=\"digia\" /></p>\n" \
36 44 "</div>\n" \
37 45
38 46 # Files not referenced in any qdoc file.
39 47 # See also extraimages.HTML
40 48 qhp.QDoc.extraFiles = index.html \
41 49 images/arrow_down.png \
42 50 images/breadcrumb.png \
43 51 images/bullet_gt.png \
44 52 images/bullet_dn.png \
45 53 images/bullet_sq.png \
46 54 images/bullet_up.png \
47 55 images/horBar.png \
48 images/sprites-combined.png \
56 images/qcharts.png \
49 57 style/offline.css
@@ -1,34 +1,41
1 1 # Define the location of the templates to use. Style sheets and scripts are
2 2 # specified relative to the template directory and will be copied into
3 3 # subdirectories of the output directory.
4 4
5 5 HTML.templatedir = .
6 6
7 7 HTML.stylesheets = style/offline.css
8 8
9 9 HTML.scripts =
10 10
11 11 # Files not referenced in any qdoc file, many needed by style sheets.
12 12 # These also need to be listed in qhp.Qt.extraFiles with the correct
13 13 # directory prefixes.
14 14
15 extraimages.HTML = qt-logo.png \
15 extraimages.HTML = qt_commercial_logo.png \
16 digia_logo.png \
17 qcharts.png \
16 18 arrow_down.png \
17 19 breadcrumb.png \
18 20 bullet_gt.png \
19 21 bullet_dn.png \
20 22 bullet_sq.png \
21 23 bullet_up.png \
22 24 horBar.png \
23 sprites-combined.png
25 bg.png
26
27
28
24 29
25 30 # Include the style sheets and scripts used.
26 31
27 32 HTML.headerstyles = \
28 33 " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/offline.css\" />\n"
29 34
30 35 HTML.headerscripts =
31 36
32 37 HTML.endheader = \
33 38 "</head>\n" \
34 39 "<body>\n"
40
41 HTML.nobreadcrumbs = true No newline at end of file
@@ -1,48 +1,46
1 1 include(compat.qdocconf)
2 2 include(macros.qdocconf)
3 include(qt-html-templates.qdocconf)
3 include(qchart-html-template.qdocconf)
4 4
5 5 project = QtCommercialCharts
6 6 description = Library for creating charts
7 7
8 8 sourcedirs = ../src \
9 9 ../example \
10 10 ./src
11 11 headerdirs = ../src \
12 12 ../example
13 exampledirs = ../src \
14 ../example
15
16 HTML.templatedir = .
17 HTML.stylesheets = style/offline.css
18 HTML.headerstyles= "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/offline.css\" />\n"
19 HTML.nobreadcrumbs = true
13 exampledirs = ../ \
14 ../src \
15 ../example
16
17 excludefiles += ../example/linechart/linechart.pro
20 18
21 19 sources.fileextensions = *.cpp *.qdoc *.mm *.qml
22 20 headers.fileextensions = *.h *.ch *.h++ *.hh *.hpp *.hxx
23 21 examples.fileextensions = *.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml
24 22 examples.imageextensions = *.png *.jpeg *.jpg *.gif *.mng
25 23
26 24 imagedirs = ./images
27 25 outputdir = ./html
28 26
29 27
30 28 Cpp.ignoretokens = QTCOMMERCIALCHART_EXPORT \
31 29 QTCOMMERCIALCHART_END_NAMESPACE \
32 30 QTCOMMERCIALCHART_BEGIN_NAMESPACE
33 31 Cpp.ignoredirectives = Q_DECLARE_HANDLE \
34 32 Q_DECLARE_INTERFACE \
35 33 Q_DECLARE_METATYPE \
36 34 Q_DECLARE_OPERATORS_FOR_FLAGS \
37 35 Q_DECLARE_PRIVATE \
38 36 Q_DECLARE_PUBLIC \
39 37 Q_DECLARE_SHARED \
40 38 Q_DECLARE_TR_FUNCTIONS \
41 39 Q_DECLARE_TYPEINFO \
42 40 Q_DISABLE_COPY \
43 41 QT_FORWARD_DECLARE_CLASS \
44 42 Q_DUMMY_COMPARISON_OPERATOR \
45 43 Q_ENUMS \
46 44 Q_FLAGS \
47 45 Q_INTERFACES \
48 46 __attribute__ No newline at end of file
@@ -1,51 +1,29
1 1 /*!
2 2 \page index.html
3 \title QtCommercial Charts
4 \keyword All Classes
3 \keyword About
5 4
6 TODO: restructure the document
7
8 QtCommercial Charts introduction...
9 For example, to create a chart with line series using a widget based application:
10 \snippet ../example/chartview/main.cpp 1
11 \image chartview_example.jpg
12
13 Showing a few more series:
14 \snippet ../example/chartview/main.cpp 3
15 \image chartview_example_pie.jpg
16 \snippet ../example/chartview/main.cpp 4
17 \image chartview_example_scatter.jpg
18 \snippet ../example/chartview/main.cpp 5
19 \image chartview_example_bar.jpg
20
21 If you need to give a more professional touch to your chart you can switch to one of the
22 pre-defined themes:
23 \snippet ../example/chartview/main.cpp 2
24 \image chartview_example_theme.jpg
25
26 \raw HTML
27 <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
28 <tr>
29 <th class="titleheader" width="33%">
30 List of classes
31 </th>
32 </tr>
33 <tr>
34 <td valign="top">
35 <ul>
36 <li><a href="qchart.html">QChart</a></li>
37 <li><a href="qchartview.html">QChartView</a></li>
38 <li><a href="qchartseries.html">QChartSeries</a></li>
39 <li><a href="qlinechartseries.html">QLineChartSeries</a></li>
40 <li><a href="qpieseries.html">QPieSeries</a></li>
41 <li><a href="qbarchartseries.html">QBarChartSeries</a></li>
42 <li><a href="qstackedbarchartseries.html">QStackedBarChartSeries</a></li>
43 <li><a href="qpercentbarchartseries.html">QPercentBarChartSeries</a></li>
44 <li><a href="qscatterseries.html">QScatterSeries</a></li>
45 </ul>
46 </td>
47 </tr>
48 </table>
49 \endraw
5 \raw HTML
6 <div class="qchart">
7 <img src="images/qt_commercial_logo.png" alt="qtcommercial"/>
50 8
9 <p>
10 QCharts is a part of Qt Commercial addons package. It provides a set of simple chart components which are available for Qt Commercial customers.
11 It uses Qt Graphics View Framework, therefore charts can be easily integrated 2D modern user interfaces. QCharts can be used as QWidgets, QGraphicsWidget or QML elements.
12 Users can easily create impressive graphs by selecting one of the charts themes.
13 </p>
14 <table><tr>
15 <td><img src="images/linechart.png" alt="linechart" /></td>
16 <td><img src="images/chartview_example_bar.jpg " alt="barchart" /></td>
17 <td><img src="images/chartview_example_pie.jpg " alt="piechart" /></td>
18 </tr>
19 <tr>
20 <td><img src="images/chartview_example.jpg " alt="linechart" /></td>
21 <td><img src="images/chartview_example_scatter.jpg " alt="scatterchart" /></td>
22 <td><img src="images/chartview_example_theme.jpg " alt="themechart" /></td>
23 </tr>
24 </table>
25 </div>
26 \endraw
27
28
51 29 */
@@ -1,673 +1,708
1 1 @media screen
2 2 {
3 3
4 .qchart
5 {
6 width: 80%;
7 margin-left: auto;
8 margin-right: auto;
9 margin-top: 50px;
10 }
11
12 .qchart img
13 {
14 float:left;
15 }
16
17 .qchart table
18 {
19 margin-top: 50px;
20 }
21
4 22 /* basic elements */
5 23 html
6 24 {
7 25 color: #000000;
8 26 background: #FFFFFF;
9 27 }
10 28 table
11 29 {
12 30 border-collapse: collapse;
13 31 border-spacing: 0;
14 32 }
15 33 fieldset, img
16 34 {
17 35 border: 0;
18 36 max-width:100%;
19 37 }
20 38 address, caption, cite, code, dfn, em, strong, th, var, optgroup
21 39 {
22 40 font-style: inherit;
23 41 font-weight: inherit;
24 42 }
25 43 del, ins
26 44 {
27 45 text-decoration: none;
28 46 }
29 47 li
30 48 {
31 49 list-style: none;
32 50 }
33 51 ol li
34 52 {
35 53 list-style: decimal;
36 54 }
37 55 caption, th
38 56 {
39 57 text-align: left;
40 58 }
41 59 h1, h2, h3, h4, h5, h6
42 60 {
43 61 font-size: 100%;
44 62 }
45 63 q:before, q:after
46 64 {
47 65 content: '';
48 66 }
49 67 abbr, acronym
50 68 {
51 69 border: 0;
52 70 font-variant: normal;
53 71 }
54 72 sup, sub
55 73 {
56 74 vertical-align: baseline;
57 75 }
58 76 tt, .qmlreadonly span, .qmldefault span
59 77 {
60 78 word-spacing:0.5em;
61 79 }
62 80 legend
63 81 {
64 82 color: #000000;
65 83 }
66 84 strong
67 85 {
68 86 font-weight: bold;
69 87 }
70 88 em
71 89 {
72 90 font-style: italic;
73 91 }
74 92
75 93 body
76 94 {
77 95 margin-left: 0.5em;
78 96 margin-right: 0.5em;
79 97 }
80 98 a
81 99 {
82 100 color: #00732F;
83 101 text-decoration: none;
84 102 }
85 103 hr
86 104 {
87 105 background-color: #E6E6E6;
88 106 border: 1px solid #E6E6E6;
89 107 height: 1px;
90 108 width: 100%;
91 109 text-align: left;
92 110 margin: 1.5em 0 1.5em 0;
93 111 }
94 112
95 113 pre
96 114 {
97 115 border: 1px solid #DDDDDD;
98 116 -moz-border-radius: 0.7em 0.7em 0.7em 0.7em;
99 117 -webkit-border-radius: 0.7em 0.7em 0.7em 0.7em;
100 118 border-radius: 0.7em 0.7em 0.7em 0.7em;
101 119 margin: 0 1.5em 1em 1em;
102 120 padding: 1em 1em 1em 1em;
103 121 overflow-x: auto;
104 122 }
105 123 table, pre
106 124 {
107 125 -moz-border-radius: 0.7em 0.7em 0.7em 0.7em;
108 126 -webkit-border-radius: 0.7em 0.7em 0.7em 0.7em;
109 127 border-radius: 0.7em 0.7em 0.7em 0.7em;
110 128 background-color: #F6F6F6;
111 129 border: 1px solid #E6E6E6;
112 130 border-collapse: separate;
113 131 margin-bottom: 2.5em;
114 132 }
115 133 pre {
116 134 font-size: 90%;
117 135 display: block;
118 136 overflow:hidden;
119 137 }
120 138 thead
121 139 {
122 140 margin-top: 0.5em;
123 141 font-weight: bold
124 142 }
125 143 th
126 144 {
127 145 padding: 0.5em 1.5em 0.5em 1.5em;
128 146 background-color: #E1E1E1;
129 147 border-left: 1px solid #E6E6E6;
130 148 }
131 149 td
132 150 {
133 151 padding: 0.25em 1.5em 0.25em 2em;
134 152 }
135 153
136 154 td.rightAlign
137 155 {
138 156 padding: 0.25em 0.5em 0.25em 1em;
139 157 }
140 158 table tr.odd
141 159 {
142 160 border-left: 1px solid #E6E6E6;
143 161 background-color: #F6F6F6;
144 162 color: #66666E;
145 163 }
146 164 table tr.even
147 165 {
148 166 border-left: 1px solid #E6E6E6;
149 167 background-color: #ffffff;
150 168 color: #66666E;
151 169 }
152 170
153 171 div.float-left
154 172 {
155 173 float: left; margin-right: 2em
156 174 }
157 175 div.float-right
158 176 {
159 177 float: right; margin-left: 2em
160 178 }
161 179
162 180 span.comment
163 181 {
164 182 color: #008B00;
165 183 font-style: italic
166 184 }
167 185 span.string, span.char
168 186 {
169 187 color: #000084;
170 188 }
171 189 span.number
172 190 {
173 191 color: #a46200;
174 192 }
175 193 span.operator
176 194 {
177 195 color: #202020;
178 196 }
179 197 span.keyword
180 198 {
181 199 color: #840000;
182 200 }
183 201 span.name
184 202 {
185 203 color: black
186 204 }
187 205 span.type
188 206 {
189 207 font-weight: bold
190 208 }
191 209 span.type a:visited
192 210 {
193 211 color: #0F5300;
194 212 }
195 213 span.preprocessor
196 214 {
197 215 color: #404040
198 216 }
199 217 /* end basic elements */
200 218
201 219 /* font style elements */
202 220 .heading
203 221 {
204 222 font-weight: bold;
205 223 font-size: 125%;
206 224 }
207 225 .subtitle
208 226 {
209 227 font-size: 110%
210 228 }
211 229 .small-subtitle
212 230 {
213 231 font-size: 100%
214 232 }
215 233 .red
216 234 {
217 235 color:red;
218 236 }
219 237 /* end font style elements */
220 238
221 239 /* global settings*/
222 240 .header, .footer
223 241 {
224 242 display: block;
225 243 clear: both;
226 244 overflow: hidden;
227 245 }
228 246 /* end global settings*/
229 247
230 248 /* header elements */
231 249 .header .qtref
232 250 {
233 251 color: #00732F;
234 252 font-weight: bold;
235 font-size: 130%;
253 font-size: 100%;
254 text-align: center;
236 255 }
237 256
238 257 .header .content
239 258 {
240 margin-bottom: 0.5em
259 /* margin-bottom: 0.5em*/
241 260 }
242 261
262 .header .content img
263 {
264 display: block;
265 margin-left: auto;
266 margin-right: auto;
267 width: 100px;
268 }
269
243 270 .naviNextPrevious
244 271 {
245 272 display: none
246 273 }
247 274 .header .breadcrumb
248 275 {
249 font-size: 90%;
276 font-size: 100%;
250 277 padding: 0.5em 0 0.5em 1em;
251 278 margin: 0;
252 background-color: #fafafa;
253 height: 1.35em;
279 /*background-color: #393735;*/
280 font-weight: bold;
281 background: #ffffff url(../images/bg.png) repeat-x;
282 height: 20px;
254 283 border-bottom: 1px solid #d1d1d1;
255 284 }
256 285
257 286 .header .breadcrumb ul
258 287 {
259 288 margin: 0;
260 289 padding: 0;
261 290 }
262 291
263 292 .header .content
264 293 {
265 294 word-wrap: break-word;
266 295 }
267 296
268 297 .header .breadcrumb ul li
269 298 {
270 299 float: left;
271 background: url(../images/breadcrumb.png) no-repeat 0 3px;
300 /*background: url(../images/breadcrumb.png) no-repeat 0 3px;*/
272 301 padding-left: 1.5em;
273 302 margin-left: 1.5em;
274 303 }
275 304
276 305 .header .breadcrumb ul li.last
277 306 {
278 307 font-weight: normal;
279 308 }
280 309
281 310 .header .breadcrumb ul li a
282 311 {
283 color: #00732F;
312 color: #ffffff;
284 313 }
285 314
315 .header .breadcrumb ul li a:hover
316 {
317 color: #00732F;
318 text-decoration: none;
319 }
320
286 321 .header .breadcrumb ul li.first
287 322 {
288 323 background-image: none;
289 324 padding-left: 0;
290 325 margin-left: 0;
291 326 }
292 327
293 328 .header .content ol li {
294 329 background: none;
295 330 margin-bottom: 1.0em;
296 331 margin-left: 1.2em;
297 332 padding-left: 0
298 333 }
299 334
300 335 .header .content li
301 336 {
302 337 background: url(../images/bullet_sq.png) no-repeat 0 5px;
303 338 margin-bottom: 1em;
304 339 padding-left: 1.2em;
305 340 }
306 341
307 342 /* end header elements */
308 343
309 344 /* content elements */
310 345 .content h1
311 346 {
312 347 font-weight: bold;
313 348 font-size: 150%
314 349 }
315 350
316 351 .content h2
317 352 {
318 353 font-weight: bold;
319 354 font-size: 135%;
320 355 width: 100%;
321 356 }
322 357 .content h3
323 358 {
324 359 font-weight: bold;
325 360 font-size: 120%;
326 361 width: 100%;
327 362 }
328 363 .content table p
329 364 {
330 365 margin: 0
331 366 }
332 367 .content ul
333 368 {
334 369 padding-left: 2.5em;
335 370 }
336 371 .content li
337 372 {
338 373 padding-top: 0.25em;
339 374 padding-bottom: 0.25em;
340 375 }
341 376 .content ul img {
342 377 vertical-align: middle;
343 378 }
344 379
345 380 .content a:visited
346 381 {
347 382 color: #4c0033;
348 383 text-decoration: none;
349 384 }
350 385
351 386 .content a:visited:hover
352 387 {
353 388 color: #4c0033;
354 389 text-decoration: underline;
355 390 }
356 391
357 392 a:hover
358 393 {
359 394 color: #4c0033;
360 395 text-decoration: underline;
361 396 }
362 397 descr p a
363 398 {
364 399 text-decoration: underline;
365 400 }
366 401
367 402 .descr p a:visited
368 403 {
369 404 text-decoration: underline;
370 405 }
371 406
372 407 .alphaChar{
373 408 width:95%;
374 409 background-color:#F6F6F6;
375 410 border:1px solid #E6E6E6;
376 411 -moz-border-radius: 7px 7px 7px 7px;
377 412 border-radius: 7px 7px 7px 7px;
378 413 -webkit-border-radius: 7px 7px 7px 7px;
379 414 font-size:12pt;
380 415 padding-left:10px;
381 416 margin-top:10px;
382 417 margin-bottom:10px;
383 418 }
384 419 .flowList{
385 420 /*vertical-align:top;*/
386 421 /*margin:20px auto;*/
387 422
388 423 column-count:3;
389 424 -webkit-column-count:3;
390 425 -moz-column-count:3;
391 426 /*
392 427 column-width:100%;
393 428 -webkit-column-width:200px;
394 429 -col-column-width:200px;
395 430 */
396 431 column-gap:41px;
397 432 -webkit-column-gap:41px;
398 433 -moz-column-gap:41px;
399 434
400 435 column-rule: 1px dashed #ccc;
401 436 -webkit-column-rule: 1px dashed #ccc;
402 437 -moz-column-rule: 1px dashed #ccc;
403 438 }
404 439
405 440 .flowList dl{
406 441 }
407 442 .flowList dd{
408 443 /*display:inline-block;*/
409 444 margin-left:10px;
410 445 min-width:250px;
411 446 line-height: 1.5;
412 447 min-width:100%;
413 448 min-height:15px;
414 449 }
415 450
416 451 .flowList dd a{
417 452 }
418 453
419 454 .content .flowList p{
420 455 padding:0px;
421 456 }
422 457
423 458 .content .alignedsummary
424 459 {
425 460 margin: 15px;
426 461 }
427 462
428 463
429 464 .qmltype
430 465 {
431 466 text-align: center;
432 467 font-size: 120%;
433 468 }
434 469 .qmlreadonly
435 470 {
436 471 padding-left: 5px;
437 472 float: right;
438 473 color: #254117;
439 474 }
440 475
441 476 .qmldefault
442 477 {
443 478 padding-left: 5px;
444 479 float: right;
445 480 color: red;
446 481 }
447 482
448 483 .qmldoc
449 484 {
450 485 }
451 486
452 487 .generic .alphaChar{
453 488 margin-top:5px;
454 489 }
455 490
456 491 .generic .odd .alphaChar{
457 492 background-color: #F6F6F6;
458 493 }
459 494
460 495 .generic .even .alphaChar{
461 496 background-color: #FFFFFF;
462 497 }
463 498
464 499 .memItemRight{
465 500 padding: 0.25em 1.5em 0.25em 0;
466 501 }
467 502 .highlightedCode
468 503 {
469 504 margin: 1.0em;
470 505 }
471 506 .annotated td {
472 507 padding: 0.25em 0.5em 0.25em 0.5em;
473 508 }
474 509
475 510 .header .content .toc ul
476 511 {
477 512 padding-left: 0px;
478 513 }
479 514
480 515 .content .toc h3 {
481 516 border-bottom: 0px;
482 margin-top: 0px;
517 margin-top: 10px;
483 518 }
484 519
485 520 .content .toc h3 a:hover {
486 521 color: #00732F;
487 522 text-decoration: none;
488 523 }
489 524
490 525 .content .toc .level2
491 526 {
492 527 margin-left: 1.5em;
493 528 }
494 529
495 530 .content .toc .level3
496 531 {
497 532 margin-left: 3.0em;
498 533 }
499 534
500 535 .content ul li
501 536 {
502 537 background: url(../images/bullet_sq.png) no-repeat 0 0.7em;
503 538 padding-left: 1em
504 539 }
505 540
506 541 .content .toc li
507 542 {
508 543 background: url(../images/bullet_dn.png) no-repeat 0 5px;
509 544 padding-left: 1em
510 545 }
511 546
512 547 .relpage
513 548 {
514 549 -moz-border-radius: 7px 7px 7px 7px;
515 550 -webkit-border-radius: 7px 7px 7px 7px;
516 551 border-radius: 7px 7px 7px 7px;
517 552 border: 1px solid #DDDDDD;
518 553 padding: 25px 25px;
519 554 clear: both;
520 555 }
521 556 .relpage ul
522 557 {
523 558 float: none;
524 559 padding: 1.5em;
525 560 }
526 561
527 562 h3.fn, span.fn
528 563 {
529 564 -moz-border-radius:7px 7px 7px 7px;
530 565 -webkit-border-radius:7px 7px 7px 7px;
531 566 border-radius:7px 7px 7px 7px;
532 567 background-color: #F6F6F6;
533 568 border-width: 1px;
534 569 border-style: solid;
535 570 border-color: #E6E6E6;
536 571 font-weight: bold;
537 572 word-spacing:3px;
538 573 padding:3px 5px;
539 574 }
540 575
541 576 .functionIndex {
542 577 font-size:12pt;
543 578 word-spacing:10px;
544 579 margin-bottom:10px;
545 580 background-color: #F6F6F6;
546 581 border-width: 1px;
547 582 border-style: solid;
548 583 border-color: #E6E6E6;
549 584 -moz-border-radius: 7px 7px 7px 7px;
550 585 -webkit-border-radius: 7px 7px 7px 7px;
551 586 border-radius: 7px 7px 7px 7px;
552 587 width:100%;
553 588 }
554 589
555 590 .centerAlign
556 591 {
557 592 text-align:center;
558 593 }
559 594
560 595 .rightAlign
561 596 {
562 597 text-align:right;
563 598 }
564 599
565 600 .leftAlign
566 601 {
567 602 text-align:left;
568 603 }
569 604
570 605 .topAlign{
571 606 vertical-align:top
572 607 }
573 608
574 609 .functionIndex a{
575 610 display:inline-block;
576 611 }
577 612
578 613 /* end content elements */
579 614 /* footer elements */
580 615
581 616 .footer
582 617 {
583 618 color: #393735;
584 619 font-size: 0.75em;
585 620 text-align: center;
586 621 padding-top: 1.5em;
587 622 padding-bottom: 1em;
588 623 background-color: #E6E7E8;
589 624 margin: 0;
590 625 }
591 626 .footer p
592 627 {
593 628 margin: 0.25em
594 629 }
595 630 .small
596 631 {
597 632 font-size: 0.5em;
598 633 }
599 634 /* end footer elements */
600 635
601 636 .item {
602 637 float: left;
603 638 position: relative;
604 639 width: 100%;
605 640 overflow: hidden;
606 641 }
607 642
608 643
609 644 .item .primary {
610 645 margin-right: 220px;
611 646 position: relative;
612 647 }
613 648
614 649 .item hr {
615 650 margin-left: -220px;
616 651 }
617 652
618 653 .item .secondary {
619 654 float: right;
620 655 width: 200px;
621 656 position: relative;
622 657 }
623 658
624 659 .item .cols {
625 660 clear: both;
626 661 display: block;
627 662 }
628 663
629 664 .item .cols .col {
630 665 float: left;
631 666 margin-left: 1.5%;
632 667 }
633 668
634 669 .item .cols .col.first {
635 670 margin-left: 0;
636 671 }
637 672
638 673 .item .cols.two .col {
639 674 width: 45%;
640 675 }
641 676
642 677 .item .box {
643 678 margin: 0 0 10px 0;
644 679 }
645 680
646 681 .item .box h3 {
647 682 margin: 0 0 10px 0;
648 683 }
649 684
650 685 .cols.unclear {
651 686 clear:none;
652 687 }
653 688 }
654 689
655 690 /* end of screen media */
656 691
657 692 /* start of print media */
658 693
659 694 @media print
660 695 {
661 696 input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft, #feedbackBox, #blurpage, .toc, .breadcrumb, .toolbar, .floatingResult
662 697 {
663 698 display: none;
664 699 background: none;
665 700 }
666 701 .content
667 702 {
668 703 background: none;
669 704 display: block;
670 705 width: 100%; margin: 0; float: none;
671 706 }
672 707 }
673 708 /* end of print media */
@@ -1,73 +1,77
1 1 #include <QtGui/QApplication>
2 2 #include <QMainWindow>
3 3 #include <qchartglobal.h>
4 4 #include <qchartview.h>
5 5 #include <qlinechartseries.h>
6 6 #include <qscatterseries.h>
7 7 #include <qbarchartseries.h>
8 8 #include <qbarset.h>
9 9 #include <qbarcategory.h>
10 10 #include <qpieseries.h>
11 11
12 12 QTCOMMERCIALCHART_USE_NAMESPACE
13 13
14 14 int main(int argc, char *argv[])
15 15 {
16 16 QApplication a(argc, argv);
17 17
18 18 //! [1]
19 19 // Create chart view
20 20 QChartView *chartView = new QChartView();
21 chartView->setRenderHint(QPainter::Antialiasing);
21 22 // Add series to the chart
22 23 QLineChartSeries *line = new QLineChartSeries();
23 24 line->add(0.0, 0.8);
24 25 line->add(1.1, 1.1);
25 26 line->add(2.0, 2.5);
26 27 chartView->addSeries(line);
27 28 //! [1]
28 29
29 30 //! [2]
30 31 // Change theme
31 32 chartView->setChartTheme(QChart::ChartThemeScientific);
32 33 //! [2]
33 34
34 35 //! [3]
35 36 // Add pie series
37 // ...
36 38 QPieSeries *pie = new QPieSeries();
37 39 pie->add(3.4, "slice1");
38 40 pie->add(6.7, "slice2");
39 41 chartView->addSeries(pie);
40 42 //! [3]
41 43
42 44 //! [4]
43 45 // Add scatter series
46 // ...
44 47 QScatterSeries *scatter = new QScatterSeries();
45 48 for (qreal x(0); x < 100; x += 0.5) {
46 49 qreal y = rand() % 100;
47 50 *(scatter) << QPointF(x, y);
48 51 }
49 52 chartView->addSeries(scatter);
50 53 //! [4]
51 54
52 55 //! [5]
56 // ...
53 57 // Add bar series
54 58 QBarCategory *barCategory = new QBarCategory();
55 59 *barCategory << "Jan"
56 60 << "Feb"
57 61 << "Mar";
58 62 QBarChartSeries *bar = new QBarChartSeries(barCategory);
59 63 QBarSet *barSet = new QBarSet("Sales");
60 64 *barSet << 123.2
61 65 << 301.3
62 66 << 285.8;
63 67 bar->addBarSet(barSet);
64 68 chartView->addSeries(bar);
65 69 //! [5]
66 70
67 71 QMainWindow w;
68 w.resize(350, 250);
72 w.resize(380, 250);
69 73 w.setCentralWidget(chartView);
70 74 w.show();
71 75
72 76 return a.exec();
73 77 }
@@ -1,46 +1,56
1 1 #include <QApplication>
2 2 #include <QMainWindow>
3 3 #include <qchartview.h>
4 4 #include <qlinechartseries.h>
5 5 #include <qchart.h>
6 6 #include <cmath>
7 7
8 8 QTCOMMERCIALCHART_USE_NAMESPACE
9 9
10 #define PI 3.14159265358979
11
12 10 int main(int argc, char *argv[])
13 11 {
14 12 QApplication a(argc, argv);
15 13
16 14 QMainWindow window;
17 15
16 //![1]
17
18 18 QLineChartSeries* series0 = new QLineChartSeries();
19 19 QPen blue(Qt::blue);
20 20 blue.setWidth(3);
21 21 series0->setPen(blue);
22
22 23 QLineChartSeries* series1 = new QLineChartSeries();
23 24 QPen red(Qt::red);
24 25 red.setWidth(3);
25 26 series1->setPen(red);
26
27 int numPoints = 100;
28
29 for (int x = 0; x <= numPoints; ++x) {
30 series0->add(x, fabs(sin(PI/50*x)*100));
31 series1->add(x, fabs(cos(PI/50*x)*100));
32 }
33
27 //![1]
28
29 //![2]
30 series0->add(0, 6);
31 series0->add(2, 4);
32 series0->add(3, 8);
33 series0->add(7, 4);
34 series0->add(10,5);
35
36 series1->add(1, 1);
37 series1->add(3, 3);
38 series1->add(7, 6);
39 series1->add(8, 3);
40 series1->add(10,2);
41 //![2]
42 //![3]
34 43 QChartView* chartView = new QChartView(&window);
35 44
36 45 chartView->setRenderHint(QPainter::Antialiasing);
37 46 chartView->setChartTitle("Basic line chart example");
38 47 chartView->addSeries(series0);
39 48 chartView->addSeries(series1);
49 //![3]
40 50
41 51 window.setCentralWidget(chartView);
42 52 window.resize(400, 300);
43 53 window.show();
44 54
45 55 return a.exec();
46 56 }
@@ -1,335 +1,335
1 1 #include "axisitem_p.h"
2 2 #include "qchartaxis.h"
3 3 #include "chartpresenter_p.h"
4 4 #include <QPainter>
5 5 #include <QDebug>
6 6
7 7 static int label_padding = 5;
8 8
9 9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10 10
11 11 AxisItem::AxisItem(AxisType type,QGraphicsItem* parent) :
12 12 ChartItem(parent),
13 13 m_type(type),
14 14 m_labelsAngle(0),
15 15 m_grid(parent),
16 16 m_shades(parent),
17 17 m_labels(parent),
18 18 m_axis(parent)
19 19 {
20 20 //initial initialization
21 21 m_axis.setZValue(ChartPresenter::AxisZValue);
22 22 m_shades.setZValue(ChartPresenter::ShadesZValue);
23 23 m_grid.setZValue(ChartPresenter::GridZValue);
24 24 setFlags(QGraphicsItem::ItemHasNoContents);
25 25 }
26 26
27 27 AxisItem::~AxisItem()
28 28 {
29 29 }
30 30
31 31 QRectF AxisItem::boundingRect() const
32 32 {
33 33 return QRectF();
34 34 }
35 35
36 36 void AxisItem::createItems(int count)
37 37 {
38 38 if(m_axis.children().size()==0)
39 39 m_axis.addToGroup(new QGraphicsLineItem());
40 40 for (int i = 0; i < count; ++i) {
41 41 m_grid.addToGroup(new QGraphicsLineItem());
42 42 m_labels.addToGroup(new QGraphicsSimpleTextItem());
43 43 if(m_grid.childItems().size()%2) m_shades.addToGroup(new QGraphicsRectItem());
44 44 m_axis.addToGroup(new QGraphicsLineItem());
45 45 }
46 46 }
47 47
48 48 void AxisItem::clear(int count)
49 49 {
50 50 QList<QGraphicsItem *> lines = m_grid.childItems();
51 51 QList<QGraphicsItem *> labels = m_labels.childItems();
52 52 QList<QGraphicsItem *> shades = m_shades.childItems();
53 53 QList<QGraphicsItem *> axis = m_axis.childItems();
54 54
55 55 for (int i = 0; i < count; ++i) {
56 56 delete(lines.takeLast());
57 57 delete(labels.takeLast());
58 58 if(lines.size()%2) delete(shades.takeLast());
59 59 delete(axis.takeLast());
60 60 }
61 61
62 62 m_thicksList.clear();
63 63
64 64 }
65 65
66 66 void AxisItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
67 67 {
68 68 Q_UNUSED(painter);
69 69 Q_UNUSED(option);
70 70 Q_UNUSED(widget);
71 71 }
72 72
73 73 void AxisItem::updateItems(QVector<qreal>& vector)
74 74 {
75 75 calculateLayout(vector);
76 76 if(vector.count()==0) return;
77 77 applyLayout(vector);
78 78 }
79 79
80 80 void AxisItem::handleAxisUpdate(QChartAxis* axis)
81 81 {
82 82 if(m_layoutVector.count()==0) return;
83 83
84 84 if(axis->isAxisVisible()) {
85 85 setAxisOpacity(100);
86 86 }
87 87 else {
88 88 setAxisOpacity(0);
89 89 }
90 90
91 91 if(axis->isGridVisible()) {
92 92 setGridOpacity(100);
93 93 }
94 94 else {
95 95 setGridOpacity(0);
96 96 }
97 97
98 98 if(axis->isLabelsVisible())
99 99 {
100 100 setLabelsOpacity(100);
101 101 }
102 102 else {
103 103 setLabelsOpacity(0);
104 104 }
105 105
106 106 if(axis->isShadesVisible()) {
107 107 setShadesOpacity(axis->shadesOpacity());
108 108 }
109 109 else {
110 110 setShadesOpacity(0);
111 111 }
112 112
113 113 setLabelsAngle(axis->labelsAngle());
114 114 setAxisPen(axis->axisPen());
115 115 setLabelsPen(axis->labelsPen());
116 116 setLabelsBrush(axis->labelsBrush());
117 setLabelsFont(axis->labelFont());
117 setLabelsFont(axis->labelsFont());
118 118 setGridPen(axis->gridPen());
119 119 setShadesPen(axis->shadesPen());
120 120 setShadesBrush(axis->shadesBrush());
121 121 }
122 122
123 123 void AxisItem::handleLabelsChanged(QChartAxis* axis,const QStringList& labels)
124 124 {
125 125 int diff = m_thicksList.size() - labels.size();
126 126
127 127 if(diff>0){
128 128 clear(diff);
129 129 }else if(diff<0){
130 130 createItems(-diff);
131 131 }
132 132 m_thicksList=labels;
133 133 m_layoutVector.resize(m_thicksList.size());
134 134 updateItems(m_layoutVector);
135 135 if(diff!=0) handleAxisUpdate(axis);
136 136 }
137 137
138 138 void AxisItem::handleGeometryChanged(const QRectF& rect)
139 139 {
140 140 m_rect = rect;
141 141 updateItems(m_layoutVector);
142 142 }
143 143
144 144 void AxisItem::setAxisOpacity(qreal opacity)
145 145 {
146 146 m_axis.setOpacity(opacity);
147 147 }
148 148
149 149 qreal AxisItem::axisOpacity() const
150 150 {
151 151 return m_axis.opacity();
152 152 }
153 153
154 154 void AxisItem::setGridOpacity(qreal opacity)
155 155 {
156 156 m_grid.setOpacity(opacity);
157 157 }
158 158
159 159 qreal AxisItem::gridOpacity() const
160 160 {
161 161 return m_grid.opacity();
162 162 }
163 163
164 164 void AxisItem::setLabelsOpacity(qreal opacity)
165 165 {
166 166 m_labels.setOpacity(opacity);
167 167 }
168 168
169 169 qreal AxisItem::labelsOpacity() const
170 170 {
171 171 return m_labels.opacity();
172 172 }
173 173
174 174 void AxisItem::setShadesOpacity(qreal opacity)
175 175 {
176 176 m_shades.setOpacity(opacity);
177 177 }
178 178
179 179 qreal AxisItem::shadesOpacity() const
180 180 {
181 181 return m_shades.opacity();
182 182 }
183 183
184 184 void AxisItem::setLabelsAngle(int angle)
185 185 {
186 186 foreach(QGraphicsItem* item , m_labels.childItems()) {
187 187 QPointF center = item->boundingRect().center();
188 188 item->setRotation(angle);
189 189 }
190 190
191 191 m_labelsAngle=angle;
192 192 }
193 193
194 194 void AxisItem::setLabelsPen(const QPen& pen)
195 195 {
196 196 foreach(QGraphicsItem* item , m_labels.childItems()) {
197 197 static_cast<QGraphicsSimpleTextItem*>(item)->setPen(pen);
198 198 }
199 199 }
200 200
201 201 void AxisItem::setLabelsBrush(const QBrush& brush)
202 202 {
203 203 foreach(QGraphicsItem* item , m_labels.childItems()) {
204 204 static_cast<QGraphicsSimpleTextItem*>(item)->setBrush(brush);
205 205 }
206 206 }
207 207
208 208 void AxisItem::setLabelsFont(const QFont& font)
209 209 {
210 210 foreach(QGraphicsItem* item , m_labels.childItems()) {
211 211 static_cast<QGraphicsSimpleTextItem*>(item)->setFont(font);
212 212 }
213 213 }
214 214
215 215 void AxisItem::setShadesBrush(const QBrush& brush)
216 216 {
217 217 foreach(QGraphicsItem* item , m_shades.childItems()) {
218 218 static_cast<QGraphicsRectItem*>(item)->setBrush(brush);
219 219 }
220 220 }
221 221
222 222 void AxisItem::setShadesPen(const QPen& pen)
223 223 {
224 224 foreach(QGraphicsItem* item , m_shades.childItems()) {
225 225 static_cast<QGraphicsRectItem*>(item)->setPen(pen);
226 226 }
227 227 }
228 228
229 229 void AxisItem::setAxisPen(const QPen& pen)
230 230 {
231 231 foreach(QGraphicsItem* item , m_axis.childItems()) {
232 232 static_cast<QGraphicsLineItem*>(item)->setPen(pen);
233 233 }
234 234 }
235 235
236 236 void AxisItem::setGridPen(const QPen& pen)
237 237 {
238 238 foreach(QGraphicsItem* item , m_grid.childItems()) {
239 239 static_cast<QGraphicsLineItem*>(item)->setPen(pen);
240 240 }
241 241 }
242 242
243 243 void AxisItem::calculateLayout(QVector<qreal>& points)
244 244 {
245 245 switch (m_type)
246 246 {
247 247 case X_AXIS:
248 248 {
249 249 const qreal deltaX = m_rect.width()/(m_thicksList.size()-1);
250 250 for (int i = 0; i < m_thicksList.size(); ++i) {
251 251 int x = i * deltaX + m_rect.left();
252 252 points[i]=x;
253 253 }
254 254 }
255 255 break;
256 256 case Y_AXIS:
257 257 {
258 258 const qreal deltaY = m_rect.height()/(m_thicksList.size()-1);
259 259 for (int i = 0; i < m_thicksList.size(); ++i) {
260 260 int y = i * -deltaY + m_rect.bottom();
261 261 points[i]=y;
262 262 }
263 263 }
264 264 break;
265 265 }
266 266 }
267 267
268 268 void AxisItem::applyLayout(const QVector<qreal>& points)
269 269 {
270 270 Q_ASSERT(points.size() == m_thicksList.size());
271 271
272 272 QList<QGraphicsItem *> lines = m_grid.childItems();
273 273 QList<QGraphicsItem *> labels = m_labels.childItems();
274 274 QList<QGraphicsItem *> shades = m_shades.childItems();
275 275 QList<QGraphicsItem *> axis = m_axis.childItems();
276 276
277 277 Q_ASSERT(labels.size() == m_thicksList.size());
278 278
279 279 switch (m_type)
280 280 {
281 281 case X_AXIS:
282 282 {
283 283 QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(axis.at(0));
284 284 lineItem->setLine(m_rect.left(), m_rect.bottom(), m_rect.right(), m_rect.bottom());
285 285
286 286 for (int i = 0; i < points.size(); ++i) {
287 287 QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(lines.at(i));
288 288 lineItem->setLine(points[i], m_rect.top(), points[i], m_rect.bottom());
289 289 QGraphicsSimpleTextItem *labelItem = static_cast<QGraphicsSimpleTextItem*>(labels.at(i));
290 290 labelItem->setText(m_thicksList.at(i));
291 291 QPointF center = labelItem->boundingRect().center();
292 292 labelItem->setTransformOriginPoint(center.x(), center.y());
293 293 labelItem->setPos(points[i] - center.x(), m_rect.bottom() + label_padding);
294 294 if(i%2){
295 295 QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem*>(shades.at(i/2));
296 296 rectItem->setRect(points[i],m_rect.top(),points[i+1]-points[i],m_rect.height());
297 297 }
298 298 lineItem = static_cast<QGraphicsLineItem*>(axis.at(i+1));
299 299 lineItem->setLine(points[i],m_rect.bottom(),points[i],m_rect.bottom()+5);
300 300 }
301 301 }
302 302 break;
303 303
304 304 case Y_AXIS:
305 305 {
306 306 QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(axis.at(0));
307 307 lineItem->setLine(m_rect.left() , m_rect.top(), m_rect.left(), m_rect.bottom());
308 308
309 309 for (int i = 0; i < points.size(); ++i) {
310 310 QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(lines.at(i));
311 311 lineItem->setLine(m_rect.left() , points[i], m_rect.right(), points[i]);
312 312 QGraphicsSimpleTextItem *labelItem = static_cast<QGraphicsSimpleTextItem*>(labels.at(i));
313 313 labelItem->setText(m_thicksList.at(i));
314 314 QPointF center = labelItem->boundingRect().center();
315 315 labelItem->setTransformOriginPoint(center.x(), center.y());
316 316 labelItem->setPos(m_rect.left() - labelItem->boundingRect().width() - label_padding , points[i]-center.y());
317 317 if(i%2){
318 318 QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem*>(shades.at(i/2));
319 319 rectItem->setRect(m_rect.left(),points[i],m_rect.width(),points[i]-points[i+1]);
320 320 }
321 321 lineItem = static_cast<QGraphicsLineItem*>(axis.at(i+1));
322 322 lineItem->setLine(m_rect.left()-5,points[i],m_rect.left(),points[i]);
323 323 }
324 324 }
325 325 break;
326 326 default:
327 327 qDebug()<<"Unknown axis type";
328 328 break;
329 329 }
330 330 }
331 331
332 332 //TODO "nice numbers algorithm"
333 333 #include "moc_axisitem_p.cpp"
334 334
335 335 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,75 +1,182
1 1 #include "qlinechartseries.h"
2 2
3 3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4 4
5 /*!
6 \class QLineChartSeries
7 \brief The QLineChartSeries class is used for making line charts.
8
9 \mainclass
10
11 A line chart is used to show information as a series of data points
12 connected by straight lines.
13
14 \image linechart.png
15
16 To create line charts, users need to first QLineChartSeries object.
17
18 \snippet ../example/linechart/main.cpp 1
19
20 Populate with the data
21
22 \snippet ../example/linechart/main.cpp 2
23
24 Add created series objects to QChartView or QChart instance.
25
26 \snippet ../example/linechart/main.cpp 3
27
28 */
29
30 /*!
31 \fn virtual QChartSeriesType QLineChartSeries::type() const
32 \brief Returns type of series.
33 \sa QChartSeries, QChartSeriesType
34 */
35
36 /*!
37 \fn QPen QLineChartSeries::pen() const
38 \brief Returns the pen used to draw line for this series.
39 \sa setPen()
40 */
41
42 /*!
43 \fn bool QLineChartSeries::isPointsVisible() const
44 \brief Returns if the points are drawn for this series.
45 \sa setPointsVisible()
46 */
47
48
49 /*!
50 \fn void QLineChartSeries::changed(int index)
51 \brief \internal \a index
52 */
53
54 /*!
55 Constructs empty series object which is a child of \a parent.
56 When series object is added to QChartView or QChart instance ownerships is transfered.
57 */
5 58 QLineChartSeries::QLineChartSeries(QObject* parent):QChartSeries(parent),
6 59 m_pointsVisible(false)
7 60 {
8 61 }
9
62 /*!
63 Destroys the object. Series added to QChartView or QChart instances are owned by those,
64 and are deleted when mentioned object are destroyed.
65 */
10 66 QLineChartSeries::~QLineChartSeries()
11 67 {
12 68 }
13 69
70 /*!
71 Adds data point \a x \a y to the series. Points are connected with lines on the chart.
72 Function returns index, which can be used to modify data.
73 */
14 74 int QLineChartSeries::add(qreal x,qreal y)
15 75 {
16 76 m_x<<x;
17 77 m_y<<y;
18 78 return m_x.size()-1;
19 79 }
20 80
81 /*!
82 This is an overloaded function.
83 Adds data \a point to the series. Points are connected with lines on the chart.
84 Function returns index, which can be used to modify data.
85 */
86 int QLineChartSeries::add(const QPointF& point)
87 {
88 m_x<<point.x();
89 m_y<<point.y();
90 return m_x.size()-1;
91 }
92
93 /*!
94 Modifies data within \a index, sets new \a x and \a y values.
95 */
21 96 void QLineChartSeries::set(int index,qreal x,qreal y)
22 97 {
23 98 m_x[index]=x;
24 99 m_y[index]=y;
25 100 emit changed(index);
26 101 }
27 102
103 /*!
104 This is an overloaded function.
105 Modifies data within \a index, sets new \a point value.
106 */
107 void QLineChartSeries::set(int index,const QPointF& point)
108 {
109 m_x[index]=point.x();
110 m_y[index]=point.y();
111 emit changed(index);
112 }
113
114
115 /*!
116 Clears all the data.
117 */
28 118 void QLineChartSeries::clear()
29 119 {
30 120 m_x.clear();
31 121 m_y.clear();
32 122 }
33 123
124 /*!
125 \internal \a pos
126 */
34 127 qreal QLineChartSeries::x(int pos) const
35 128 {
36 129 return m_x.at(pos);
37 130 }
38 131
132 /*!
133 \internal \a pos
134 */
39 135 qreal QLineChartSeries::y(int pos) const
40 136 {
41 137 return m_y.at(pos);
42 138 }
43 139
140 /*!
141 Returns number of data points within series.
142 */
44 143 int QLineChartSeries::count() const
45 144 {
46 145 Q_ASSERT(m_x.size() == m_y.size());
47 146
48 147 return m_x.size();
49 148
50 149 }
51 150
151 /*!
152 Sets \a pen used for drawing given series..
153 */
52 154 void QLineChartSeries::setPen(const QPen& pen)
53 155 {
54 156 m_pen=pen;
55 157 }
56 158
159 /*!
160 Sets if data points are \a visible and should be drawn on line.
161 */
162 void QLineChartSeries::setPointsVisible(bool visible)
163 {
164 m_pointsVisible=visible;
165 }
166
57 167 QDebug operator<< (QDebug debug, const QLineChartSeries series)
58 168 {
59 169 Q_ASSERT(series.m_x.size() == series.m_y.size());
60 170
61 171 int size = series.m_x.size();
62 172
63 173 for (int i=0;i<size;i++) {
64 174 debug.nospace() << "(" << series.m_x.at(i) << ','<< series.m_y.at(i) << ") ";
65 175 }
66 176 return debug.space();
67 177 }
68 178
69 void QLineChartSeries::setPointsVisible(bool visible)
70 {
71 m_pointsVisible=visible;
72 }
179
73 180 #include "moc_qlinechartseries.cpp"
74 181
75 182 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,48 +1,50
1 1 #ifndef QLINECHARTSERIES_H_
2 2 #define QLINECHARTSERIES_H_
3 3
4 4 #include "qchartglobal.h"
5 5 #include "qchartseries.h"
6 6 #include <QDebug>
7 7 #include <QPen>
8 8 #include <QBrush>
9 9
10 10 QTCOMMERCIALCHART_BEGIN_NAMESPACE
11 11
12 12 class QTCOMMERCIALCHART_EXPORT QLineChartSeries : public QChartSeries
13 13 {
14 14 Q_OBJECT
15 15 public:
16 16 QLineChartSeries(QObject* parent=0);
17 17 virtual ~QLineChartSeries();
18 18
19 19 public: // from QChartSeries
20 20 virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeLine;}
21 21 int add(qreal x, qreal y);
22 int add(const QPointF& point);
22 23 void set(int index,qreal x,qreal y);
24 void set(int index,const QPointF& point);
23 25 void clear();
24 26
25 27 void setPen(const QPen& pen);
26 const QPen& pen() const { return m_pen;}
28 QPen pen() const { return m_pen;}
27 29
28 30 void setPointsVisible(bool visible);
29 31 bool isPointsVisible() const {return m_pointsVisible;}
30 32
31 33 int count() const;
32 34 qreal x(int pos) const;
33 35 qreal y(int pos) const;
34 36 friend QDebug operator<< (QDebug d, const QLineChartSeries series);
35 37
36 38 signals:
37 39 void changed(int index);
38 40
39 41 private:
40 42 QVector<qreal> m_x;
41 43 QVector<qreal> m_y;
42 44 QPen m_pen;
43 45 bool m_pointsVisible;
44 46 };
45 47
46 48 QTCOMMERCIALCHART_END_NAMESPACE
47 49
48 50 #endif
@@ -1,154 +1,353
1 1 #include "qchartaxis.h"
2 2
3 3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4 4
5 /*!
6 \class QChartAxis
7 \brief The QChartAxis class is used for manipulating chart's axis
8 and for adding optional axes to the chart.
9 \mainclass
10
11 There is only one x Axis, however there can be multiple y axes.
12 Each chart series can be bound to exactly one Y axis and the share common X axis.
13 Axis can be setup to show axis line with ticks, gird lines and shades.
14
15 */
16
17 /*!
18 \fn bool QChartAxis::isAxisVisible() const
19 \brief Returns if axis is visible
20 \sa setAxisVisible()
21 */
22
23 /*!
24 \fn QPen QChartAxis::axisPen() const
25 \brief Returns pen used to draw axis and ticks.
26 \sa setAxisPen()
27 */
28
29
30 /*!
31 \fn bool QChartAxis::isGridVisible() const
32 \brief Returns if grid is visible
33 \sa setGridVisible()
34 */
35
36 /*!
37 \fn QPen QChartAxis::gridPen() const
38 \brief Returns pen used to draw grid.
39 \sa setGridPen()
40 */
41
42 /*!
43 \fn bool QChartAxis::isLabelsVisible() const
44 \brief Returns if grid is visible
45 \sa setLabelsVisible()
46 */
47
48 /*!
49 \fn QPen QChartAxis::labelsPen() const
50 \brief Returns the pen used to labels.
51 \sa setLabelsPen()
52 */
53
54 /*!
55 \fn QBrush QChartAxis::labelsBrush() const
56 \brief Returns brush used to draw labels.
57 \sa setLabelsBrush()
58 */
59
60 /*!
61 \fn QFont QChartAxis::labelsFont() const
62 \brief Returns font used to draw labels.
63 \sa setLabelsFont()
64 */
65
66 /*!
67 \fn QFont QChartAxis::labelsAngle() const
68 \brief Returns angle used to draw labels.
69 \sa setLabelsAngle()
70 */
71
72 /*!
73 \fn bool QChartAxis::isShadesVisible() const
74 \brief Returns if shades are visible.
75 \sa setShadesVisible()
76 */
77
78 /*!
79 \fn qreal QChartAxis::shadesOpacity() const
80 \brief Returns opacity of shades.
81 */
82
83 /*!
84 \fn QPen QChartAxis::shadesPen() const
85 \brief Returns pen used to draw shades.
86 \sa setShadesPen()
87 */
88
89 /*!
90 \fn QBrush QChartAxis::shadesBrush() const
91 \brief Returns brush used to draw shades.
92 \sa setShadesBrush()
93 */
94
95 /*!
96 \fn qreal QChartAxis::min() const
97 \brief Returns minimum value on the axis.
98 \sa setMin()
99 */
100
101 /*!
102 \fn qreal QChartAxis::max() const
103 \brief Returns maximim value on the axis.
104 \sa setMax()
105 */
106
107 /*!
108 \fn void QChartAxis::minChanged(qreal min)
109 \brief Axis emits signal when \a min of axis has changed.
110 */
111
112 /*!
113 \fn void QChartAxis::maxChanged(qreal max)
114 \brief Axis emits signal when \a max of axis has changed.
115 */
116 /*!
117 \fn int QChartAxis::ticksCount() const
118 \brief Return number of ticks on the axis
119 \sa setTicksCount()
120 */
121
122 /*!
123 \fn void QChartAxis::update(QChartAxis*)
124 \brief \internal
125 */
126
127 /*!
128 \fn void QChartAxis::ticksChanged(QChartAxis*)
129 \brief \internal
130 */
131
132 /*!
133 Constructs new axis object which is a child of \a parent. Ownership is taken by
134 QChatView or QChart when axis added.
135 */
136
5 137 QChartAxis::QChartAxis(QObject* parent):QObject(parent),
6 138 m_axisVisible(true),
7 139 m_gridVisible(true),
8 140 m_labelsVisible(true),
9 141 m_labelsAngle(0),
10 142 m_shadesVisible(true),
11 143 m_shadesOpacity(1.0),
12 144 m_min(0),
13 145 m_max(0),
14 146 m_ticksCount(5)
15 147 {
16 148
17 149 }
18 150
151 /*!
152 Destructor of the axis object. When axis is added to chart, chart object takes ownership.
153 */
154
19 155 QChartAxis::~QChartAxis()
20 156 {
21 157 }
22 158
159 /*!
160 Sets \a pen used to draw axis line and ticks.
161 */
23 162 void QChartAxis::setAxisPen(const QPen& pen)
24 163 {
25 164 m_axisPen=pen;
26 165 emit update(this);
27 166 }
28 167
168 /*!
169 Sets if axis and ticks are \a visible.
170 */
29 171 void QChartAxis::setAxisVisible(bool visible)
30 172 {
31 173 m_axisVisible=visible;
32 174 emit update(this);
33 175 }
34 176
177 /*!
178 Sets if grid is \a visible.
179 */
35 180 void QChartAxis::setGridVisible(bool visible)
36 181 {
37 182 m_gridVisible=visible;
38 183 emit update(this);
39 184 }
40 185
186 /*!
187 Sets \a pen used to draw grid.
188 */
41 189 void QChartAxis::setGridPen(const QPen& pen)
42 190 {
43 191 m_gridPen=pen;
44 192 emit update(this);
45 193 }
46 194
195 /*!
196 Sets if axis' labels are \a visible.
197 */
47 198 void QChartAxis::setLabelsVisible(bool visible)
48 199 {
49 200 m_labelsVisible=visible;
50 201 emit update(this);
51 202 }
52 203
204 /*!
205 Sets \a pen used to draw labels.
206 */
53 207 void QChartAxis::setLabelsPen(const QPen& pen)
54 208 {
55 209 m_labelsPen=pen;
56 210 emit update(this);
57 211 }
58 212
213 /*!
214 Sets \a brush used to draw labels.
215 */
59 216 void QChartAxis::setLabelsBrush(const QBrush& brush)
60 217 {
61 218 m_labelsBrush=brush;
62 219 emit update(this);
63 220 }
64 221
222 /*!
223 Sets \a font used to draw labels.
224 */
65 225 void QChartAxis::setLabelsFont(const QFont& font)
66 226 {
67 227 m_labelsFont=font;
68 228 emit update(this);
69 229 }
70 230
231 /*!
232 Sets \a angle for all the labels on given axis.
233 */
71 234 void QChartAxis::setLabelsAngle(int angle)
72 235 {
73 236 m_labelsAngle=angle;
74 237 emit update(this);
75 238 }
76 239
240 /*!
241 Sets if shades are \a visible.
242 */
77 243 void QChartAxis::setShadesVisible(bool visible)
78 244 {
79 245 m_shadesVisible=visible;
80 246 emit update(this);
81 247 }
82 248
249 /*!
250 Sets \a pen used to draw shades.
251 */
83 252 void QChartAxis::setShadesPen(const QPen& pen)
84 253 {
85 254 m_shadesPen=pen;
86 255 emit update(this);
87 256 }
88 257
258 /*!
259 Sets \a brush used to draw shades.
260 */
89 261 void QChartAxis::setShadesBrush(const QBrush& brush)
90 262 {
91 263 m_shadesBrush=brush;
92 264 emit update(this);
93 265 }
94 266
267 /*!
268 Sets \a opacity of the shades.
269 */
95 270 void QChartAxis::setShadesOpacity(qreal opacity)
96 271 {
97 272 m_shadesOpacity=opacity;
98 273 emit update(this);
99 274 }
100 275
276 /*!
277 Sets \a min value on the axis.
278 */
101 279 void QChartAxis::setMin(qreal min)
102 280 {
103 281 if(m_min!=min){
104 282 m_min=min;
105 283 emit minChanged(m_min);
106 284 }
107 285 }
108 286
287 /*!
288 Sets \a max value on the axis.
289 */
109 290 void QChartAxis::setMax(qreal max)
110 291 {
111 292 if(m_max!=max){
112 293 m_max=max;
113 294 emit maxChanged(m_max);
114 295 }
115 296 }
116 297
298 /*!
299 Sets range from \a min to \a max on the axis.
300 */
117 301 void QChartAxis::setRange(qreal min, qreal max)
118 302 {
119 303 setMin(min);
120 304 setMax(max);
121 305 }
122 306
307 /*!
308 Sets \a count for ticks on the axis.
309 */
123 310 void QChartAxis::setTicksCount(int count)
124 311 {
125 312 m_ticksCount=count;
126 313 emit ticksChanged(this);
127 314 }
128 315
316 /*!
317 TODO: refactor me. Sets string \a label for \a value on the axis.
318 */
129 319 void QChartAxis::addAxisTickLabel(qreal value,const QString& label)
130 320 {
131 321 m_ticks.insert(value,label);
132 322 emit ticksChanged(this);
133 323 }
134 324
325 /*!
326 TODO: refactor me. Removes label for \a value on the axis.
327 */
135 328 void QChartAxis::removeAxisTickLabel(qreal value)
136 329 {
137 330 m_ticks.remove(value);
138 331 emit ticksChanged(this);
139 332 }
140 333
334 /*!
335 TODO: refactor me. Returns label for \a value on the axis.
336 */
141 337 QString QChartAxis::axisTickLabel(qreal value) const
142 338 {
143 339 return m_ticks.value(value);
144 340 }
145 341
342 /*!
343 TODO: refactor me. Removes all the string labels for on the axis.
344 */
146 345 void QChartAxis::clearAxisTickLabels()
147 346 {
148 347 m_ticks.clear();
149 348 emit ticksChanged(this);
150 349 }
151 350
152 351 #include "moc_qchartaxis.cpp"
153 352
154 353 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,103 +1,101
1 1 #ifndef QCHARTAXIS_H_
2 2 #define QCHARTAXIS_H_
3 3
4 4 #include <qchartglobal.h>
5 5 #include <QPen>
6 6 #include <QFont>
7 7
8 8
9 9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10 10
11 11 class QTCOMMERCIALCHART_EXPORT QChartAxis : public QObject
12 12 {
13 13 Q_OBJECT
14 14 public:
15 15 QChartAxis(QObject* parent =0);
16 16 ~QChartAxis();
17 17
18 18 //axis handling
19 19 bool isAxisVisible() const { return m_axisVisible;};
20 20 void setAxisVisible(bool visible);
21 21 void setAxisPen(const QPen& pen);
22 22 QPen axisPen() const { return m_axisPen;};
23 void setAxisBrush(const QBrush& brush);
24 QBrush axisBrush() const { return m_axisBrush;};
25 23
26 24 //grid handling
27 25 bool isGridVisible() const { return m_gridVisible;};
28 26 void setGridVisible(bool visible);
29 27 void setGridPen(const QPen& pen);
30 28 QPen gridPen() const {return m_gridPen;}
31 29
32 30 //labels handling
33 31 bool isLabelsVisible() const { return m_labelsVisible;};
34 32 void setLabelsVisible(bool visible);
35 33 void setLabelsPen(const QPen& pen);
36 34 QPen labelsPen() const { return m_labelsPen;}
37 35 void setLabelsBrush(const QBrush& brush);
38 36 QBrush labelsBrush() const { return m_labelsBrush;}
39 37 void setLabelsFont(const QFont& font);
40 QFont labelFont() const { return m_labelsFont;}
38 QFont labelsFont() const { return m_labelsFont;}
41 39 void setLabelsAngle(int angle);
42 40 int labelsAngle() const { return m_labelsAngle;};
43 41
44 42 //shades handling
45 43 bool isShadesVisible() const { return m_shadesVisible;};
46 44 void setShadesVisible(bool visible);
47 45 void setShadesPen(const QPen& pen);
48 46 QPen shadesPen() const { return m_shadesPen;}
49 47 void setShadesBrush(const QBrush& brush);
50 48 QBrush shadesBrush() const { return m_shadesBrush;}
51 49 void setShadesOpacity(qreal opacity);
52 50 qreal shadesOpacity() const { return m_shadesOpacity;}
53 51
54 52 //range handling
55 53 void setMin(qreal min);
56 54 qreal min() const { return m_min;};
57 55 void setMax(qreal max);
58 56 qreal max() const { return m_max;};
59 57 void setRange(qreal min, qreal max);
60 58
61 59 //ticks handling
62 60 void setTicksCount(int count);
63 61 int ticksCount() const { return m_ticksCount;}
64 62 void addAxisTickLabel(qreal value,const QString& label);
65 63 void removeAxisTickLabel(qreal value);
66 64 QString axisTickLabel(qreal value) const ;
67 65 void clearAxisTickLabels();
68 66
69 67 signals:
70 68 void minChanged(qreal min);
71 69 void maxChanged(qreal max);
72 70 //private signal
73 71 void update(QChartAxis*);
74 72 void ticksChanged(QChartAxis*);
75 73
76 74 private:
77 75 bool m_axisVisible;
78 76 QPen m_axisPen;
79 77 QBrush m_axisBrush;
80 78
81 79 bool m_gridVisible;
82 80 QPen m_gridPen;
83 81
84 82 bool m_labelsVisible;
85 83 QPen m_labelsPen;
86 84 QBrush m_labelsBrush;
87 85 QFont m_labelsFont;
88 86 int m_labelsAngle;
89 87
90 88 bool m_shadesVisible;
91 89 QPen m_shadesPen;
92 90 QBrush m_shadesBrush;
93 91 qreal m_shadesOpacity;
94 92
95 93 qreal m_min;
96 94 qreal m_max;
97 95
98 96 int m_ticksCount;
99 97 QMap<qreal, QString> m_ticks;
100 98 };
101 99
102 100 QTCOMMERCIALCHART_END_NAMESPACE
103 101 #endif /* QCHARTAXIS_H_ */
@@ -1,368 +1,351
1 1 #include "qchartview.h"
2 2 #include "qchart.h"
3 3 #include "qchartaxis.h"
4 4 #include <QGraphicsView>
5 5 #include <QGraphicsScene>
6 6 #include <QRubberBand>
7 7 #include <QResizeEvent>
8 8 #include <QDebug>
9 9
10 10 /*!
11 11 \enum QChartView::RubberBandPolicy
12 12
13 13 This enum describes the different types of rubber bands that can be used for zoom rect selection
14 14
15 15 \value NoRubberBand
16 16 \value VerticalRubberBand
17 17 \value HorizonalRubberBand
18 18 \value RectangleRubberBand
19 19 */
20 20
21 21 /*!
22 22 \class QChartView
23 23 \brief Standalone charting widget.
24 24
25 25 QChartView is a standalone widget that can display charts. It does not require separate
26 26 QGraphicsScene to work. It manages the graphical representation of different types of
27 27 QChartSeries and other chart related objects like QChartAxis and QChartLegend. If you want to
28 28 display a chart in your existing QGraphicsScene, you can use the QChart class instead.
29 29
30 For example, to create a chart with line series using a widget based application:
31 \snippet ../example/chartview/main.cpp 1
32 \image chartview_example.jpg
33
34 Showing a few more series:
35 \snippet ../example/chartview/main.cpp 3
36 \image chartview_example_pie.jpg
37 \snippet ../example/chartview/main.cpp 4
38 \image chartview_example_scatter.jpg
39 \snippet ../example/chartview/main.cpp 5
40 \image chartview_example_bar.jpg
41
42 If you need to give a more professional touch to your chart you can switch to one of the
43 pre-defined themes:
44 \snippet ../example/chartview/main.cpp 2
45 \image chartview_example_theme.jpg
46
47 30 \sa QChart
48 31 */
49 32
50 33 QTCOMMERCIALCHART_BEGIN_NAMESPACE
51 34
52 35 /*!
53 36 Constructs a chartView object which is a child of a\a parent.
54 37 */
55 38 QChartView::QChartView(QWidget *parent) :
56 39 QGraphicsView(parent),
57 40 m_scene(new QGraphicsScene(this)),
58 41 m_chart(new QChart()),
59 42 m_rubberBand(0),
60 43 m_verticalRubberBand(false),
61 44 m_horizonalRubberBand(false)
62 45 {
63 46 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
64 47 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
65 48 setScene(m_scene);
66 49 m_chart->setMargin(50);
67 50 m_scene->addItem(m_chart);
68 51 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
69 52 }
70 53
71 54
72 55 /*!
73 56 Destroys the object and it's children, like QChartSeries and QChartAxis object added to it.
74 57 */
75 58 QChartView::~QChartView()
76 59 {
77 60 }
78 61
79 62 /*!
80 63 Resizes and updates the chart area using the \a event data
81 64 */
82 65 void QChartView::resizeEvent(QResizeEvent *event)
83 66 {
84 67 m_scene->setSceneRect(0,0,size().width(),size().height());
85 68 m_chart->resize(size());
86 69 QWidget::resizeEvent(event);
87 70 }
88 71
89 72 /*!
90 73 Adds the \a series and optional \a axisY onto the chart and takes the ownership of the objects.
91 74 If auto scaling is enabled, re-scales the axes the series is bound to (both the x axis and
92 75 the y axis).
93 76 \sa removeSeries(), removeAllSeries()
94 77 */
95 78 void QChartView::addSeries(QChartSeries* series,QChartAxis *axisY)
96 79 {
97 80 m_chart->addSeries(series,axisY);
98 81 }
99 82
100 83 /*!
101 84 Removes the \a series specified in a perameter from the QChartView.
102 85 It releses its ownership of the specified QChartSeries object.
103 86 It does not delete the pointed QChartSeries data object
104 87 \sa addSeries(), removeAllSeries()
105 88 */
106 89 void QChartView::removeSeries(QChartSeries* series)
107 90 {
108 91 m_chart->removeSeries(series);
109 92 }
110 93
111 94 /*!
112 95 Removes all the QChartSeries that have been added to the QChartView
113 96 It also deletes the pointed QChartSeries data objects
114 97 \sa addSeries(), removeSeries()
115 98 */
116 99 void QChartView::removeAllSeries()
117 100 {
118 101 m_chart->removeAllSeries();
119 102 }
120 103
121 104 /*!
122 105 Zooms in the view by a factor of 2
123 106 */
124 107 void QChartView::zoomIn()
125 108 {
126 109 m_chart->zoomIn();
127 110 }
128 111
129 112 /*!
130 113 Zooms in the view to a maximum level at which \a rect is still fully visible.
131 114 */
132 115 void QChartView::zoomIn(const QRect& rect)
133 116 {
134 117 m_chart->zoomIn(rect);
135 118 }
136 119
137 120 /*!
138 121 Restores the view zoom level to the previous one.
139 122 */
140 123 void QChartView::zoomOut()
141 124 {
142 125 m_chart->zoomOut();
143 126 }
144 127
145 128 /*!
146 129 Returns the chart margin, which is the distance between the widget edge and the part of the chart where the actual data can be displayed.
147 130 */
148 131 int QChartView::margin() const
149 132 {
150 133 return m_chart->margin();
151 134 }
152 135
153 136 /*!
154 137 Sets the chart \a title. A description text that is rendered above the chart.
155 138 */
156 139 void QChartView::setChartTitle(const QString& title)
157 140 {
158 141 m_chart->setChartTitle(title);
159 142 }
160 143
161 144 /*!
162 145 Sets the \a font that is used for rendering the description text that is rendered above the chart.
163 146 */
164 147 void QChartView::setChartTitleFont(const QFont& font)
165 148 {
166 149 m_chart->setChartTitleFont(font);
167 150 }
168 151
169 152 /*!
170 153 Sets the \a brush that is used for painting the background of the chart area of the QChartView widget.
171 154 */
172 155 void QChartView::setChartBackgroundBrush(const QBrush& brush)
173 156 {
174 157 m_chart->setChartBackgroundBrush(brush);
175 158 }
176 159
177 160 /*!
178 161 Sets the \a pen that is used for painting the background of the chart area of the QChartView widget.
179 162 */
180 163 void QChartView::setChartBackgroundPen(const QPen& pen)
181 164 {
182 165 m_chart->setChartBackgroundPen(pen);
183 166 }
184 167
185 168 /*!
186 169 Sets the RubberBandPlicy to \a policy. Selected policy determines the way zooming is performed.
187 170 */
188 171 void QChartView::setRubberBandPolicy(const RubberBandPolicy policy)
189 172 {
190 173 switch(policy) {
191 174 case VerticalRubberBand:
192 175 m_verticalRubberBand = true;
193 176 m_horizonalRubberBand = false;
194 177 break;
195 178 case HorizonalRubberBand:
196 179 m_verticalRubberBand = false;
197 180 m_horizonalRubberBand = true;
198 181 break;
199 182 case RectangleRubberBand:
200 183 m_verticalRubberBand = true;
201 184 m_horizonalRubberBand = true;
202 185 break;
203 186 case NoRubberBand:
204 187 default:
205 188 delete m_rubberBand;
206 189 m_rubberBand=0;
207 190 m_horizonalRubberBand = false;
208 191 m_verticalRubberBand = false;
209 192 return;
210 193 }
211 194 if(!m_rubberBand) {
212 195 m_rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
213 196 m_rubberBand->setEnabled(true);
214 197 }
215 198 }
216 199
217 200 /*!
218 201 Returns the RubberBandPolicy that is currently being used by the widget.
219 202 */
220 203 QChartView::RubberBandPolicy QChartView::rubberBandPolicy() const
221 204 {
222 205 if(m_horizonalRubberBand && m_verticalRubberBand) return RectangleRubberBand;
223 206 if(m_horizonalRubberBand) return HorizonalRubberBand;
224 207 if(m_verticalRubberBand) return VerticalRubberBand;
225 208 return NoRubberBand;
226 209 }
227 210
228 211 /*!
229 212 If Left mouse button is pressed and the RubberBandPolicy is enabled the \a event is accepted and the rubber band is displayed on the screen allowing the user to select the zoom area.
230 213 If different mouse button is pressed and/or the RubberBandPolicy is disabled then the \a event is passed to QGraphicsView::mousePressEvent() implementation.
231 214 */
232 215 void QChartView::mousePressEvent(QMouseEvent *event)
233 216 {
234 217 if(m_rubberBand && m_rubberBand->isEnabled() && event->button() == Qt::LeftButton) {
235 218
236 219 int margin = m_chart->margin();
237 220 QRect rect(margin, margin, width() - 2 * margin, height() - 2 * margin);
238 221
239 222 if (rect.contains(event->pos())) {
240 223 m_rubberBandOrigin = event->pos();
241 224 m_rubberBand->setGeometry(QRect(m_rubberBandOrigin, QSize()));
242 225 m_rubberBand->show();
243 226 event->accept();
244 227 }
245 228 }
246 229 else {
247 230 QGraphicsView::mousePressEvent(event);
248 231 }
249 232 }
250 233
251 234 /*!
252 235 If RubberBand rectange specification has been initiated in pressEvent then \a event data is used to update RubberBand geometry.
253 236 In other case the defualt QGraphicsView::mouseMoveEvent implementation is called.
254 237 */
255 238 void QChartView::mouseMoveEvent(QMouseEvent *event)
256 239 {
257 240 if(m_rubberBand && m_rubberBand->isVisible()) {
258 241 int margin = m_chart->margin();
259 242 QRect rect(margin, margin, width() - 2 * margin, height() - 2 * margin);
260 243 int width = event->pos().x() - m_rubberBandOrigin.x();
261 244 int height = event->pos().y() - m_rubberBandOrigin.y();
262 245 if(!m_verticalRubberBand) {
263 246 m_rubberBandOrigin.setY(rect.top());
264 247 height = rect.height();
265 248 }
266 249 if(!m_horizonalRubberBand) {
267 250 m_rubberBandOrigin.setX(rect.left());
268 251 width= rect.width();
269 252 }
270 253 m_rubberBand->setGeometry(QRect(m_rubberBandOrigin.x(),m_rubberBandOrigin.y(), width,height).normalized());
271 254 }
272 255 else {
273 256 QGraphicsView::mouseMoveEvent(event);
274 257 }
275 258 }
276 259
277 260 /*!
278 261 If left mouse button is release and RubberBand is enabled then \a event is accepted and the view is zoomed in to rect specified by RubberBand
279 262 If it is the right mouse button \a event then RubberBand is dissmissed and zoom is canceled.
280 263 */
281 264 void QChartView::mouseReleaseEvent(QMouseEvent *event)
282 265 {
283 266 if(m_rubberBand) {
284 267 if (event->button() == Qt::LeftButton && m_rubberBand->isVisible()) {
285 268 m_rubberBand->hide();
286 269 QRect rect = m_rubberBand->geometry();
287 270 m_chart->zoomIn(rect);
288 271 event->accept();
289 272 }
290 273
291 274 if(event->button()==Qt::RightButton)
292 275 m_chart->zoomReset();
293 276 }
294 277 else {
295 278 QGraphicsView::mouseReleaseEvent(event);
296 279 }
297 280 }
298 281
299 282 /*!
300 283 Pressing + and - keys performs zoomIn() and zoomOut() respectivly.
301 284 In other \a event is passed to the QGraphicsView::keyPressEvent() implementation
302 285 */
303 286 void QChartView::keyPressEvent(QKeyEvent *event)
304 287 {
305 288 switch (event->key()) {
306 289 case Qt::Key_Plus:
307 290 zoomIn();
308 291 break;
309 292 case Qt::Key_Minus:
310 293 zoomOut();
311 294 break;
312 295 default:
313 296 QGraphicsView::keyPressEvent(event);
314 297 break;
315 298 }
316 299 }
317 300
318 301 /*!
319 302 Sets the \a theme used by the chart for rendering the graphical representation of the data
320 303 \sa QChart::ChartTheme, chartTheme()
321 304 */
322 305 void QChartView::setChartTheme(QChart::ChartTheme theme)
323 306 {
324 307 m_chart->setChartTheme(theme);
325 308 }
326 309
327 310 /*!
328 311 Returns the theme enum used by the chart.
329 312 \sa setChartTheme()
330 313 */
331 314 QChart::ChartTheme QChartView::chartTheme() const
332 315 {
333 316 return m_chart->chartTheme();
334 317 }
335 318
336 319 /*!
337 320 Returns the pointer to the x axis object of the chart
338 321 */
339 322 QChartAxis* QChartView::axisX() const
340 323 {
341 324 return m_chart->axisX();
342 325 }
343 326
344 327 /*!
345 328 Returns the pointer to the y axis object of the chart
346 329 */
347 330 QChartAxis* QChartView::axisY() const
348 331 {
349 332 return m_chart->axisY();
350 333 }
351 334
352 335 /*!
353 336 Sets animation \a options for the chart
354 337 */
355 338 void QChartView::setAnimationOptions(QChart::AnimationOptions options)
356 339 {
357 340 m_chart->setAnimationOptions(options);
358 341 }
359 342
360 343 /*!
361 344 Returns animation options for the chart
362 345 */
363 346 QChart::AnimationOptions QChartView::animationOptions() const
364 347 {
365 348 return m_chart->animationOptions();
366 349 }
367 350
368 351 QTCOMMERCIALCHART_END_NAMESPACE
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now