##// END OF EJS Templates
Refactor documentation...
Michal Klocek -
r331:711d530eb260
parent child
Show More
@@ -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,12
1 1 /*!
2 2 \page index.html
3 \title QtCommercial Charts
4 \keyword All Classes
5
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>
3 \title About QCharts
4 \keyword About
5
6 \raw HTML
7 <div class="qchart">
8 <img src="images/qt_commercial_logo.png" alt="qtcommercial"/>
9 <p>QCharts is a part of Qt Commercial addons package.</p>
10 </div>
49 11 \endraw
50
51 12 */
@@ -1,673 +1,695
1 1 @media screen
2 2 {
3 3
4 .qchart img
5 {
6 float:left;
7 }
8
4 9 /* basic elements */
5 10 html
6 11 {
7 12 color: #000000;
8 13 background: #FFFFFF;
9 14 }
10 15 table
11 16 {
12 17 border-collapse: collapse;
13 18 border-spacing: 0;
14 19 }
15 20 fieldset, img
16 21 {
17 22 border: 0;
18 23 max-width:100%;
19 24 }
20 25 address, caption, cite, code, dfn, em, strong, th, var, optgroup
21 26 {
22 27 font-style: inherit;
23 28 font-weight: inherit;
24 29 }
25 30 del, ins
26 31 {
27 32 text-decoration: none;
28 33 }
29 34 li
30 35 {
31 36 list-style: none;
32 37 }
33 38 ol li
34 39 {
35 40 list-style: decimal;
36 41 }
37 42 caption, th
38 43 {
39 44 text-align: left;
40 45 }
41 46 h1, h2, h3, h4, h5, h6
42 47 {
43 48 font-size: 100%;
44 49 }
45 50 q:before, q:after
46 51 {
47 52 content: '';
48 53 }
49 54 abbr, acronym
50 55 {
51 56 border: 0;
52 57 font-variant: normal;
53 58 }
54 59 sup, sub
55 60 {
56 61 vertical-align: baseline;
57 62 }
58 63 tt, .qmlreadonly span, .qmldefault span
59 64 {
60 65 word-spacing:0.5em;
61 66 }
62 67 legend
63 68 {
64 69 color: #000000;
65 70 }
66 71 strong
67 72 {
68 73 font-weight: bold;
69 74 }
70 75 em
71 76 {
72 77 font-style: italic;
73 78 }
74 79
75 80 body
76 81 {
77 82 margin-left: 0.5em;
78 83 margin-right: 0.5em;
79 84 }
80 85 a
81 86 {
82 87 color: #00732F;
83 88 text-decoration: none;
84 89 }
85 90 hr
86 91 {
87 92 background-color: #E6E6E6;
88 93 border: 1px solid #E6E6E6;
89 94 height: 1px;
90 95 width: 100%;
91 96 text-align: left;
92 97 margin: 1.5em 0 1.5em 0;
93 98 }
94 99
95 100 pre
96 101 {
97 102 border: 1px solid #DDDDDD;
98 103 -moz-border-radius: 0.7em 0.7em 0.7em 0.7em;
99 104 -webkit-border-radius: 0.7em 0.7em 0.7em 0.7em;
100 105 border-radius: 0.7em 0.7em 0.7em 0.7em;
101 106 margin: 0 1.5em 1em 1em;
102 107 padding: 1em 1em 1em 1em;
103 108 overflow-x: auto;
104 109 }
105 110 table, pre
106 111 {
107 112 -moz-border-radius: 0.7em 0.7em 0.7em 0.7em;
108 113 -webkit-border-radius: 0.7em 0.7em 0.7em 0.7em;
109 114 border-radius: 0.7em 0.7em 0.7em 0.7em;
110 115 background-color: #F6F6F6;
111 116 border: 1px solid #E6E6E6;
112 117 border-collapse: separate;
113 118 margin-bottom: 2.5em;
114 119 }
115 120 pre {
116 121 font-size: 90%;
117 122 display: block;
118 123 overflow:hidden;
119 124 }
120 125 thead
121 126 {
122 127 margin-top: 0.5em;
123 128 font-weight: bold
124 129 }
125 130 th
126 131 {
127 132 padding: 0.5em 1.5em 0.5em 1.5em;
128 133 background-color: #E1E1E1;
129 134 border-left: 1px solid #E6E6E6;
130 135 }
131 136 td
132 137 {
133 138 padding: 0.25em 1.5em 0.25em 2em;
134 139 }
135 140
136 141 td.rightAlign
137 142 {
138 143 padding: 0.25em 0.5em 0.25em 1em;
139 144 }
140 145 table tr.odd
141 146 {
142 147 border-left: 1px solid #E6E6E6;
143 148 background-color: #F6F6F6;
144 149 color: #66666E;
145 150 }
146 151 table tr.even
147 152 {
148 153 border-left: 1px solid #E6E6E6;
149 154 background-color: #ffffff;
150 155 color: #66666E;
151 156 }
152 157
153 158 div.float-left
154 159 {
155 160 float: left; margin-right: 2em
156 161 }
157 162 div.float-right
158 163 {
159 164 float: right; margin-left: 2em
160 165 }
161 166
162 167 span.comment
163 168 {
164 169 color: #008B00;
165 170 font-style: italic
166 171 }
167 172 span.string, span.char
168 173 {
169 174 color: #000084;
170 175 }
171 176 span.number
172 177 {
173 178 color: #a46200;
174 179 }
175 180 span.operator
176 181 {
177 182 color: #202020;
178 183 }
179 184 span.keyword
180 185 {
181 186 color: #840000;
182 187 }
183 188 span.name
184 189 {
185 190 color: black
186 191 }
187 192 span.type
188 193 {
189 194 font-weight: bold
190 195 }
191 196 span.type a:visited
192 197 {
193 198 color: #0F5300;
194 199 }
195 200 span.preprocessor
196 201 {
197 202 color: #404040
198 203 }
199 204 /* end basic elements */
200 205
201 206 /* font style elements */
202 207 .heading
203 208 {
204 209 font-weight: bold;
205 210 font-size: 125%;
206 211 }
207 212 .subtitle
208 213 {
209 214 font-size: 110%
210 215 }
211 216 .small-subtitle
212 217 {
213 218 font-size: 100%
214 219 }
215 220 .red
216 221 {
217 222 color:red;
218 223 }
219 224 /* end font style elements */
220 225
221 226 /* global settings*/
222 227 .header, .footer
223 228 {
224 229 display: block;
225 230 clear: both;
226 231 overflow: hidden;
227 232 }
228 233 /* end global settings*/
229 234
230 235 /* header elements */
231 236 .header .qtref
232 237 {
233 238 color: #00732F;
234 239 font-weight: bold;
235 font-size: 130%;
240 font-size: 100%;
241 text-align: center;
236 242 }
237 243
238 244 .header .content
239 245 {
240 margin-bottom: 0.5em
246 /* margin-bottom: 0.5em*/
241 247 }
242 248
249 .header .content img
250 {
251 display: block;
252 margin-left: auto;
253 margin-right: auto;
254 width: 100px;
255 }
256
243 257 .naviNextPrevious
244 258 {
245 259 display: none
246 260 }
247 261 .header .breadcrumb
248 262 {
249 font-size: 90%;
263 font-size: 100%;
250 264 padding: 0.5em 0 0.5em 1em;
251 265 margin: 0;
252 background-color: #fafafa;
253 height: 1.35em;
266 /*background-color: #393735;*/
267 font-weight: bold;
268 background: #ffffff url(../images/bg.png) repeat-x;
269 height: 20px;
254 270 border-bottom: 1px solid #d1d1d1;
255 271 }
256 272
257 273 .header .breadcrumb ul
258 274 {
259 275 margin: 0;
260 276 padding: 0;
261 277 }
262 278
263 279 .header .content
264 280 {
265 281 word-wrap: break-word;
266 282 }
267 283
268 284 .header .breadcrumb ul li
269 285 {
270 286 float: left;
271 background: url(../images/breadcrumb.png) no-repeat 0 3px;
287 /*background: url(../images/breadcrumb.png) no-repeat 0 3px;*/
272 288 padding-left: 1.5em;
273 289 margin-left: 1.5em;
274 290 }
275 291
276 292 .header .breadcrumb ul li.last
277 293 {
278 294 font-weight: normal;
279 295 }
280 296
281 297 .header .breadcrumb ul li a
282 298 {
283 color: #00732F;
299 color: #ffffff;
284 300 }
285 301
302 .header .breadcrumb ul li a:hover
303 {
304 color: #00732F;
305 text-decoration: none;
306 }
307
286 308 .header .breadcrumb ul li.first
287 309 {
288 310 background-image: none;
289 311 padding-left: 0;
290 312 margin-left: 0;
291 313 }
292 314
293 315 .header .content ol li {
294 316 background: none;
295 317 margin-bottom: 1.0em;
296 318 margin-left: 1.2em;
297 319 padding-left: 0
298 320 }
299 321
300 322 .header .content li
301 323 {
302 324 background: url(../images/bullet_sq.png) no-repeat 0 5px;
303 325 margin-bottom: 1em;
304 326 padding-left: 1.2em;
305 327 }
306 328
307 329 /* end header elements */
308 330
309 331 /* content elements */
310 332 .content h1
311 333 {
312 334 font-weight: bold;
313 335 font-size: 150%
314 336 }
315 337
316 338 .content h2
317 339 {
318 340 font-weight: bold;
319 341 font-size: 135%;
320 342 width: 100%;
321 343 }
322 344 .content h3
323 345 {
324 346 font-weight: bold;
325 347 font-size: 120%;
326 348 width: 100%;
327 349 }
328 350 .content table p
329 351 {
330 352 margin: 0
331 353 }
332 354 .content ul
333 355 {
334 356 padding-left: 2.5em;
335 357 }
336 358 .content li
337 359 {
338 360 padding-top: 0.25em;
339 361 padding-bottom: 0.25em;
340 362 }
341 363 .content ul img {
342 364 vertical-align: middle;
343 365 }
344 366
345 367 .content a:visited
346 368 {
347 369 color: #4c0033;
348 370 text-decoration: none;
349 371 }
350 372
351 373 .content a:visited:hover
352 374 {
353 375 color: #4c0033;
354 376 text-decoration: underline;
355 377 }
356 378
357 379 a:hover
358 380 {
359 381 color: #4c0033;
360 382 text-decoration: underline;
361 383 }
362 384 descr p a
363 385 {
364 386 text-decoration: underline;
365 387 }
366 388
367 389 .descr p a:visited
368 390 {
369 391 text-decoration: underline;
370 392 }
371 393
372 394 .alphaChar{
373 395 width:95%;
374 396 background-color:#F6F6F6;
375 397 border:1px solid #E6E6E6;
376 398 -moz-border-radius: 7px 7px 7px 7px;
377 399 border-radius: 7px 7px 7px 7px;
378 400 -webkit-border-radius: 7px 7px 7px 7px;
379 401 font-size:12pt;
380 402 padding-left:10px;
381 403 margin-top:10px;
382 404 margin-bottom:10px;
383 405 }
384 406 .flowList{
385 407 /*vertical-align:top;*/
386 408 /*margin:20px auto;*/
387 409
388 410 column-count:3;
389 411 -webkit-column-count:3;
390 412 -moz-column-count:3;
391 413 /*
392 414 column-width:100%;
393 415 -webkit-column-width:200px;
394 416 -col-column-width:200px;
395 417 */
396 418 column-gap:41px;
397 419 -webkit-column-gap:41px;
398 420 -moz-column-gap:41px;
399 421
400 422 column-rule: 1px dashed #ccc;
401 423 -webkit-column-rule: 1px dashed #ccc;
402 424 -moz-column-rule: 1px dashed #ccc;
403 425 }
404 426
405 427 .flowList dl{
406 428 }
407 429 .flowList dd{
408 430 /*display:inline-block;*/
409 431 margin-left:10px;
410 432 min-width:250px;
411 433 line-height: 1.5;
412 434 min-width:100%;
413 435 min-height:15px;
414 436 }
415 437
416 438 .flowList dd a{
417 439 }
418 440
419 441 .content .flowList p{
420 442 padding:0px;
421 443 }
422 444
423 445 .content .alignedsummary
424 446 {
425 447 margin: 15px;
426 448 }
427 449
428 450
429 451 .qmltype
430 452 {
431 453 text-align: center;
432 454 font-size: 120%;
433 455 }
434 456 .qmlreadonly
435 457 {
436 458 padding-left: 5px;
437 459 float: right;
438 460 color: #254117;
439 461 }
440 462
441 463 .qmldefault
442 464 {
443 465 padding-left: 5px;
444 466 float: right;
445 467 color: red;
446 468 }
447 469
448 470 .qmldoc
449 471 {
450 472 }
451 473
452 474 .generic .alphaChar{
453 475 margin-top:5px;
454 476 }
455 477
456 478 .generic .odd .alphaChar{
457 479 background-color: #F6F6F6;
458 480 }
459 481
460 482 .generic .even .alphaChar{
461 483 background-color: #FFFFFF;
462 484 }
463 485
464 486 .memItemRight{
465 487 padding: 0.25em 1.5em 0.25em 0;
466 488 }
467 489 .highlightedCode
468 490 {
469 491 margin: 1.0em;
470 492 }
471 493 .annotated td {
472 494 padding: 0.25em 0.5em 0.25em 0.5em;
473 495 }
474 496
475 497 .header .content .toc ul
476 498 {
477 499 padding-left: 0px;
478 500 }
479 501
480 502 .content .toc h3 {
481 503 border-bottom: 0px;
482 margin-top: 0px;
504 margin-top: 10px;
483 505 }
484 506
485 507 .content .toc h3 a:hover {
486 508 color: #00732F;
487 509 text-decoration: none;
488 510 }
489 511
490 512 .content .toc .level2
491 513 {
492 514 margin-left: 1.5em;
493 515 }
494 516
495 517 .content .toc .level3
496 518 {
497 519 margin-left: 3.0em;
498 520 }
499 521
500 522 .content ul li
501 523 {
502 524 background: url(../images/bullet_sq.png) no-repeat 0 0.7em;
503 525 padding-left: 1em
504 526 }
505 527
506 528 .content .toc li
507 529 {
508 530 background: url(../images/bullet_dn.png) no-repeat 0 5px;
509 531 padding-left: 1em
510 532 }
511 533
512 534 .relpage
513 535 {
514 536 -moz-border-radius: 7px 7px 7px 7px;
515 537 -webkit-border-radius: 7px 7px 7px 7px;
516 538 border-radius: 7px 7px 7px 7px;
517 539 border: 1px solid #DDDDDD;
518 540 padding: 25px 25px;
519 541 clear: both;
520 542 }
521 543 .relpage ul
522 544 {
523 545 float: none;
524 546 padding: 1.5em;
525 547 }
526 548
527 549 h3.fn, span.fn
528 550 {
529 551 -moz-border-radius:7px 7px 7px 7px;
530 552 -webkit-border-radius:7px 7px 7px 7px;
531 553 border-radius:7px 7px 7px 7px;
532 554 background-color: #F6F6F6;
533 555 border-width: 1px;
534 556 border-style: solid;
535 557 border-color: #E6E6E6;
536 558 font-weight: bold;
537 559 word-spacing:3px;
538 560 padding:3px 5px;
539 561 }
540 562
541 563 .functionIndex {
542 564 font-size:12pt;
543 565 word-spacing:10px;
544 566 margin-bottom:10px;
545 567 background-color: #F6F6F6;
546 568 border-width: 1px;
547 569 border-style: solid;
548 570 border-color: #E6E6E6;
549 571 -moz-border-radius: 7px 7px 7px 7px;
550 572 -webkit-border-radius: 7px 7px 7px 7px;
551 573 border-radius: 7px 7px 7px 7px;
552 574 width:100%;
553 575 }
554 576
555 577 .centerAlign
556 578 {
557 579 text-align:center;
558 580 }
559 581
560 582 .rightAlign
561 583 {
562 584 text-align:right;
563 585 }
564 586
565 587 .leftAlign
566 588 {
567 589 text-align:left;
568 590 }
569 591
570 592 .topAlign{
571 593 vertical-align:top
572 594 }
573 595
574 596 .functionIndex a{
575 597 display:inline-block;
576 598 }
577 599
578 600 /* end content elements */
579 601 /* footer elements */
580 602
581 603 .footer
582 604 {
583 605 color: #393735;
584 606 font-size: 0.75em;
585 607 text-align: center;
586 608 padding-top: 1.5em;
587 609 padding-bottom: 1em;
588 610 background-color: #E6E7E8;
589 611 margin: 0;
590 612 }
591 613 .footer p
592 614 {
593 615 margin: 0.25em
594 616 }
595 617 .small
596 618 {
597 619 font-size: 0.5em;
598 620 }
599 621 /* end footer elements */
600 622
601 623 .item {
602 624 float: left;
603 625 position: relative;
604 626 width: 100%;
605 627 overflow: hidden;
606 628 }
607 629
608 630
609 631 .item .primary {
610 632 margin-right: 220px;
611 633 position: relative;
612 634 }
613 635
614 636 .item hr {
615 637 margin-left: -220px;
616 638 }
617 639
618 640 .item .secondary {
619 641 float: right;
620 642 width: 200px;
621 643 position: relative;
622 644 }
623 645
624 646 .item .cols {
625 647 clear: both;
626 648 display: block;
627 649 }
628 650
629 651 .item .cols .col {
630 652 float: left;
631 653 margin-left: 1.5%;
632 654 }
633 655
634 656 .item .cols .col.first {
635 657 margin-left: 0;
636 658 }
637 659
638 660 .item .cols.two .col {
639 661 width: 45%;
640 662 }
641 663
642 664 .item .box {
643 665 margin: 0 0 10px 0;
644 666 }
645 667
646 668 .item .box h3 {
647 669 margin: 0 0 10px 0;
648 670 }
649 671
650 672 .cols.unclear {
651 673 clear:none;
652 674 }
653 675 }
654 676
655 677 /* end of screen media */
656 678
657 679 /* start of print media */
658 680
659 681 @media print
660 682 {
661 683 input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft, #feedbackBox, #blurpage, .toc, .breadcrumb, .toolbar, .floatingResult
662 684 {
663 685 display: none;
664 686 background: none;
665 687 }
666 688 .content
667 689 {
668 690 background: none;
669 691 display: block;
670 692 width: 100%; margin: 0; float: none;
671 693 }
672 694 }
673 695 /* end of print media */
@@ -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,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 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,296
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 QPen QChartAxis::axisPen() const
19 \brief Returns pen used to draw axis and ticks.
20 \sa setAxisPen()
21 */
22
23 /*!
24 \fn QPen QChartAxis::gridPen() const
25 \brief Returns pen used to draw grid.
26 \sa setGridPen()
27 */
28
29 /*!
30 \fn QPen QChartAxis::labelsPen() const
31 \brief Returns the pen used to labels.
32 \sa setLabelsPen()
33 */
34
35 /*!
36 \fn QBrush QChartAxis::labelsBrush() const
37 \brief Returns brush used to draw labels.
38 \sa setLabelsBrush()
39 */
40
41 /*!
42 \fn QFont QChartAxis::labelsFont() const
43 \brief Returns font used to draw labels.
44 \sa setLabelsFont()
45 */
46
47 /*!
48 \fn QFont QChartAxis::labelsAngle() const
49 \brief Returns angle used to draw labels.
50 \sa setLabelsAngle()
51 */
52
53 /*!
54 \fn QPen QChartAxis::shadesPen() const
55 \brief Returns pen used to draw shades.
56 \sa setShadesPen()
57 */
58
59 /*!
60 \fn QBrush QChartAxis::shadesBrush() const
61 \brief Returns brush used to draw shades.
62 \sa setShadesBrush()
63 */
64
65 /*!
66 \fn void QChartAxis::update(QChartAxis*)
67 \brief \internal
68 */
69
70 /*!
71 \fn void QChartAxis::ticksChanged(QChartAxis*)
72 \brief \internal
73 */
74
75 /*!
76 Constructs new axis object which is a child of \a parent. Ownership is taken by
77 QChatView or QChart when axis added.
78 */
79
5 80 QChartAxis::QChartAxis(QObject* parent):QObject(parent),
6 81 m_axisVisible(true),
7 82 m_gridVisible(true),
8 83 m_labelsVisible(true),
9 84 m_labelsAngle(0),
10 85 m_shadesVisible(true),
11 86 m_shadesOpacity(1.0),
12 87 m_min(0),
13 88 m_max(0),
14 89 m_ticksCount(5)
15 90 {
16 91
17 92 }
18 93
94 /*!
95 Destructor of the axis object. When axis is added to chart, chart object takes ownership.
96 */
97
19 98 QChartAxis::~QChartAxis()
20 99 {
21 100 }
22 101
102 /*!
103 Sets \a pen used to draw axis line and ticks.
104 */
23 105 void QChartAxis::setAxisPen(const QPen& pen)
24 106 {
25 107 m_axisPen=pen;
26 108 emit update(this);
27 109 }
28 110
111 /*!
112 Sets if axis and ticks are \a visible.
113 */
29 114 void QChartAxis::setAxisVisible(bool visible)
30 115 {
31 116 m_axisVisible=visible;
32 117 emit update(this);
33 118 }
34 119
120 /*!
121 Sets if grid is \a visible.
122 */
35 123 void QChartAxis::setGridVisible(bool visible)
36 124 {
37 125 m_gridVisible=visible;
38 126 emit update(this);
39 127 }
40 128
129 /*!
130 Sets \a pen used to draw grid.
131 */
41 132 void QChartAxis::setGridPen(const QPen& pen)
42 133 {
43 134 m_gridPen=pen;
44 135 emit update(this);
45 136 }
46 137
138 /*!
139 Sets if axis' labels are \a visible.
140 */
47 141 void QChartAxis::setLabelsVisible(bool visible)
48 142 {
49 143 m_labelsVisible=visible;
50 144 emit update(this);
51 145 }
52 146
147 /*!
148 Sets \a pen used to draw labels.
149 */
53 150 void QChartAxis::setLabelsPen(const QPen& pen)
54 151 {
55 152 m_labelsPen=pen;
56 153 emit update(this);
57 154 }
58 155
156 /*!
157 Sets \a brush used to draw labels.
158 */
59 159 void QChartAxis::setLabelsBrush(const QBrush& brush)
60 160 {
61 161 m_labelsBrush=brush;
62 162 emit update(this);
63 163 }
64 164
165 /*!
166 Sets \a font used to draw labels.
167 */
65 168 void QChartAxis::setLabelsFont(const QFont& font)
66 169 {
67 170 m_labelsFont=font;
68 171 emit update(this);
69 172 }
70 173
174 /*!
175 Sets \a angle for all the labels on given axis.
176 */
71 177 void QChartAxis::setLabelsAngle(int angle)
72 178 {
73 179 m_labelsAngle=angle;
74 180 emit update(this);
75 181 }
76 182
183 /*!
184 Sets if shades are \a visible.
185 */
77 186 void QChartAxis::setShadesVisible(bool visible)
78 187 {
79 188 m_shadesVisible=visible;
80 189 emit update(this);
81 190 }
82 191
192 /*!
193 Sets \a pen used to draw shades.
194 */
83 195 void QChartAxis::setShadesPen(const QPen& pen)
84 196 {
85 197 m_shadesPen=pen;
86 198 emit update(this);
87 199 }
88 200
201 /*!
202 Sets \a brush used to draw shades.
203 */
89 204 void QChartAxis::setShadesBrush(const QBrush& brush)
90 205 {
91 206 m_shadesBrush=brush;
92 207 emit update(this);
93 208 }
94 209
210 /*!
211 Sets \a opacity of the shades.
212 */
95 213 void QChartAxis::setShadesOpacity(qreal opacity)
96 214 {
97 215 m_shadesOpacity=opacity;
98 216 emit update(this);
99 217 }
100 218
219 /*!
220 Sets \a min value on the axis.
221 */
101 222 void QChartAxis::setMin(qreal min)
102 223 {
103 224 if(m_min!=min){
104 225 m_min=min;
105 226 emit minChanged(m_min);
106 227 }
107 228 }
108 229
230 /*!
231 Sets \a max value on the axis.
232 */
109 233 void QChartAxis::setMax(qreal max)
110 234 {
111 235 if(m_max!=max){
112 236 m_max=max;
113 237 emit maxChanged(m_max);
114 238 }
115 239 }
116 240
241 /*!
242 Sets range from \a min to \a max on the axis.
243 */
117 244 void QChartAxis::setRange(qreal min, qreal max)
118 245 {
119 246 setMin(min);
120 247 setMax(max);
121 248 }
122 249
250 /*!
251 Sets \a count for ticks on the axis.
252 */
123 253 void QChartAxis::setTicksCount(int count)
124 254 {
125 255 m_ticksCount=count;
126 256 emit ticksChanged(this);
127 257 }
128 258
259 /*!
260 TODO: refactor me. Sets string \a label for \a value on the axis.
261 */
129 262 void QChartAxis::addAxisTickLabel(qreal value,const QString& label)
130 263 {
131 264 m_ticks.insert(value,label);
132 265 emit ticksChanged(this);
133 266 }
134 267
268 /*!
269 TODO: refactor me. Removes label for \a value on the axis.
270 */
135 271 void QChartAxis::removeAxisTickLabel(qreal value)
136 272 {
137 273 m_ticks.remove(value);
138 274 emit ticksChanged(this);
139 275 }
140 276
277 /*!
278 TODO: refactor me. Returns label for \a value on the axis.
279 */
141 280 QString QChartAxis::axisTickLabel(qreal value) const
142 281 {
143 282 return m_ticks.value(value);
144 283 }
145 284
285 /*!
286 TODO: refactor me. Removes all the string labels for on the axis.
287 */
146 288 void QChartAxis::clearAxisTickLabels()
147 289 {
148 290 m_ticks.clear();
149 291 emit ticksChanged(this);
150 292 }
151 293
152 294 #include "moc_qchartaxis.cpp"
153 295
154 296 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 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
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now