##// END OF EJS Templates
Added missing properties to QAxis
Tero Ahola -
r1449:e88bf0c8e17d
parent child
Show More
@@ -9,6 +9,7
9 <ul>
9 <ul>
10 <li><a href="qml-chartview.html">ChartView</a></li>
10 <li><a href="qml-chartview.html">ChartView</a></li>
11 <li><a href="qml-pieseries.html">PieSeries</a></li>
11 <li><a href="qml-pieseries.html">PieSeries</a></li>
12 <li><a href="qml-axis.html">Axis</a></li>
12 </ul>
13 </ul>
13 \endraw
14 \endraw
14 */
15 */
@@ -310,7 +310,7 void ChartAxis::handleAxisUpdated()
310 }
310 }
311
311
312 if (m_chartAxis->shadesVisible()) {
312 if (m_chartAxis->shadesVisible()) {
313 setShadesOpacity(m_chartAxis->shadesOpacity());
313 setShadesOpacity(100);
314 } else {
314 } else {
315 setShadesOpacity(0);
315 setShadesOpacity(0);
316 }
316 }
@@ -30,137 +30,199 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 \mainclass
30 \mainclass
31
31
32 There is only one x Axis, however there can be multiple y axes.
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.
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 ticks, gird lines and shades.
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 \property QAxis::labelsVisible
47 \property QAxis::labelsVisible
40
48 Defines if axis labels are visible.
49 */
50 /*!
51 \qmlproperty bool Axis::labelsVisible
41 Defines if axis labels are visible.
52 Defines if axis labels are visible.
42 */
53 */
43
54
44 /*!
55 /*!
45 \property QAxis::min
56 \property QAxis::min
46
57 Defines the minimum value on the axis.
58 */
59 /*!
60 \qmlproperty real Axis::min
47 Defines the minimum value on the axis.
61 Defines the minimum value on the axis.
48 */
62 */
49
63
50 /*!
64 /*!
51 \property QAxis::max
65 \property QAxis::max
52
53 Defines the maximum value on the axis.
66 Defines the maximum value on the axis.
54 */
67 */
55
56 /*!
68 /*!
57 \fn bool QAxis::isAxisVisible() const
69 \qmlproperty real Axis::max
58 \brief Returns if axis is visible
70 Defines the maximum value on the axis.
59 \sa setAxisVisible()
60 */
71 */
61
72
62 /*!
73 /*!
63 \fn QPen QAxis::axisPen() const
74 \property QAxis::visible
64 \brief Returns pen used to draw axis and ticks.
75 The visibility of the axis.
65 \sa setAxisPen()
76 */
77 /*!
78 \qmlproperty bool Axis::visible
79 The visibility of the axis.
66 */
80 */
67
81
68
69 /*!
82 /*!
70 \fn bool QAxis::isGridLineVisible() const
83 \property QAxis::gridVisible
71 \brief Returns if grid is visible
84 The visibility of the grid lines.
72 \sa setGridLineVisible()
85 */
86 /*!
87 \qmlproperty bool Axis::gridVisible
88 The visibility of the grid lines.
73 */
89 */
74
90
75 /*!
91 /*!
76 \fn QPen QAxis::gridLinePen() const
92 \property QAxis::color
77 \brief Returns pen used to draw grid.
93 The color of the axis and ticks.
78 \sa setGridLinePen()
94 */
95 /*!
96 \qmlproperty color Axis::color
97 The color of the axis and ticks.
79 */
98 */
80
99
81 /*!
100 /*!
82 \fn QPen QAxis::labelsPen() const
101 \property QAxis::labelsColor
83 \brief Returns the pen used to labels.
102 The color of the axis labels.
84 \sa setLabelsPen()
103 */
104 /*!
105 \qmlproperty color Axis::labelsColor
106 The color of the axis labels.
85 */
107 */
86
108
87 /*!
109 /*!
88 \fn QBrush QAxis::labelsBrush() const
110 \property QAxis::labelsAngle
89 \brief Returns brush used to draw labels.
111 The angle of the axis labels in degrees.
90 \sa setLabelsBrush()
112 */
113 /*!
114 \qmlproperty int Axis::labelsAngle
115 The angle of the axis labels in degrees.
91 */
116 */
92
117
93 /*!
118 /*!
94 \fn QFont QAxis::labelsFont() const
119 \property QAxis::shadesVisible
95 \brief Returns font used to draw labels.
120 The visibility of the axis shades.
96 \sa setLabelsFont()
121 */
122 /*!
123 \qmlproperty bool Axis::shadesVisible
124 The visibility of the axis shades.
97 */
125 */
98
126
99 /*!
127 /*!
100 \fn QFont QAxis::labelsAngle() const
128 \property QAxis::shadesColor
101 \brief Returns angle used to draw labels.
129 The fill (brush) color of the axis shades.
102 \sa setLabelsAngle()
130 */
131 /*!
132 \qmlproperty color Axis::shadesColor
133 The fill (brush) color of the axis shades.
103 */
134 */
104
135
105 /*!
136 /*!
106 \fn bool QAxis::shadesVisible() const
137 \property QAxis::shadesBorderColor
107 \brief Returns if shades are visible.
138 The border (pen) color of the axis shades.
108 \sa setShadesVisible()
139 */
140 /*!
141 \qmlproperty color Axis::shadesBorderColor
142 The border (pen) color of the axis shades.
109 */
143 */
110
144
111 /*!
145 /*!
112 \fn qreal QAxis::shadesOpacity() const
146 \property QAxis::ticksCount
113 \brief Returns opacity of shades.
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.
114 */
152 */
115
153
116 /*!
154 /*!
117 \fn QPen QAxis::shadesPen() const
155 \property QAxis::niceNumbersEnabled
118 \brief Returns pen used to draw shades.
156 Whether the nice numbers algorithm is enabled or not for the axis.
119 \sa setShadesPen()
157 */
158 /*!
159 \qmlproperty bool Axis::niceNumbersEnabled
160 Whether the nice numbers algorithm is enabled or not for the axis.
120 */
161 */
121
162
122 /*!
163 /*!
123 \fn QBrush QAxis::shadesBrush() const
164 \fn void QAxis::visibleChanged(bool)
124 \brief Returns brush used to draw shades.
165 Visiblity of the axis has changed to \a visible.
125 \sa setShadesBrush()
126 */
166 */
127
167
128 /*!
168 /*!
129 \fn qreal QAxis::min() const
169 \fn void QAxis::labelsVisibleChanged(bool)
130 \brief Returns minimum value on the axis.
170 Visiblity of the labels of the axis has changed to \a visible.
131 \sa setMin()
132 */
171 */
133
172
134 /*!
173 /*!
135 \fn qreal QAxis::max() const
174 \fn void QAxis::gridVisibleChanged(bool)
136 \brief Returns maximim value on the axis.
175 Visiblity of the grid lines of the axis has changed to \a visible.
137 \sa setMax()
138 */
176 */
139
177
140 /*!
178 /*!
141 \fn void QAxis::minChanged(qreal min)
179 \fn void QAxis::minChanged(qreal min)
142 \brief Axis emits signal when \a min of axis has changed.
180 Axis emits signal when \a min of axis has changed.
143 */
181 */
144
182
145 /*!
183 /*!
146 \fn void QAxis::maxChanged(qreal max)
184 \fn void QAxis::maxChanged(qreal max)
147 \brief Axis emits signal when \a max of axis has changed.
185 Axis emits signal when \a max of axis has changed.
148 */
186 */
149
187
150 /*!
188 /*!
151 \fn void QAxis::rangeChanged(qreal min, qreal max)
189 \fn void QAxis::rangeChanged(qreal min, qreal max)
152 \brief Axis emits signal when \a min or \a max of axis has changed.
190 Axis emits signal when \a min or \a max of axis has changed.
153 */
191 */
154
192
155 /*!
193 /*!
156 \fn int QAxis::ticksCount() const
194 \fn QChartAxisCategories* QAxis::categories()
157 \brief Return number of ticks on the axis
195 Returns pointer to the list of categories which correspond to the values on the axis.
158 \sa setTicksCount()
159 */
196 */
160
197
161 /*!
198 /*!
162 \fn QChartAxisCategories* QAxis::categories()
199 \fn void QAxis::colorChanged(QColor)
163 \brief Returns pointer to the list of categories which correspond to the values on the axis.
200 Emitted if the \a color of the axis is changed.
201 */
202
203 /*!
204 \fn void QAxis::labelsColorChanged(QColor)
205 Emitted if the \a color of the axis labels is changed.
206 */
207
208 /*!
209 \fn void QAxis::labelsAngleChanged(int)
210 Emitted if the \a angle of the axis labels is changed.
211 */
212
213 /*!
214 \fn void QAxis::shadesVisibleChanged(bool)
215 Emitted if the visibility of the axis shades is changed to \a visible.
216 */
217
218 /*!
219 \fn void QAxis::shadesColorChanged(QColor)
220 Emitted if the \a color of the axis shades is changed.
221 */
222
223 /*!
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 /*!
@@ -171,10 +233,14 QTCOMMERCIALCHART_BEGIN_NAMESPACE
171 */
233 */
172
234
173 /*!
235 /*!
236 \fn void QAxis::niceNumbersEnabledChanged(bool)
237 Nice numbers algorithm was \a enabled or disabled.
238 */
239
240 /*!
174 Constructs new axis object which is a child of \a parent. Ownership is taken by
241 Constructs new axis object which is a child of \a parent. Ownership is taken by
175 QChart when axis added.
242 QChart when axis added.
176 */
243 */
177
178 QAxis::QAxis(QObject *parent) : QObject(parent),
244 QAxis::QAxis(QObject *parent) : QObject(parent),
179 d_ptr(new QAxisPrivate(this))
245 d_ptr(new QAxisPrivate(this))
180 {
246 {
@@ -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 QPen QAxis::axisPen() const
272 QPen QAxis::axisPen() const
204 {
273 {
205 return d_ptr->m_axisPen;
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 Sets if axis and ticks are \a visible.
293 Sets if axis and ticks are \a visible.
210 */
294 */
@@ -213,6 +297,7 void QAxis::setAxisVisible(bool visible)
213 if (d_ptr->m_axisVisible != visible) {
297 if (d_ptr->m_axisVisible != visible) {
214 d_ptr->m_axisVisible = visible;
298 d_ptr->m_axisVisible = visible;
215 emit d_ptr->updated();
299 emit d_ptr->updated();
300 emit visibleChanged(visible);
216 }
301 }
217 }
302 }
218
303
@@ -221,14 +306,12 bool QAxis::isAxisVisible() const
221 return d_ptr->m_axisVisible;
306 return d_ptr->m_axisVisible;
222 }
307 }
223
308
224 /*!
225 Sets if grid line is \a visible.
226 */
227 void QAxis::setGridLineVisible(bool visible)
309 void QAxis::setGridLineVisible(bool visible)
228 {
310 {
229 if (d_ptr->m_gridLineVisible != visible) {
311 if (d_ptr->m_gridLineVisible != visible) {
230 d_ptr->m_gridLineVisible = visible;
312 d_ptr->m_gridLineVisible = visible;
231 emit d_ptr->updated();
313 emit d_ptr->updated();
314 emit gridVisibleChanged(visible);
232 }
315 }
233 }
316 }
234
317
@@ -236,6 +319,7 bool QAxis::isGridLineVisible() const
236 {
319 {
237 return d_ptr->m_gridLineVisible;
320 return d_ptr->m_gridLineVisible;
238 }
321 }
322
239 /*!
323 /*!
240 Sets \a pen used to draw grid line.
324 Sets \a pen used to draw grid line.
241 */
325 */
@@ -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 QPen QAxis::gridLinePen() const
337 QPen QAxis::gridLinePen() const
251 {
338 {
252 return d_ptr->m_gridLinePen;
339 return d_ptr->m_gridLinePen;
@@ -257,6 +344,7 void QAxis::setLabelsVisible(bool visible)
257 if (d_ptr->m_labelsVisible != visible) {
344 if (d_ptr->m_labelsVisible != visible) {
258 d_ptr->m_labelsVisible = visible;
345 d_ptr->m_labelsVisible = visible;
259 emit d_ptr->updated();
346 emit d_ptr->updated();
347 emit labelsVisibleChanged(visible);
260 }
348 }
261 }
349 }
262
350
@@ -264,6 +352,7 bool QAxis::labelsVisible() const
264 {
352 {
265 return d_ptr->m_labelsVisible;
353 return d_ptr->m_labelsVisible;
266 }
354 }
355
267 /*!
356 /*!
268 Sets \a pen used to draw labels.
357 Sets \a pen used to draw labels.
269 */
358 */
@@ -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 QPen QAxis::labelsPen() const
370 QPen QAxis::labelsPen() const
279 {
371 {
280 return d_ptr->m_labelsPen;
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 QBrush QAxis::labelsBrush() const
389 QBrush QAxis::labelsBrush() const
295 {
390 {
296 return d_ptr->m_labelsBrush;
391 return d_ptr->m_labelsBrush;
@@ -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 QFont QAxis::labelsFont() const
408 QFont QAxis::labelsFont() const
311 {
409 {
312 return d_ptr->m_labelsFont;
410 return d_ptr->m_labelsFont;
313 }
411 }
314
412
315 /*!
316 Sets \a angle for all the labels on given axis.
317 */
318 void QAxis::setLabelsAngle(int angle)
413 void QAxis::setLabelsAngle(int angle)
319 {
414 {
320 if (d_ptr->m_labelsAngle != angle) {
415 if (d_ptr->m_labelsAngle != angle) {
321 d_ptr->m_labelsAngle = angle;
416 d_ptr->m_labelsAngle = angle;
322 emit d_ptr->updated();
417 emit d_ptr->updated();
418 emit labelsAngleChanged(angle);
323 }
419 }
324 }
420 }
325
421
@@ -328,14 +424,27 int QAxis::labelsAngle() const
328 return d_ptr->m_labelsAngle;
424 return d_ptr->m_labelsAngle;
329 }
425 }
330
426
331 /*!
427 void QAxis::setLabelsColor(QColor color)
332 Sets if shades are \a visible.
428 {
333 */
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 void QAxis::setShadesVisible(bool visible)
442 void QAxis::setShadesVisible(bool visible)
335 {
443 {
336 if (d_ptr->m_shadesVisible != visible) {
444 if (d_ptr->m_shadesVisible != visible) {
337 d_ptr->m_shadesVisible = visible;
445 d_ptr->m_shadesVisible = visible;
338 emit d_ptr->updated();
446 emit d_ptr->updated();
447 emit shadesVisibleChanged(visible);
339 }
448 }
340 }
449 }
341
450
@@ -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 QPen QAxis::shadesPen() const
470 QPen QAxis::shadesPen() const
359 {
471 {
360 return d_ptr->m_shadesPen;
472 return d_ptr->m_shadesPen;
@@ -368,28 +480,40 void QAxis::setShadesBrush(const QBrush &brush)
368 if (d_ptr->m_shadesBrush != brush) {
480 if (d_ptr->m_shadesBrush != brush) {
369 d_ptr->m_shadesBrush = brush;
481 d_ptr->m_shadesBrush = brush;
370 emit d_ptr->updated();
482 emit d_ptr->updated();
483 emit shadesColorChanged(brush.color());
371 }
484 }
372 }
485 }
373
486
487 /*!
488 \brief Returns brush used to draw shades.
489 */
374 QBrush QAxis::shadesBrush() const
490 QBrush QAxis::shadesBrush() const
375 {
491 {
376 return d_ptr->m_shadesBrush;
492 return d_ptr->m_shadesBrush;
377 }
493 }
378
494
379 /*!
495 void QAxis::setShadesColor(QColor color)
380 Sets \a opacity of the shades.
381 */
382 void QAxis::setShadesOpacity(qreal opacity)
383 {
496 {
384 if (d_ptr->m_shadesOpacity != opacity) {
497 QBrush b = d_ptr->m_shadesBrush;
385 d_ptr->m_shadesOpacity=opacity;
498 b.setColor(color);
386 emit d_ptr->updated();
499 setShadesBrush(b);
500 }
501
502 QColor QAxis::shadesColor() const
503 {
504 return d_ptr->m_shadesBrush.color();
387 }
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 void QAxis::setMin(qreal min)
519 void QAxis::setMin(qreal min)
@@ -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 int QAxis::ticksCount() const
579 int QAxis::ticksCount() const
452 {
580 {
453 return d_ptr->m_ticksCount;
581 return d_ptr->m_ticksCount;
@@ -477,20 +605,15 void QAxis::hide()
477 emit d_ptr->updated();
605 emit d_ptr->updated();
478 }
606 }
479
607
480 /*!
481 Sets the nice numbers state to \a enable
482 */
483 void QAxis::setNiceNumbersEnabled(bool enable)
608 void QAxis::setNiceNumbersEnabled(bool enable)
484 {
609 {
485 if (d_ptr->m_niceNumbers != enable){
610 if (d_ptr->m_niceNumbers != enable){
486 d_ptr->m_niceNumbers = enable;
611 d_ptr->m_niceNumbers = enable;
487 emit d_ptr->changed(d_ptr->m_min, d_ptr->m_max, d_ptr->m_ticksCount, d_ptr->m_niceNumbers);
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 bool QAxis::niceNumbersEnabled() const
617 bool QAxis::niceNumbersEnabled() const
495 {
618 {
496 return d_ptr->m_niceNumbers;
619 return d_ptr->m_niceNumbers;
@@ -510,6 +633,7 m_gridLineVisible(true),
510 m_labelsVisible(true),
633 m_labelsVisible(true),
511 m_labelsAngle(0),
634 m_labelsAngle(0),
512 m_shadesVisible(false),
635 m_shadesVisible(false),
636 m_shadesBrush(Qt::SolidPattern),
513 m_shadesOpacity(1.0),
637 m_shadesOpacity(1.0),
514 m_min(0),
638 m_min(0),
515 m_max(0),
639 m_max(0),
@@ -530,7 +654,9 void QAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count)
530 q_ptr->setTicksCount(count);
654 q_ptr->setTicksCount(count);
531 }
655 }
532
656
657 QTCOMMERCIALCHART_END_NAMESPACE
658
659 QTCOMMERCIALCHART_USE_NAMESPACE
660
533 #include "moc_qaxis.cpp"
661 #include "moc_qaxis.cpp"
534 #include "moc_qaxis_p.cpp"
662 #include "moc_qaxis_p.cpp"
535
536 QTCOMMERCIALCHART_END_NAMESPACE
@@ -33,9 +33,19 class QAxisPrivate;
33 class QTCOMMERCIALCHART_EXPORT QAxis : public QObject
33 class QTCOMMERCIALCHART_EXPORT QAxis : public QObject
34 {
34 {
35 Q_OBJECT
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 Q_PROPERTY(qreal min READ min WRITE setMin)
45 Q_PROPERTY(qreal min READ min WRITE setMin)
38 Q_PROPERTY(qreal max READ max WRITE setMax)
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 public:
50 public:
41
51
@@ -47,6 +57,8 public:
47 void setAxisVisible(bool visible = true);
57 void setAxisVisible(bool visible = true);
48 void setAxisPen(const QPen &pen);
58 void setAxisPen(const QPen &pen);
49 QPen axisPen() const;
59 QPen axisPen() const;
60 void setAxisPenColor(QColor color);
61 QColor axisPenColor() const;
50
62
51 //grid handling
63 //grid handling
52 bool isGridLineVisible() const;
64 bool isGridLineVisible() const;
@@ -65,6 +77,8 public:
65 QFont labelsFont() const;
77 QFont labelsFont() const;
66 void setLabelsAngle(int angle);
78 void setLabelsAngle(int angle);
67 int labelsAngle() const;
79 int labelsAngle() const;
80 void setLabelsColor(QColor color);
81 QColor labelsColor() const;
68
82
69 //shades handling
83 //shades handling
70 bool shadesVisible() const;
84 bool shadesVisible() const;
@@ -73,8 +87,10 public:
73 QPen shadesPen() const;
87 QPen shadesPen() const;
74 void setShadesBrush(const QBrush &brush);
88 void setShadesBrush(const QBrush &brush);
75 QBrush shadesBrush() const;
89 QBrush shadesBrush() const;
76 void setShadesOpacity(qreal opacity);
90 void setShadesColor(QColor color);
77 qreal shadesOpacity() const;
91 QColor shadesColor() const;
92 void setShadesBorderColor(QColor color);
93 QColor shadesBorderColor() const;
78
94
79 //range handling
95 //range handling
80 void setMin(qreal min);
96 void setMin(qreal min);
@@ -96,14 +112,24 public:
96 void hide();
112 void hide();
97
113
98 Q_SIGNALS:
114 Q_SIGNALS:
115 void visibleChanged(bool visible);
116 void labelsVisibleChanged(bool visible);
117 void gridVisibleChanged(bool visible);
99 void minChanged(qreal min);
118 void minChanged(qreal min);
100 void maxChanged(qreal max);
119 void maxChanged(qreal max);
101 void rangeChanged(qreal min, qreal max);
120 void rangeChanged(qreal min, qreal max);
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);
102 void ticksCountChanged(int count);
127 void ticksCountChanged(int count);
128 void niceNumbersEnabledChanged(bool enabled);
103
129
104 private:
130 private:
105 QScopedPointer<QAxisPrivate> d_ptr;
131 QScopedPointer<QAxisPrivate> d_ptr;
106 Q_DISABLE_COPY(QAxis);
132 Q_DISABLE_COPY(QAxis)
107 friend class ChartDataSet;
133 friend class ChartDataSet;
108 friend class ChartAxis;
134 friend class ChartAxis;
109 };
135 };
@@ -29,7 +29,9 Flow {
29 property variant series // TODO: rename to chart
29 property variant series // TODO: rename to chart
30
30
31 onSeriesChanged: {
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 Connections {
37 Connections {
@@ -50,6 +52,38 Flow {
50 onVisibleChanged: console.log("legend.onVisibleChanged: " + series.legend.visible);
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 Button {
87 Button {
54 text: "visible"
88 text: "visible"
55 onClicked: series.visible = !series.visible;
89 onClicked: series.visible = !series.visible;
@@ -63,6 +97,22 Flow {
63 onClicked: series.theme--;
97 onClicked: series.theme--;
64 }
98 }
65 Button {
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 text: "legend top"
116 text: "legend top"
67 onClicked: series.legend.alignment ^= Qt.AlignTop;
117 onClicked: series.legend.alignment ^= Qt.AlignTop;
68 }
118 }
@@ -83,19 +133,107 Flow {
83 onClicked: series.legend.visible = !series.legend.visible;
133 onClicked: series.legend.visible = !series.legend.visible;
84 }
134 }
85 Button {
135 Button {
86 text: "animation opt +"
136 text: "axis X nice nmb"
87 onClicked: series.animationOptions++;
137 onClicked: series.axisX.niceNumbersEnabled = !series.axisX.niceNumbersEnabled;
88 }
138 }
89 Button {
139 Button {
90 text: "animation opt -"
140 text: "axis X visible"
91 onClicked: series.animationOptions--;
141 onClicked: series.axisX.visible = !series.axisX.visible;
92 }
142 }
93 Button {
143 Button {
94 text: "title color"
144 text: "axis X grid visible"
95 onClicked: series.titleColor = main.nextColor();
145 onClicked: series.axisX.gridVisible = !series.axisX.gridVisible;
96 }
146 }
97 Button {
147 Button {
98 text: "background color"
148 text: "axis X labels visible"
99 onClicked: series.backgroundColor = main.nextColor();
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