##// END OF EJS Templates
QChartaxis docs added
Marek Rosa -
r936:d32b9e9adea9
parent child
Show More
@@ -1,419 +1,444
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2012 Digia Plc
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #include "qchartaxis.h"
21 #include "qchartaxis.h"
22
22
23 QTCOMMERCIALCHART_BEGIN_NAMESPACE
23 QTCOMMERCIALCHART_BEGIN_NAMESPACE
24
24
25 /*!
25 /*!
26 \class QChartAxis
26 \class QChartAxis
27 \brief The QChartAxis class is used for manipulating chart's axis
27 \brief The QChartAxis class is used for manipulating chart's axis
28 and for adding optional axes to the chart.
28 and for adding optional axes to the chart.
29 \mainclass
29 \mainclass
30
30
31 There is only one x Axis, however there can be multiple y axes.
31 There is only one x Axis, however there can be multiple y axes.
32 Each chart series can be bound to exactly one Y axis and the share common X axis.
32 Each chart series can be bound to exactly one Y axis and the share common X axis.
33 Axis can be setup to show axis line with ticks, gird lines and shades.
33 Axis can be setup to show axis line with ticks, gird lines and shades.
34
34
35 */
35 */
36
36
37 /*!
37 /*!
38 \fn bool QChartAxis::isAxisVisible() const
38 \fn bool QChartAxis::isAxisVisible() const
39 \brief Returns if axis is visible
39 \brief Returns if axis is visible
40 \sa setAxisVisible()
40 \sa setAxisVisible()
41 */
41 */
42
42
43 /*!
43 /*!
44 \fn QPen QChartAxis::axisPen() const
44 \fn QPen QChartAxis::axisPen() const
45 \brief Returns pen used to draw axis and ticks.
45 \brief Returns pen used to draw axis and ticks.
46 \sa setAxisPen()
46 \sa setAxisPen()
47 */
47 */
48
48
49
49
50 /*!
50 /*!
51 \fn bool QChartAxis::isGridLineVisible() const
51 \fn bool QChartAxis::isGridLineVisible() const
52 \brief Returns if grid is visible
52 \brief Returns if grid is visible
53 \sa setGridLineVisible()
53 \sa setGridLineVisible()
54 */
54 */
55
55
56 /*!
56 /*!
57 \fn QPen QChartAxis::gridLinePen() const
57 \fn QPen QChartAxis::gridLinePen() const
58 \brief Returns pen used to draw grid.
58 \brief Returns pen used to draw grid.
59 \sa setGridLinePen()
59 \sa setGridLinePen()
60 */
60 */
61
61
62 /*!
62 /*!
63 \fn bool QChartAxis::labelsVisible() const
63 \fn bool QChartAxis::labelsVisible() const
64 \brief Returns if grid is visible
64 \brief Returns if grid is visible
65 \sa setLabelsVisible()
65 \sa setLabelsVisible()
66 */
66 */
67
67
68 /*!
68 /*!
69 \fn QPen QChartAxis::labelsPen() const
69 \fn QPen QChartAxis::labelsPen() const
70 \brief Returns the pen used to labels.
70 \brief Returns the pen used to labels.
71 \sa setLabelsPen()
71 \sa setLabelsPen()
72 */
72 */
73
73
74 /*!
74 /*!
75 \fn QBrush QChartAxis::labelsBrush() const
75 \fn QBrush QChartAxis::labelsBrush() const
76 \brief Returns brush used to draw labels.
76 \brief Returns brush used to draw labels.
77 \sa setLabelsBrush()
77 \sa setLabelsBrush()
78 */
78 */
79
79
80 /*!
80 /*!
81 \fn QFont QChartAxis::labelsFont() const
81 \fn QFont QChartAxis::labelsFont() const
82 \brief Returns font used to draw labels.
82 \brief Returns font used to draw labels.
83 \sa setLabelsFont()
83 \sa setLabelsFont()
84 */
84 */
85
85
86 /*!
86 /*!
87 \fn QFont QChartAxis::labelsAngle() const
87 \fn QFont QChartAxis::labelsAngle() const
88 \brief Returns angle used to draw labels.
88 \brief Returns angle used to draw labels.
89 \sa setLabelsAngle()
89 \sa setLabelsAngle()
90 */
90 */
91
91
92 /*!
92 /*!
93 \fn bool QChartAxis::shadesVisible() const
93 \fn bool QChartAxis::shadesVisible() const
94 \brief Returns if shades are visible.
94 \brief Returns if shades are visible.
95 \sa setShadesVisible()
95 \sa setShadesVisible()
96 */
96 */
97
97
98 /*!
98 /*!
99 \fn qreal QChartAxis::shadesOpacity() const
99 \fn qreal QChartAxis::shadesOpacity() const
100 \brief Returns opacity of shades.
100 \brief Returns opacity of shades.
101 */
101 */
102
102
103 /*!
103 /*!
104 \fn QPen QChartAxis::shadesPen() const
104 \fn QPen QChartAxis::shadesPen() const
105 \brief Returns pen used to draw shades.
105 \brief Returns pen used to draw shades.
106 \sa setShadesPen()
106 \sa setShadesPen()
107 */
107 */
108
108
109 /*!
109 /*!
110 \fn QBrush QChartAxis::shadesBrush() const
110 \fn QBrush QChartAxis::shadesBrush() const
111 \brief Returns brush used to draw shades.
111 \brief Returns brush used to draw shades.
112 \sa setShadesBrush()
112 \sa setShadesBrush()
113 */
113 */
114
114
115 /*!
115 /*!
116 \fn qreal QChartAxis::min() const
116 \fn qreal QChartAxis::min() const
117 \brief Returns minimum value on the axis.
117 \brief Returns minimum value on the axis.
118 \sa setMin()
118 \sa setMin()
119 */
119 */
120
120
121 /*!
121 /*!
122 \fn qreal QChartAxis::max() const
122 \fn qreal QChartAxis::max() const
123 \brief Returns maximim value on the axis.
123 \brief Returns maximim value on the axis.
124 \sa setMax()
124 \sa setMax()
125 */
125 */
126
126
127 /*!
127 /*!
128 \fn void QChartAxis::minChanged(qreal min)
128 \fn void QChartAxis::minChanged(qreal min)
129 \brief Axis emits signal when \a min of axis has changed.
129 \brief Axis emits signal when \a min of axis has changed.
130 */
130 */
131
131
132 /*!
132 /*!
133 \fn void QChartAxis::maxChanged(qreal max)
133 \fn void QChartAxis::maxChanged(qreal max)
134 \brief Axis emits signal when \a max of axis has changed.
134 \brief Axis emits signal when \a max of axis has changed.
135 */
135 */
136
136
137 /*!
137 /*!
138 \fn void QChartAxis::rangeChanged(qreal min, qreal max)
138 \fn void QChartAxis::rangeChanged(qreal min, qreal max)
139 \brief Axis emits signal when \a min or \a max of axis has changed.
139 \brief Axis emits signal when \a min or \a max of axis has changed.
140 */
140 */
141
141
142 /*!
142 /*!
143 \fn int QChartAxis::ticksCount() const
143 \fn int QChartAxis::ticksCount() const
144 \brief Return number of ticks on the axis
144 \brief Return number of ticks on the axis
145 \sa setTicksCount()
145 \sa setTicksCount()
146 */
146 */
147
147
148 /*!
148 /*!
149 \fn void QChartAxis::updated()
149 \fn void QChartAxis::updated()
150 \brief \internal
150 \brief \internal
151 */
151 */
152
152
153 /*!
153 /*!
154 \fn void changed(qreal min, qreal max, int tickCount,bool niceNumbers)
155 \brief \internal
156 */
157
158 /*!
159 \fn bool QChartAxis::niceNumbers() const
160 \brief Returns whether nice numbers are enabled or not.
161 */
162
163 /*!
164 \fn QChartAxisCategories* categories()
165 \brief Returns pointer to the list of categories which correspond to the values on the axis.
166 */
167
168 /*!
169 \fn void ticksCountChanged(int count)
170 \brief Emits the new \a count of ticks on the axis
171 Signal is emitted when the number of the ticks on the axis has been changed to a different value.
172 Parementer count\a count is the new number of ticks on the axis.
173 */
174
175 /*!
154 Constructs new axis object which is a child of \a parent. Ownership is taken by
176 Constructs new axis object which is a child of \a parent. Ownership is taken by
155 QChatView or QChart when axis added.
177 QChatView or QChart when axis added.
156 */
178 */
157
179
158 QChartAxis::QChartAxis(QObject *parent) : QObject(parent),
180 QChartAxis::QChartAxis(QObject *parent) : QObject(parent),
159 m_axisVisible(true),
181 m_axisVisible(true),
160 m_gridLineVisible(true),
182 m_gridLineVisible(true),
161 m_labelsVisible(true),
183 m_labelsVisible(true),
162 m_labelsAngle(0),
184 m_labelsAngle(0),
163 m_shadesVisible(false),
185 m_shadesVisible(false),
164 m_shadesOpacity(1.0),
186 m_shadesOpacity(1.0),
165 m_min(0),
187 m_min(0),
166 m_max(0),
188 m_max(0),
167 m_ticksCount(5),
189 m_ticksCount(5),
168 m_niceNumbers(false)
190 m_niceNumbers(false)
169 {
191 {
170
192
171 }
193 }
172
194
173 /*!
195 /*!
174 Destructor of the axis object. When axis is added to chart, chart object takes ownership.
196 Destructor of the axis object. When axis is added to chart, chart object takes ownership.
175 */
197 */
176
198
177 QChartAxis::~QChartAxis()
199 QChartAxis::~QChartAxis()
178 {
200 {
179 }
201 }
180
202
181 /*!
203 /*!
182 Sets \a pen used to draw axis line and ticks.
204 Sets \a pen used to draw axis line and ticks.
183 */
205 */
184 void QChartAxis::setAxisPen(const QPen &pen)
206 void QChartAxis::setAxisPen(const QPen &pen)
185 {
207 {
186 if (pen != m_axisPen) {
208 if (pen != m_axisPen) {
187 m_axisPen = pen;
209 m_axisPen = pen;
188 emit updated();
210 emit updated();
189 }
211 }
190 }
212 }
191
213
192 /*!
214 /*!
193 Sets if axis and ticks are \a visible.
215 Sets if axis and ticks are \a visible.
194 */
216 */
195 void QChartAxis::setAxisVisible(bool visible)
217 void QChartAxis::setAxisVisible(bool visible)
196 {
218 {
197 if (m_axisVisible != visible) {
219 if (m_axisVisible != visible) {
198 m_axisVisible = visible;
220 m_axisVisible = visible;
199 emit updated();
221 emit updated();
200 }
222 }
201 }
223 }
202
224
203 /*!
225 /*!
204 Sets if grid line is \a visible.
226 Sets if grid line is \a visible.
205 */
227 */
206 void QChartAxis::setGridLineVisible(bool visible)
228 void QChartAxis::setGridLineVisible(bool visible)
207 {
229 {
208 if (m_gridLineVisible != visible) {
230 if (m_gridLineVisible != visible) {
209 m_gridLineVisible = visible;
231 m_gridLineVisible = visible;
210 emit updated();
232 emit updated();
211 }
233 }
212 }
234 }
213
235
214 /*!
236 /*!
215 Sets \a pen used to draw grid line.
237 Sets \a pen used to draw grid line.
216 */
238 */
217 void QChartAxis::setGridLinePen(const QPen &pen)
239 void QChartAxis::setGridLinePen(const QPen &pen)
218 {
240 {
219 if (m_gridLinePen != pen) {
241 if (m_gridLinePen != pen) {
220 m_gridLinePen = pen;
242 m_gridLinePen = pen;
221 emit updated();
243 emit updated();
222 }
244 }
223 }
245 }
224
246
225 /*!
247 /*!
226 Sets if axis' labels are \a visible.
248 Sets if axis' labels are \a visible.
227 */
249 */
228 void QChartAxis::setLabelsVisible(bool visible)
250 void QChartAxis::setLabelsVisible(bool visible)
229 {
251 {
230 if (m_labelsVisible != visible) {
252 if (m_labelsVisible != visible) {
231 m_labelsVisible = visible;
253 m_labelsVisible = visible;
232 emit updated();
254 emit updated();
233 }
255 }
234 }
256 }
235
257
236 /*!
258 /*!
237 Sets \a pen used to draw labels.
259 Sets \a pen used to draw labels.
238 */
260 */
239 void QChartAxis::setLabelsPen(const QPen &pen)
261 void QChartAxis::setLabelsPen(const QPen &pen)
240 {
262 {
241 if (m_labelsPen != pen) {
263 if (m_labelsPen != pen) {
242 m_labelsPen = pen;
264 m_labelsPen = pen;
243 emit updated();
265 emit updated();
244 }
266 }
245 }
267 }
246
268
247 /*!
269 /*!
248 Sets \a brush used to draw labels.
270 Sets \a brush used to draw labels.
249 */
271 */
250 void QChartAxis::setLabelsBrush(const QBrush &brush)
272 void QChartAxis::setLabelsBrush(const QBrush &brush)
251 {
273 {
252 if (m_labelsBrush != brush) {
274 if (m_labelsBrush != brush) {
253 m_labelsBrush = brush;
275 m_labelsBrush = brush;
254 emit updated();
276 emit updated();
255 }
277 }
256 }
278 }
257
279
258 /*!
280 /*!
259 Sets \a font used to draw labels.
281 Sets \a font used to draw labels.
260 */
282 */
261 void QChartAxis::setLabelsFont(const QFont &font)
283 void QChartAxis::setLabelsFont(const QFont &font)
262 {
284 {
263 if (m_labelsFont != font) {
285 if (m_labelsFont != font) {
264 m_labelsFont = font;
286 m_labelsFont = font;
265 emit updated();
287 emit updated();
266 }
288 }
267 }
289 }
268
290
269 /*!
291 /*!
270 Sets \a angle for all the labels on given axis.
292 Sets \a angle for all the labels on given axis.
271 */
293 */
272 void QChartAxis::setLabelsAngle(int angle)
294 void QChartAxis::setLabelsAngle(int angle)
273 {
295 {
274 if (m_labelsAngle != angle) {
296 if (m_labelsAngle != angle) {
275 m_labelsAngle = angle;
297 m_labelsAngle = angle;
276 emit updated();
298 emit updated();
277 }
299 }
278 }
300 }
279
301
280 /*!
302 /*!
281 Sets if shades are \a visible.
303 Sets if shades are \a visible.
282 */
304 */
283 void QChartAxis::setShadesVisible(bool visible)
305 void QChartAxis::setShadesVisible(bool visible)
284 {
306 {
285 if (m_shadesVisible != visible) {
307 if (m_shadesVisible != visible) {
286 m_shadesVisible = visible;
308 m_shadesVisible = visible;
287 emit updated();
309 emit updated();
288 }
310 }
289 }
311 }
290
312
291 /*!
313 /*!
292 Sets \a pen used to draw shades.
314 Sets \a pen used to draw shades.
293 */
315 */
294 void QChartAxis::setShadesPen(const QPen &pen)
316 void QChartAxis::setShadesPen(const QPen &pen)
295 {
317 {
296 if (m_shadesPen != pen) {
318 if (m_shadesPen != pen) {
297 m_shadesPen = pen;
319 m_shadesPen = pen;
298 emit updated();
320 emit updated();
299 }
321 }
300 }
322 }
301
323
302 /*!
324 /*!
303 Sets \a brush used to draw shades.
325 Sets \a brush used to draw shades.
304 */
326 */
305 void QChartAxis::setShadesBrush(const QBrush &brush)
327 void QChartAxis::setShadesBrush(const QBrush &brush)
306 {
328 {
307 if (m_shadesBrush != brush) {
329 if (m_shadesBrush != brush) {
308 m_shadesBrush = brush;
330 m_shadesBrush = brush;
309 emit updated();
331 emit updated();
310 }
332 }
311 }
333 }
312
334
313 /*!
335 /*!
314 Sets \a opacity of the shades.
336 Sets \a opacity of the shades.
315 */
337 */
316 void QChartAxis::setShadesOpacity(qreal opacity)
338 void QChartAxis::setShadesOpacity(qreal opacity)
317 {
339 {
318 if (m_shadesOpacity != opacity) {
340 if (m_shadesOpacity != opacity) {
319 m_shadesOpacity=opacity;
341 m_shadesOpacity=opacity;
320 emit updated();
342 emit updated();
321 }
343 }
322 }
344 }
323
345
324 /*!
346 /*!
325 Sets \a min value on the axis.
347 Sets \a min value on the axis.
326 */
348 */
327 void QChartAxis::setMin(qreal min)
349 void QChartAxis::setMin(qreal min)
328 {
350 {
329 setRange(min,m_max);
351 setRange(min,m_max);
330 }
352 }
331
353
332 /*!
354 /*!
333 Sets \a max value on the axis.
355 Sets \a max value on the axis.
334 */
356 */
335 void QChartAxis::setMax(qreal max)
357 void QChartAxis::setMax(qreal max)
336 {
358 {
337 setRange(m_min,max);
359 setRange(m_min,max);
338 }
360 }
339
361
340 /*!
362 /*!
341 Sets range from \a min to \a max on the axis.
363 Sets range from \a min to \a max on the axis.
342 */
364 */
343 void QChartAxis::setRange(qreal min, qreal max)
365 void QChartAxis::setRange(qreal min, qreal max)
344 {
366 {
345 bool changed = false;
367 bool changed = false;
346 if (!qFuzzyIsNull(m_min - min)) {
368 if (!qFuzzyIsNull(m_min - min)) {
347 m_min = min;
369 m_min = min;
348 changed = true;
370 changed = true;
349 emit minChanged(min);
371 emit minChanged(min);
350 }
372 }
351
373
352 if (!qFuzzyIsNull(m_max - max)) {
374 if (!qFuzzyIsNull(m_max - max)) {
353 m_max = max;
375 m_max = max;
354 changed = true;
376 changed = true;
355 emit maxChanged(max);
377 emit maxChanged(max);
356 }
378 }
357
379
358 if (changed) {
380 if (changed) {
359 emit rangeChanged(m_min,m_max);
381 emit rangeChanged(m_min,m_max);
360 emit this->changed(m_min, m_max, m_ticksCount, m_niceNumbers);
382 emit this->changed(m_min, m_max, m_ticksCount, m_niceNumbers);
361 }
383 }
362 }
384 }
363
385
364 /*!
386 /*!
365 Sets \a count for ticks on the axis.
387 Sets \a count for ticks on the axis.
366 */
388 */
367 void QChartAxis::setTicksCount(int count)
389 void QChartAxis::setTicksCount(int count)
368 {
390 {
369 if (m_ticksCount != count) {
391 if (m_ticksCount != count) {
370 m_ticksCount = count;
392 m_ticksCount = count;
371 emit ticksCountChanged(count);
393 emit ticksCountChanged(count);
372 emit changed(m_min, m_max, m_ticksCount, m_niceNumbers);
394 emit changed(m_min, m_max, m_ticksCount, m_niceNumbers);
373 }
395 }
374 }
396 }
375
397
376 /*!
398 /*!
377 Sets axis, shades, labels and grid lines to be visible.
399 Sets axis, shades, labels and grid lines to be visible.
378 */
400 */
379 void QChartAxis::show()
401 void QChartAxis::show()
380 {
402 {
381 m_axisVisible=true;
403 m_axisVisible=true;
382 m_gridLineVisible=true;
404 m_gridLineVisible=true;
383 m_labelsVisible=true;
405 m_labelsVisible=true;
384 m_shadesVisible=true;
406 m_shadesVisible=true;
385 emit updated();
407 emit updated();
386 }
408 }
387
409
388 /*!
410 /*!
389 Sets axis, shades, labels and grid lines to not be visible.
411 Sets axis, shades, labels and grid lines to not be visible.
390 */
412 */
391 void QChartAxis::hide()
413 void QChartAxis::hide()
392 {
414 {
393 m_axisVisible = false;
415 m_axisVisible = false;
394 m_gridLineVisible = false;
416 m_gridLineVisible = false;
395 m_labelsVisible = false;
417 m_labelsVisible = false;
396 m_shadesVisible = false;
418 m_shadesVisible = false;
397 emit updated();
419 emit updated();
398 }
420 }
399
421
400 /*!
422 /*!
401 \internal
423 \internal
402 */
424 */
403 void QChartAxis::handleAxisRangeChanged(qreal min, qreal max,int count)
425 void QChartAxis::handleAxisRangeChanged(qreal min, qreal max,int count)
404 {
426 {
405 setRange(min,max);
427 setRange(min,max);
406 setTicksCount(count);
428 setTicksCount(count);
407 }
429 }
408
430
409 void QChartAxis::setNiceNumbers(bool enabled)
431 /*!
432 Sets the nice numbers state to \a enable
433 */
434 void QChartAxis::setNiceNumbers(bool enable)
410 {
435 {
411 if (m_niceNumbers != enabled){
436 if (m_niceNumbers != enable){
412 m_niceNumbers = enabled;
437 m_niceNumbers = enable;
413 emit changed(m_min, m_max, m_ticksCount, m_niceNumbers);
438 emit changed(m_min, m_max, m_ticksCount, m_niceNumbers);
414 }
439 }
415 }
440 }
416
441
417 #include "moc_qchartaxis.cpp"
442 #include "moc_qchartaxis.cpp"
418
443
419 QTCOMMERCIALCHART_END_NAMESPACE
444 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,134 +1,134
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2012 Digia Plc
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #ifndef QCHARTAXIS_H_
21 #ifndef QCHARTAXIS_H_
22 #define QCHARTAXIS_H_
22 #define QCHARTAXIS_H_
23
23
24 #include <qchartglobal.h>
24 #include <qchartglobal.h>
25 #include <qchartaxiscategories.h>
25 #include <qchartaxiscategories.h>
26 #include <QPen>
26 #include <QPen>
27 #include <QFont>
27 #include <QFont>
28
28
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30
30
31 class QTCOMMERCIALCHART_EXPORT QChartAxis : public QObject
31 class QTCOMMERCIALCHART_EXPORT QChartAxis : public QObject
32 {
32 {
33 Q_OBJECT
33 Q_OBJECT
34 public:
34 public:
35
35
36 QChartAxis(QObject *parent =0);
36 QChartAxis(QObject *parent =0);
37 ~QChartAxis();
37 ~QChartAxis();
38
38
39 //axis handling
39 //axis handling
40 bool isAxisVisible() const { return m_axisVisible; }
40 bool isAxisVisible() const { return m_axisVisible; }
41 void setAxisVisible(bool visible);
41 void setAxisVisible(bool visible);
42 void setAxisPen(const QPen &pen);
42 void setAxisPen(const QPen &pen);
43 QPen axisPen() const { return m_axisPen; }
43 QPen axisPen() const { return m_axisPen; }
44
44
45 //grid handling
45 //grid handling
46 bool isGridLineVisible() const { return m_gridLineVisible; }
46 bool isGridLineVisible() const { return m_gridLineVisible; }
47 void setGridLineVisible(bool visible);
47 void setGridLineVisible(bool visible);
48 void setGridLinePen(const QPen &pen);
48 void setGridLinePen(const QPen &pen);
49 QPen gridLinePen() const { return m_gridLinePen; }
49 QPen gridLinePen() const { return m_gridLinePen; }
50
50
51 //labels handling
51 //labels handling
52 bool labelsVisible() const { return m_labelsVisible; }
52 bool labelsVisible() const { return m_labelsVisible; }
53 void setLabelsVisible(bool visible);
53 void setLabelsVisible(bool visible);
54 void setLabelsPen(const QPen &pen);
54 void setLabelsPen(const QPen &pen);
55 QPen labelsPen() const { return m_labelsPen;}
55 QPen labelsPen() const { return m_labelsPen;}
56 void setLabelsBrush(const QBrush &brush);
56 void setLabelsBrush(const QBrush &brush);
57 QBrush labelsBrush() const { return m_labelsBrush; }
57 QBrush labelsBrush() const { return m_labelsBrush; }
58 void setLabelsFont(const QFont &font);
58 void setLabelsFont(const QFont &font);
59 QFont labelsFont() const { return m_labelsFont; }
59 QFont labelsFont() const { return m_labelsFont; }
60 void setLabelsAngle(int angle);
60 void setLabelsAngle(int angle);
61 int labelsAngle() const { return m_labelsAngle; }
61 int labelsAngle() const { return m_labelsAngle; }
62
62
63 //shades handling
63 //shades handling
64 bool shadesVisible() const { return m_shadesVisible; }
64 bool shadesVisible() const { return m_shadesVisible; }
65 void setShadesVisible(bool visible);
65 void setShadesVisible(bool visible);
66 void setShadesPen(const QPen &pen);
66 void setShadesPen(const QPen &pen);
67 QPen shadesPen() const { return m_shadesPen; }
67 QPen shadesPen() const { return m_shadesPen; }
68 void setShadesBrush(const QBrush &brush);
68 void setShadesBrush(const QBrush &brush);
69 QBrush shadesBrush() const { return m_shadesBrush; }
69 QBrush shadesBrush() const { return m_shadesBrush; }
70 void setShadesOpacity(qreal opacity);
70 void setShadesOpacity(qreal opacity);
71 qreal shadesOpacity() const { return m_shadesOpacity; }
71 qreal shadesOpacity() const { return m_shadesOpacity; }
72
72
73 //range handling
73 //range handling
74 void setMin(qreal min);
74 void setMin(qreal min);
75 qreal min() const { return m_min; }
75 qreal min() const { return m_min; }
76 void setMax(qreal max);
76 void setMax(qreal max);
77 qreal max() const { return m_max; }
77 qreal max() const { return m_max; }
78 void setRange(qreal min, qreal max);
78 void setRange(qreal min, qreal max);
79
79
80 //ticks handling
80 //ticks handling
81 void setTicksCount(int count);
81 void setTicksCount(int count);
82 int ticksCount() const { return m_ticksCount;}
82 int ticksCount() const { return m_ticksCount;}
83
83
84 void setNiceNumbers(bool enabled);
84 void setNiceNumbers(bool enable);
85 bool niceNumbers() const { return m_niceNumbers;}
85 bool niceNumbers() const { return m_niceNumbers;}
86
86
87 QChartAxisCategories* categories() { return &m_category; }
87 QChartAxisCategories* categories() { return &m_category; }
88
88
89 void show();
89 void show();
90 void hide();
90 void hide();
91
91
92 Q_SIGNALS:
92 Q_SIGNALS:
93 void minChanged(qreal min);
93 void minChanged(qreal min);
94 void maxChanged(qreal max);
94 void maxChanged(qreal max);
95 void rangeChanged(qreal min, qreal max);
95 void rangeChanged(qreal min, qreal max);
96 void ticksCountChanged(int count);
96 void ticksCountChanged(int count);
97
97
98 //interal signal
98 //interal signal
99 void updated();
99 void updated();
100 void changed(qreal min, qreal max, int tickCount,bool niceNumbers);
100 void changed(qreal min, qreal max, int tickCount,bool niceNumbers);
101 //internal slot
101 //internal slot
102 public Q_SLOTS:
102 public Q_SLOTS:
103 void handleAxisRangeChanged(qreal min, qreal max,int count);
103 void handleAxisRangeChanged(qreal min, qreal max,int count);
104
104
105 private:
105 private:
106 bool m_axisVisible;
106 bool m_axisVisible;
107 QPen m_axisPen;
107 QPen m_axisPen;
108 QBrush m_axisBrush;
108 QBrush m_axisBrush;
109
109
110 bool m_gridLineVisible;
110 bool m_gridLineVisible;
111 QPen m_gridLinePen;
111 QPen m_gridLinePen;
112
112
113 bool m_labelsVisible;
113 bool m_labelsVisible;
114 QPen m_labelsPen;
114 QPen m_labelsPen;
115 QBrush m_labelsBrush;
115 QBrush m_labelsBrush;
116 QFont m_labelsFont;
116 QFont m_labelsFont;
117 int m_labelsAngle;
117 int m_labelsAngle;
118
118
119 bool m_shadesVisible;
119 bool m_shadesVisible;
120 QPen m_shadesPen;
120 QPen m_shadesPen;
121 QBrush m_shadesBrush;
121 QBrush m_shadesBrush;
122 qreal m_shadesOpacity;
122 qreal m_shadesOpacity;
123
123
124 qreal m_min;
124 qreal m_min;
125 qreal m_max;
125 qreal m_max;
126
126
127 int m_ticksCount;
127 int m_ticksCount;
128 QChartAxisCategories m_category;
128 QChartAxisCategories m_category;
129
129
130 bool m_niceNumbers;
130 bool m_niceNumbers;
131 };
131 };
132
132
133 QTCOMMERCIALCHART_END_NAMESPACE
133 QTCOMMERCIALCHART_END_NAMESPACE
134 #endif /* QCHARTAXIS_H_ */
134 #endif /* QCHARTAXIS_H_ */
General Comments 0
You need to be logged in to leave comments. Login now