##// END OF EJS Templates
Added missing properties to QAxis
Tero Ahola -
r1449:e88bf0c8e17d
parent child
Show More
@@ -9,6 +9,7
9 9 <ul>
10 10 <li><a href="qml-chartview.html">ChartView</a></li>
11 11 <li><a href="qml-pieseries.html">PieSeries</a></li>
12 <li><a href="qml-axis.html">Axis</a></li>
12 13 </ul>
13 14 \endraw
14 15 */
@@ -310,7 +310,7 void ChartAxis::handleAxisUpdated()
310 310 }
311 311
312 312 if (m_chartAxis->shadesVisible()) {
313 setShadesOpacity(m_chartAxis->shadesOpacity());
313 setShadesOpacity(100);
314 314 } else {
315 315 setShadesOpacity(0);
316 316 }
@@ -30,151 +30,217 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 30 \mainclass
31 31
32 32 There is only one x Axis, however there can be multiple y axes.
33 Each chart series can be bound to exactly one Y axis and the share common X axis.
34 Axis can be setup to show axis line with ticks, gird lines and shades.
33 Each chart series can be bound to exactly one Y axis and the shared common X axis.
34 Axis can be setup to show axis line with tick marks, grid lines and shades.
35 */
36
37 /*!
38 \qmlclass Axis QAxis
39 \brief The Axis element is used for manipulating chart's axes
35 40
41 There is only one x Axis, however there can be multiple y axes on a ChartView.
42 Each chart series can be bound to exactly one Y axis and the shared common X axis.
43 Axis can be setup to show axis line with tick marks, grid lines and shades.
36 44 */
37 45
38 46 /*!
39 47 \property QAxis::labelsVisible
40
48 Defines if axis labels are visible.
49 */
50 /*!
51 \qmlproperty bool Axis::labelsVisible
41 52 Defines if axis labels are visible.
42 53 */
43 54
44 55 /*!
45 56 \property QAxis::min
46
57 Defines the minimum value on the axis.
58 */
59 /*!
60 \qmlproperty real Axis::min
47 61 Defines the minimum value on the axis.
48 62 */
49 63
50 64 /*!
51 65 \property QAxis::max
52
66 Defines the maximum value on the axis.
67 */
68 /*!
69 \qmlproperty real Axis::max
53 70 Defines the maximum value on the axis.
54 71 */
55 72
56 73 /*!
57 \fn bool QAxis::isAxisVisible() const
58 \brief Returns if axis is visible
59 \sa setAxisVisible()
74 \property QAxis::visible
75 The visibility of the axis.
76 */
77 /*!
78 \qmlproperty bool Axis::visible
79 The visibility of the axis.
60 80 */
61 81
62 82 /*!
63 \fn QPen QAxis::axisPen() const
64 \brief Returns pen used to draw axis and ticks.
65 \sa setAxisPen()
83 \property QAxis::gridVisible
84 The visibility of the grid lines.
85 */
86 /*!
87 \qmlproperty bool Axis::gridVisible
88 The visibility of the grid lines.
66 89 */
67 90
91 /*!
92 \property QAxis::color
93 The color of the axis and ticks.
94 */
95 /*!
96 \qmlproperty color Axis::color
97 The color of the axis and ticks.
98 */
68 99
69 100 /*!
70 \fn bool QAxis::isGridLineVisible() const
71 \brief Returns if grid is visible
72 \sa setGridLineVisible()
101 \property QAxis::labelsColor
102 The color of the axis labels.
103 */
104 /*!
105 \qmlproperty color Axis::labelsColor
106 The color of the axis labels.
73 107 */
74 108
75 109 /*!
76 \fn QPen QAxis::gridLinePen() const
77 \brief Returns pen used to draw grid.
78 \sa setGridLinePen()
110 \property QAxis::labelsAngle
111 The angle of the axis labels in degrees.
112 */
113 /*!
114 \qmlproperty int Axis::labelsAngle
115 The angle of the axis labels in degrees.
79 116 */
80 117
81 118 /*!
82 \fn QPen QAxis::labelsPen() const
83 \brief Returns the pen used to labels.
84 \sa setLabelsPen()
119 \property QAxis::shadesVisible
120 The visibility of the axis shades.
121 */
122 /*!
123 \qmlproperty bool Axis::shadesVisible
124 The visibility of the axis shades.
85 125 */
86 126
87 127 /*!
88 \fn QBrush QAxis::labelsBrush() const
89 \brief Returns brush used to draw labels.
90 \sa setLabelsBrush()
128 \property QAxis::shadesColor
129 The fill (brush) color of the axis shades.
130 */
131 /*!
132 \qmlproperty color Axis::shadesColor
133 The fill (brush) color of the axis shades.
91 134 */
92 135
93 136 /*!
94 \fn QFont QAxis::labelsFont() const
95 \brief Returns font used to draw labels.
96 \sa setLabelsFont()
137 \property QAxis::shadesBorderColor
138 The border (pen) color of the axis shades.
139 */
140 /*!
141 \qmlproperty color Axis::shadesBorderColor
142 The border (pen) color of the axis shades.
97 143 */
98 144
99 145 /*!
100 \fn QFont QAxis::labelsAngle() const
101 \brief Returns angle used to draw labels.
102 \sa setLabelsAngle()
146 \property QAxis::ticksCount
147 The number of tick marks for the axis.
148 */
149 /*!
150 \qmlproperty int Axis::ticksCount
151 The number of tick marks for the axis.
103 152 */
104 153
105 154 /*!
106 \fn bool QAxis::shadesVisible() const
107 \brief Returns if shades are visible.
108 \sa setShadesVisible()
155 \property QAxis::niceNumbersEnabled
156 Whether the nice numbers algorithm is enabled or not for the axis.
157 */
158 /*!
159 \qmlproperty bool Axis::niceNumbersEnabled
160 Whether the nice numbers algorithm is enabled or not for the axis.
109 161 */
110 162
111 163 /*!
112 \fn qreal QAxis::shadesOpacity() const
113 \brief Returns opacity of shades.
114 */
164 \fn void QAxis::visibleChanged(bool)
165 Visiblity of the axis has changed to \a visible.
166 */
115 167
116 168 /*!
117 \fn QPen QAxis::shadesPen() const
118 \brief Returns pen used to draw shades.
119 \sa setShadesPen()
169 \fn void QAxis::labelsVisibleChanged(bool)
170 Visiblity of the labels of the axis has changed to \a visible.
120 171 */
121 172
122 173 /*!
123 \fn QBrush QAxis::shadesBrush() const
124 \brief Returns brush used to draw shades.
125 \sa setShadesBrush()
174 \fn void QAxis::gridVisibleChanged(bool)
175 Visiblity of the grid lines of the axis has changed to \a visible.
176 */
177
178 /*!
179 \fn void QAxis::minChanged(qreal min)
180 Axis emits signal when \a min of axis has changed.
181 */
182
183 /*!
184 \fn void QAxis::maxChanged(qreal max)
185 Axis emits signal when \a max of axis has changed.
186 */
187
188 /*!
189 \fn void QAxis::rangeChanged(qreal min, qreal max)
190 Axis emits signal when \a min or \a max of axis has changed.
126 191 */
127 192
128 193 /*!
129 \fn qreal QAxis::min() const
130 \brief Returns minimum value on the axis.
131 \sa setMin()
194 \fn QChartAxisCategories* QAxis::categories()
195 Returns pointer to the list of categories which correspond to the values on the axis.
132 196 */
133 197
134 198 /*!
135 \fn qreal QAxis::max() const
136 \brief Returns maximim value on the axis.
137 \sa setMax()
199 \fn void QAxis::colorChanged(QColor)
200 Emitted if the \a color of the axis is changed.
138 201 */
139 202
140 203 /*!
141 \fn void QAxis::minChanged(qreal min)
142 \brief Axis emits signal when \a min of axis has changed.
204 \fn void QAxis::labelsColorChanged(QColor)
205 Emitted if the \a color of the axis labels is changed.
143 206 */
144 207
145 208 /*!
146 \fn void QAxis::maxChanged(qreal max)
147 \brief Axis emits signal when \a max of axis has changed.
209 \fn void QAxis::labelsAngleChanged(int)
210 Emitted if the \a angle of the axis labels is changed.
148 211 */
149 212
150 213 /*!
151 \fn void QAxis::rangeChanged(qreal min, qreal max)
152 \brief Axis emits signal when \a min or \a max of axis has changed.
214 \fn void QAxis::shadesVisibleChanged(bool)
215 Emitted if the visibility of the axis shades is changed to \a visible.
153 216 */
154 217
155 218 /*!
156 \fn int QAxis::ticksCount() const
157 \brief Return number of ticks on the axis
158 \sa setTicksCount()
219 \fn void QAxis::shadesColorChanged(QColor)
220 Emitted if the \a color of the axis shades is changed.
159 221 */
160 222
161 223 /*!
162 \fn QChartAxisCategories* QAxis::categories()
163 \brief Returns pointer to the list of categories which correspond to the values on the axis.
224 \fn void QAxis::shadesBorderColorChanged(QColor)
225 Emitted if the border \a color of the axis shades is changed.
164 226 */
165 227
166 228 /*!
167 \fn void QAxis::ticksCountChanged(int count)
168 \brief Emits the new \a count of ticks on the axis
169 Signal is emitted when the number of the ticks on the axis has been changed to a different value.
170 Parementer count\a count is the new number of ticks on the axis.
229 \fn void QAxis::ticksCountChanged(int count)
230 \brief Emits the new \a count of ticks on the axis
231 Signal is emitted when the number of the ticks on the axis has been changed to a different value.
232 Parementer count\a count is the new number of ticks on the axis.
171 233 */
172 234
173 235 /*!
174 Constructs new axis object which is a child of \a parent. Ownership is taken by
175 QChart when axis added.
236 \fn void QAxis::niceNumbersEnabledChanged(bool)
237 Nice numbers algorithm was \a enabled or disabled.
176 238 */
177 239
240 /*!
241 Constructs new axis object which is a child of \a parent. Ownership is taken by
242 QChart when axis added.
243 */
178 244 QAxis::QAxis(QObject *parent) : QObject(parent),
179 245 d_ptr(new QAxisPrivate(this))
180 246 {
@@ -182,7 +248,7 d_ptr(new QAxisPrivate(this))
182 248 }
183 249
184 250 /*!
185 Destructor of the axis object. When axis is added to chart, chart object takes ownership.
251 Destructor of the axis object. When axis is added to chart, chart object takes ownership.
186 252 */
187 253
188 254 QAxis::~QAxis()
@@ -200,11 +266,29 void QAxis::setAxisPen(const QPen &pen)
200 266 }
201 267 }
202 268
269 /*!
270 Returns pen used to draw axis and ticks.
271 */
203 272 QPen QAxis::axisPen() const
204 273 {
205 274 return d_ptr->m_axisPen;
206 275 }
207 276
277 void QAxis::setAxisPenColor(QColor color)
278 {
279 QPen p = d_ptr->m_axisPen;
280 if (p.color() != color) {
281 p.setColor(color);
282 setAxisPen(p);
283 emit colorChanged(color);
284 }
285 }
286
287 QColor QAxis::axisPenColor() const
288 {
289 return d_ptr->m_axisPen.color();
290 }
291
208 292 /*!
209 293 Sets if axis and ticks are \a visible.
210 294 */
@@ -213,6 +297,7 void QAxis::setAxisVisible(bool visible)
213 297 if (d_ptr->m_axisVisible != visible) {
214 298 d_ptr->m_axisVisible = visible;
215 299 emit d_ptr->updated();
300 emit visibleChanged(visible);
216 301 }
217 302 }
218 303
@@ -221,14 +306,12 bool QAxis::isAxisVisible() const
221 306 return d_ptr->m_axisVisible;
222 307 }
223 308
224 /*!
225 Sets if grid line is \a visible.
226 */
227 309 void QAxis::setGridLineVisible(bool visible)
228 310 {
229 311 if (d_ptr->m_gridLineVisible != visible) {
230 312 d_ptr->m_gridLineVisible = visible;
231 313 emit d_ptr->updated();
314 emit gridVisibleChanged(visible);
232 315 }
233 316 }
234 317
@@ -236,9 +319,10 bool QAxis::isGridLineVisible() const
236 319 {
237 320 return d_ptr->m_gridLineVisible;
238 321 }
322
239 323 /*!
240 324 Sets \a pen used to draw grid line.
241 */
325 */
242 326 void QAxis::setGridLinePen(const QPen &pen)
243 327 {
244 328 if (d_ptr->m_gridLinePen != pen) {
@@ -247,6 +331,9 void QAxis::setGridLinePen(const QPen &pen)
247 331 }
248 332 }
249 333
334 /*!
335 Returns pen used to draw grid.
336 */
250 337 QPen QAxis::gridLinePen() const
251 338 {
252 339 return d_ptr->m_gridLinePen;
@@ -257,6 +344,7 void QAxis::setLabelsVisible(bool visible)
257 344 if (d_ptr->m_labelsVisible != visible) {
258 345 d_ptr->m_labelsVisible = visible;
259 346 emit d_ptr->updated();
347 emit labelsVisibleChanged(visible);
260 348 }
261 349 }
262 350
@@ -264,9 +352,10 bool QAxis::labelsVisible() const
264 352 {
265 353 return d_ptr->m_labelsVisible;
266 354 }
355
267 356 /*!
268 357 Sets \a pen used to draw labels.
269 */
358 */
270 359 void QAxis::setLabelsPen(const QPen &pen)
271 360 {
272 361 if (d_ptr->m_labelsPen != pen) {
@@ -275,6 +364,9 void QAxis::setLabelsPen(const QPen &pen)
275 364 }
276 365 }
277 366
367 /*!
368 Returns the pen used to labels.
369 */
278 370 QPen QAxis::labelsPen() const
279 371 {
280 372 return d_ptr->m_labelsPen;
@@ -291,6 +383,9 void QAxis::setLabelsBrush(const QBrush &brush)
291 383 }
292 384 }
293 385
386 /*!
387 Returns brush used to draw labels.
388 */
294 389 QBrush QAxis::labelsBrush() const
295 390 {
296 391 return d_ptr->m_labelsBrush;
@@ -298,7 +393,7 QBrush QAxis::labelsBrush() const
298 393
299 394 /*!
300 395 Sets \a font used to draw labels.
301 */
396 */
302 397 void QAxis::setLabelsFont(const QFont &font)
303 398 {
304 399 if (d_ptr->m_labelsFont != font) {
@@ -307,19 +402,20 void QAxis::setLabelsFont(const QFont &font)
307 402 }
308 403 }
309 404
405 /*!
406 Returns font used to draw labels.
407 */
310 408 QFont QAxis::labelsFont() const
311 409 {
312 410 return d_ptr->m_labelsFont;
313 411 }
314 412
315 /*!
316 Sets \a angle for all the labels on given axis.
317 */
318 413 void QAxis::setLabelsAngle(int angle)
319 414 {
320 415 if (d_ptr->m_labelsAngle != angle) {
321 416 d_ptr->m_labelsAngle = angle;
322 417 emit d_ptr->updated();
418 emit labelsAngleChanged(angle);
323 419 }
324 420 }
325 421
@@ -328,14 +424,27 int QAxis::labelsAngle() const
328 424 return d_ptr->m_labelsAngle;
329 425 }
330 426
331 /*!
332 Sets if shades are \a visible.
333 */
427 void QAxis::setLabelsColor(QColor color)
428 {
429 QBrush b = d_ptr->m_labelsBrush;
430 if (b.color() != color) {
431 b.setColor(color);
432 setLabelsBrush(b);
433 emit labelsColorChanged(color);
434 }
435 }
436
437 QColor QAxis::labelsColor() const
438 {
439 return d_ptr->m_labelsBrush.color();
440 }
441
334 442 void QAxis::setShadesVisible(bool visible)
335 443 {
336 444 if (d_ptr->m_shadesVisible != visible) {
337 445 d_ptr->m_shadesVisible = visible;
338 446 emit d_ptr->updated();
447 emit shadesVisibleChanged(visible);
339 448 }
340 449 }
341 450
@@ -346,7 +455,7 bool QAxis::shadesVisible() const
346 455
347 456 /*!
348 457 Sets \a pen used to draw shades.
349 */
458 */
350 459 void QAxis::setShadesPen(const QPen &pen)
351 460 {
352 461 if (d_ptr->m_shadesPen != pen) {
@@ -355,6 +464,9 void QAxis::setShadesPen(const QPen &pen)
355 464 }
356 465 }
357 466
467 /*!
468 Returns pen used to draw shades.
469 */
358 470 QPen QAxis::shadesPen() const
359 471 {
360 472 return d_ptr->m_shadesPen;
@@ -362,34 +474,46 QPen QAxis::shadesPen() const
362 474
363 475 /*!
364 476 Sets \a brush used to draw shades.
365 */
477 */
366 478 void QAxis::setShadesBrush(const QBrush &brush)
367 479 {
368 480 if (d_ptr->m_shadesBrush != brush) {
369 481 d_ptr->m_shadesBrush = brush;
370 482 emit d_ptr->updated();
371 }
483 emit shadesColorChanged(brush.color());
484 }
372 485 }
373 486
487 /*!
488 \brief Returns brush used to draw shades.
489 */
374 490 QBrush QAxis::shadesBrush() const
375 491 {
376 492 return d_ptr->m_shadesBrush;
377 493 }
378 494
379 /*!
380 Sets \a opacity of the shades.
381 */
382 void QAxis::setShadesOpacity(qreal opacity)
495 void QAxis::setShadesColor(QColor color)
383 496 {
384 if (d_ptr->m_shadesOpacity != opacity) {
385 d_ptr->m_shadesOpacity=opacity;
386 emit d_ptr->updated();
387 }
497 QBrush b = d_ptr->m_shadesBrush;
498 b.setColor(color);
499 setShadesBrush(b);
500 }
501
502 QColor QAxis::shadesColor() const
503 {
504 return d_ptr->m_shadesBrush.color();
505 }
506
507 void QAxis::setShadesBorderColor(QColor color)
508 {
509 QPen p = d_ptr->m_shadesPen;
510 p.setColor(color);
511 setShadesPen(p);
388 512 }
389 513
390 qreal QAxis::shadesOpacity() const
514 QColor QAxis::shadesBorderColor() const
391 515 {
392 return d_ptr->m_shadesOpacity;
516 return d_ptr->m_shadesPen.color();
393 517 }
394 518
395 519 void QAxis::setMin(qreal min)
@@ -414,7 +538,7 qreal QAxis::max() const
414 538
415 539 /*!
416 540 Sets range from \a min to \a max on the axis.
417 */
541 */
418 542 void QAxis::setRange(qreal min, qreal max)
419 543 {
420 544 bool changed = false;
@@ -438,7 +562,7 void QAxis::setRange(qreal min, qreal max)
438 562
439 563 /*!
440 564 Sets \a count for ticks on the axis.
441 */
565 */
442 566 void QAxis::setTicksCount(int count)
443 567 {
444 568 if (d_ptr->m_ticksCount != count) {
@@ -448,6 +572,10 void QAxis::setTicksCount(int count)
448 572 }
449 573 }
450 574
575 /*!
576 \fn int QAxis::ticksCount() const
577 Return number of ticks on the axis
578 */
451 579 int QAxis::ticksCount() const
452 580 {
453 581 return d_ptr->m_ticksCount;
@@ -455,7 +583,7 int QAxis::ticksCount() const
455 583
456 584 /*!
457 585 Sets axis, shades, labels and grid lines to be visible.
458 */
586 */
459 587 void QAxis::show()
460 588 {
461 589 d_ptr->m_axisVisible=true;
@@ -467,7 +595,7 void QAxis::show()
467 595
468 596 /*!
469 597 Sets axis, shades, labels and grid lines to not be visible.
470 */
598 */
471 599 void QAxis::hide()
472 600 {
473 601 d_ptr->m_axisVisible = false;
@@ -477,20 +605,15 void QAxis::hide()
477 605 emit d_ptr->updated();
478 606 }
479 607
480 /*!
481 Sets the nice numbers state to \a enable
482 */
483 608 void QAxis::setNiceNumbersEnabled(bool enable)
484 609 {
485 610 if (d_ptr->m_niceNumbers != enable){
486 611 d_ptr->m_niceNumbers = enable;
487 612 emit d_ptr->changed(d_ptr->m_min, d_ptr->m_max, d_ptr->m_ticksCount, d_ptr->m_niceNumbers);
613 emit niceNumbersEnabledChanged(enable);
488 614 }
489 615 }
490 616
491 /*!
492 Returns whether nice numbers are enabled or not.
493 */
494 617 bool QAxis::niceNumbersEnabled() const
495 618 {
496 619 return d_ptr->m_niceNumbers;
@@ -504,17 +627,18 QAxisCategories* QAxis::categories()
504 627 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
505 628
506 629 QAxisPrivate::QAxisPrivate(QAxis* q):
507 q_ptr(q),
508 m_axisVisible(true),
509 m_gridLineVisible(true),
510 m_labelsVisible(true),
511 m_labelsAngle(0),
512 m_shadesVisible(false),
513 m_shadesOpacity(1.0),
514 m_min(0),
515 m_max(0),
516 m_ticksCount(5),
517 m_niceNumbers(false)
630 q_ptr(q),
631 m_axisVisible(true),
632 m_gridLineVisible(true),
633 m_labelsVisible(true),
634 m_labelsAngle(0),
635 m_shadesVisible(false),
636 m_shadesBrush(Qt::SolidPattern),
637 m_shadesOpacity(1.0),
638 m_min(0),
639 m_max(0),
640 m_ticksCount(5),
641 m_niceNumbers(false)
518 642 {
519 643
520 644 }
@@ -530,7 +654,9 void QAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count)
530 654 q_ptr->setTicksCount(count);
531 655 }
532 656
657 QTCOMMERCIALCHART_END_NAMESPACE
658
659 QTCOMMERCIALCHART_USE_NAMESPACE
660
533 661 #include "moc_qaxis.cpp"
534 662 #include "moc_qaxis_p.cpp"
535
536 QTCOMMERCIALCHART_END_NAMESPACE
@@ -33,9 +33,19 class QAxisPrivate;
33 33 class QTCOMMERCIALCHART_EXPORT QAxis : public QObject
34 34 {
35 35 Q_OBJECT
36 Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible)
36 Q_PROPERTY(bool visible READ isAxisVisible WRITE setAxisVisible NOTIFY visibleChanged)
37 Q_PROPERTY(QColor color READ axisPenColor WRITE setAxisPenColor NOTIFY colorChanged)
38 Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged)
39 Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle NOTIFY labelsAngleChanged)
40 Q_PROPERTY(QColor labelsColor READ labelsColor WRITE setLabelsColor NOTIFY labelsColorChanged)
41 Q_PROPERTY(bool gridVisible READ isGridLineVisible WRITE setGridLineVisible NOTIFY gridVisibleChanged)
42 Q_PROPERTY(bool shadesVisible READ shadesVisible WRITE setShadesVisible NOTIFY shadesVisibleChanged)
43 Q_PROPERTY(QColor shadesColor READ shadesColor WRITE setShadesColor NOTIFY shadesColorChanged)
44 Q_PROPERTY(QColor shadesBorderColor READ shadesBorderColor WRITE setShadesBorderColor NOTIFY shadesBorderColorChanged)
37 45 Q_PROPERTY(qreal min READ min WRITE setMin)
38 46 Q_PROPERTY(qreal max READ max WRITE setMax)
47 Q_PROPERTY(int ticksCount READ ticksCount WRITE setTicksCount NOTIFY ticksCountChanged)
48 Q_PROPERTY(bool niceNumbersEnabled READ niceNumbersEnabled WRITE setNiceNumbersEnabled NOTIFY niceNumbersEnabledChanged)
39 49
40 50 public:
41 51
@@ -47,6 +57,8 public:
47 57 void setAxisVisible(bool visible = true);
48 58 void setAxisPen(const QPen &pen);
49 59 QPen axisPen() const;
60 void setAxisPenColor(QColor color);
61 QColor axisPenColor() const;
50 62
51 63 //grid handling
52 64 bool isGridLineVisible() const;
@@ -65,6 +77,8 public:
65 77 QFont labelsFont() const;
66 78 void setLabelsAngle(int angle);
67 79 int labelsAngle() const;
80 void setLabelsColor(QColor color);
81 QColor labelsColor() const;
68 82
69 83 //shades handling
70 84 bool shadesVisible() const;
@@ -73,8 +87,10 public:
73 87 QPen shadesPen() const;
74 88 void setShadesBrush(const QBrush &brush);
75 89 QBrush shadesBrush() const;
76 void setShadesOpacity(qreal opacity);
77 qreal shadesOpacity() const;
90 void setShadesColor(QColor color);
91 QColor shadesColor() const;
92 void setShadesBorderColor(QColor color);
93 QColor shadesBorderColor() const;
78 94
79 95 //range handling
80 96 void setMin(qreal min);
@@ -96,14 +112,24 public:
96 112 void hide();
97 113
98 114 Q_SIGNALS:
115 void visibleChanged(bool visible);
116 void labelsVisibleChanged(bool visible);
117 void gridVisibleChanged(bool visible);
99 118 void minChanged(qreal min);
100 119 void maxChanged(qreal max);
101 120 void rangeChanged(qreal min, qreal max);
102 void ticksCountChanged(int count);
121 void colorChanged(QColor color);
122 void labelsColorChanged(QColor color);
123 void labelsAngleChanged(int angle);
124 void shadesVisibleChanged(bool visible);
125 void shadesColorChanged(QColor color);
126 void shadesBorderColorChanged(QColor color);
127 void ticksCountChanged(int count);
128 void niceNumbersEnabledChanged(bool enabled);
103 129
104 130 private:
105 131 QScopedPointer<QAxisPrivate> d_ptr;
106 Q_DISABLE_COPY(QAxis);
132 Q_DISABLE_COPY(QAxis)
107 133 friend class ChartDataSet;
108 134 friend class ChartAxis;
109 135 };
@@ -29,7 +29,9 Flow {
29 29 property variant series // TODO: rename to chart
30 30
31 31 onSeriesChanged: {
32 legendConnections.target = series.legend
32 legendConnections.target = series.legend;
33 axisXConnections.target = series.axisX;
34 axisYConnections.target = series.axisY;
33 35 }
34 36
35 37 Connections {
@@ -50,6 +52,38 Flow {
50 52 onVisibleChanged: console.log("legend.onVisibleChanged: " + series.legend.visible);
51 53 }
52 54
55 Connections {
56 id: axisXConnections
57 ignoreUnknownSignals: true
58 onColorChanged: console.log("axisX.onColorChanged: " + color);
59 onLabelsVisibleChanged: console.log("axisX.onLabelsVisibleChanged: " + visible);
60 onLabelsColorChanged: console.log("axisX.onLabelsColorChanged: " + color);
61 onLabelsAngleChanged: console.log("axisX.onLabelsAngleChanged: " + angle);
62 onVisibleChanged: console.log("axisX.onVisibleChanged: " + visible);
63 onGridVisibleChanged: console.log("axisX.onGridVisibleChanged: " + visible);
64 onShadesVisibleChanged: console.log("axisX.onShadesVisibleChanged: " + visible);
65 onShadesColorChanged: console.log("axisX.onShadesColorChanged: " + color);
66 onShadesBorderColorChanged: console.log("axisX.onShadesBorderColorChanged: " + color);
67 onNiceNumbersEnabledChanged: console.log("axisX.onNiceNumbersEnabledChanged: " + enabled);
68 onTicksCountChanged: console.log("axisX.onTicksCountChanged: " + count);
69 }
70
71 Connections {
72 id: axisYConnections
73 ignoreUnknownSignals: true
74 onColorChanged: console.log("axisY.onColorChanged: " + color);
75 onLabelsVisibleChanged: console.log("axisY.onLabelsVisibleChanged: " + visible);
76 onLabelsColorChanged: console.log("axisY.onLabelsColorChanged: " + color);
77 onLabelsAngleChanged: console.log("axisY.onLabelsAngleChanged: " + angle);
78 onVisibleChanged: console.log("axisY.onVisibleChanged: " + visible);
79 onGridVisibleChanged: console.log("axisY.onGridVisibleChanged: " + visible);
80 onShadesVisibleChanged: console.log("axisY.onShadesVisibleChanged: " + visible);
81 onShadesColorChanged: console.log("axisY.onShadesColorChanged: " + color);
82 onShadesBorderColorChanged: console.log("axisY.onShadesBorderColorChanged: " + color);
83 onNiceNumbersEnabledChanged: console.log("axisY.onNiceNumbersEnabledChanged: " + enabled);
84 onTicksCountChanged: console.log("axisY.onTicksCountChanged: " + count);
85 }
86
53 87 Button {
54 88 text: "visible"
55 89 onClicked: series.visible = !series.visible;
@@ -63,6 +97,22 Flow {
63 97 onClicked: series.theme--;
64 98 }
65 99 Button {
100 text: "animation opt +"
101 onClicked: series.animationOptions++;
102 }
103 Button {
104 text: "animation opt -"
105 onClicked: series.animationOptions--;
106 }
107 Button {
108 text: "title color"
109 onClicked: series.titleColor = main.nextColor();
110 }
111 Button {
112 text: "background color"
113 onClicked: series.backgroundColor = main.nextColor();
114 }
115 Button {
66 116 text: "legend top"
67 117 onClicked: series.legend.alignment ^= Qt.AlignTop;
68 118 }
@@ -83,19 +133,107 Flow {
83 133 onClicked: series.legend.visible = !series.legend.visible;
84 134 }
85 135 Button {
86 text: "animation opt +"
87 onClicked: series.animationOptions++;
136 text: "axis X nice nmb"
137 onClicked: series.axisX.niceNumbersEnabled = !series.axisX.niceNumbersEnabled;
88 138 }
89 139 Button {
90 text: "animation opt -"
91 onClicked: series.animationOptions--;
140 text: "axis X visible"
141 onClicked: series.axisX.visible = !series.axisX.visible;
92 142 }
93 143 Button {
94 text: "title color"
95 onClicked: series.titleColor = main.nextColor();
144 text: "axis X grid visible"
145 onClicked: series.axisX.gridVisible = !series.axisX.gridVisible;
96 146 }
97 147 Button {
98 text: "background color"
99 onClicked: series.backgroundColor = main.nextColor();
148 text: "axis X labels visible"
149 onClicked: series.axisX.labelsVisible = !series.axisX.labelsVisible;
150 }
151 Button {
152 text: "axis X color"
153 onClicked: series.axisX.color = main.nextColor();
154 }
155 Button {
156 text: "axis X labels color"
157 onClicked: series.axisX.labelsColor = main.nextColor();
158 }
159 Button {
160 text: "axis X labels angle +"
161 onClicked: series.axisX.labelsAngle += 5;
162 }
163 Button {
164 text: "axis X labels angle -"
165 onClicked: series.axisX.labelsAngle -= 5;
166 }
167 Button {
168 text: "axis X shades visible"
169 onClicked: series.axisX.shadesVisible = !series.axisX.shadesVisible;
170 }
171 Button {
172 text: "axis X shades color"
173 onClicked: series.axisX.shadesColor = main.nextColor();
174 }
175 Button {
176 text: "axis X shades bcolor"
177 onClicked: series.axisX.shadesBorderColor = main.nextColor();
178 }
179 Button {
180 text: "axis X ticks count +"
181 onClicked: series.axisX.ticksCount++;
182 }
183 Button {
184 text: "axis X ticks count -"
185 onClicked: series.axisX.ticksCount--;
186 }
187 Button {
188 text: "axis Y nice nmb"
189 onClicked: series.axisY.niceNumbersEnabled = !series.axisY.niceNumbersEnabled;
190 }
191 Button {
192 text: "axis Y visible"
193 onClicked: series.axisY.visible = !series.axisY.visible;
194 }
195 Button {
196 text: "axis Y grid visible"
197 onClicked: series.axisY.gridVisible = !series.axisY.gridVisible;
198 }
199 Button {
200 text: "axis Y labels visible"
201 onClicked: series.axisY.labelsVisible = !series.axisY.labelsVisible;
202 }
203 Button {
204 text: "axis Y color"
205 onClicked: series.axisY.color = main.nextColor();
206 }
207 Button {
208 text: "axis Y labels color"
209 onClicked: series.axisY.labelsColor = main.nextColor();
210 }
211 Button {
212 text: "axis Y labels angle +"
213 onClicked: series.axisY.labelsAngle += 5;
214 }
215 Button {
216 text: "axis Y labels angle -"
217 onClicked: series.axisY.labelsAngle -= 5;
218 }
219 Button {
220 text: "axis Y shades visible"
221 onClicked: series.axisY.shadesVisible = !series.axisY.shadesVisible;
222 }
223 Button {
224 text: "axis Y shades color"
225 onClicked: series.axisY.shadesColor = main.nextColor();
226 }
227 Button {
228 text: "axis Y shades bcolor"
229 onClicked: series.axisY.shadesBorderColor = main.nextColor();
230 }
231 Button {
232 text: "axis Y ticks count +"
233 onClicked: series.axisY.ticksCount++;
234 }
235 Button {
236 text: "axis Y ticks count -"
237 onClicked: series.axisY.ticksCount--;
100 238 }
101 239 }
General Comments 0
You need to be logged in to leave comments. Login now