##// END OF EJS Templates
minor. qchartaxis docs
Michal Klocek -
r441:2cbc2d40e013
parent child
Show More
@@ -1,396 +1,396
1 1 #include "qchartaxis.h"
2 2
3 3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4 4
5 5 /*!
6 6 \class QChartAxis
7 7 \brief The QChartAxis class is used for manipulating chart's axis
8 8 and for adding optional axes to the chart.
9 9 \mainclass
10 10
11 11 There is only one x Axis, however there can be multiple y axes.
12 12 Each chart series can be bound to exactly one Y axis and the share common X axis.
13 13 Axis can be setup to show axis line with ticks, gird lines and shades.
14 14
15 15 */
16 16
17 17 /*!
18 18 \fn bool QChartAxis::isAxisVisible() const
19 19 \brief Returns if axis is visible
20 20 \sa setAxisVisible()
21 21 */
22 22
23 23 /*!
24 24 \fn QPen QChartAxis::axisPen() const
25 25 \brief Returns pen used to draw axis and ticks.
26 26 \sa setAxisPen()
27 27 */
28 28
29 29
30 30 /*!
31 31 \fn bool QChartAxis::isGridVisible() const
32 32 \brief Returns if grid is visible
33 33 \sa setGridVisible()
34 34 */
35 35
36 36 /*!
37 37 \fn QPen QChartAxis::gridPen() const
38 38 \brief Returns pen used to draw grid.
39 39 \sa setGridPen()
40 40 */
41 41
42 42 /*!
43 43 \fn bool QChartAxis::labelsVisible() const
44 44 \brief Returns if grid is visible
45 45 \sa setLabelsVisible()
46 46 */
47 47
48 48 /*!
49 49 \fn QPen QChartAxis::labelsPen() const
50 50 \brief Returns the pen used to labels.
51 51 \sa setLabelsPen()
52 52 */
53 53
54 54 /*!
55 55 \fn QBrush QChartAxis::labelsBrush() const
56 56 \brief Returns brush used to draw labels.
57 57 \sa setLabelsBrush()
58 58 */
59 59
60 60 /*!
61 61 \fn QFont QChartAxis::labelsFont() const
62 62 \brief Returns font used to draw labels.
63 63 \sa setLabelsFont()
64 64 */
65 65
66 66 /*!
67 67 \fn QFont QChartAxis::labelsAngle() const
68 68 \brief Returns angle used to draw labels.
69 69 \sa setLabelsAngle()
70 70 */
71 71
72 72 /*!
73 73 \fn bool QChartAxis::shadesVisible() const
74 74 \brief Returns if shades are visible.
75 75 \sa setShadesVisible()
76 76 */
77 77
78 78 /*!
79 79 \fn qreal QChartAxis::shadesOpacity() const
80 80 \brief Returns opacity of shades.
81 81 */
82 82
83 83 /*!
84 84 \fn QPen QChartAxis::shadesPen() const
85 85 \brief Returns pen used to draw shades.
86 86 \sa setShadesPen()
87 87 */
88 88
89 89 /*!
90 90 \fn QBrush QChartAxis::shadesBrush() const
91 91 \brief Returns brush used to draw shades.
92 92 \sa setShadesBrush()
93 93 */
94 94
95 95 /*!
96 96 \fn qreal QChartAxis::min() const
97 97 \brief Returns minimum value on the axis.
98 98 \sa setMin()
99 99 */
100 100
101 101 /*!
102 102 \fn qreal QChartAxis::max() const
103 103 \brief Returns maximim value on the axis.
104 104 \sa setMax()
105 105 */
106 106
107 107 /*!
108 108 \fn void QChartAxis::minChanged(qreal min)
109 109 \brief Axis emits signal when \a min of axis has changed.
110 110 */
111 111
112 112 /*!
113 113 \fn void QChartAxis::maxChanged(qreal max)
114 114 \brief Axis emits signal when \a max of axis has changed.
115 115 */
116 116
117 117 /*!
118 118 \fn void QChartAxis::rangeChanged(qreal min, qreal max)
119 119 \brief Axis emits signal when \a min or \a max of axis has changed.
120 120 */
121 121
122 122 /*!
123 123 \fn int QChartAxis::ticksCount() const
124 124 \brief Return number of ticks on the axis
125 125 \sa setTicksCount()
126 126 */
127 127
128 128 /*!
129 \fn void QChartAxis::update()
129 \fn void QChartAxis::updated()
130 130 \brief \internal
131 131 */
132 132
133 133 /*!
134 134 \fn void QChartAxis::handleAxisRangeChanged(qreal min, qreal max)
135 135 \brief \internal \a min \a max
136 136 */
137 137
138 138 /*!
139 139 Constructs new axis object which is a child of \a parent. Ownership is taken by
140 140 QChatView or QChart when axis added.
141 141 */
142 142
143 143 QChartAxis::QChartAxis(QObject* parent):QObject(parent),
144 144 m_axisVisible(true),
145 145 m_gridVisible(true),
146 146 m_labelsVisible(true),
147 147 m_labelsAngle(0),
148 148 m_shadesVisible(true),
149 149 m_shadesOpacity(1.0),
150 150 m_min(0),
151 151 m_max(0),
152 152 m_ticksCount(5)
153 153 {
154 154
155 155 }
156 156
157 157 /*!
158 158 Destructor of the axis object. When axis is added to chart, chart object takes ownership.
159 159 */
160 160
161 161 QChartAxis::~QChartAxis()
162 162 {
163 163 }
164 164
165 165 /*!
166 166 Sets \a pen used to draw axis line and ticks.
167 167 */
168 168 void QChartAxis::setAxisPen(const QPen& pen)
169 169 {
170 170 if (pen != m_axisPen) {
171 171 m_axisPen=pen;
172 172 emit updated();
173 173 }
174 174 }
175 175
176 176 /*!
177 177 Sets if axis and ticks are \a visible.
178 178 */
179 179 void QChartAxis::setAxisVisible(bool visible)
180 180 {
181 181 if (m_axisVisible!=visible) {
182 182 m_axisVisible=visible;
183 183 emit updated();
184 184 }
185 185 }
186 186
187 187 /*!
188 188 Sets if grid is \a visible.
189 189 */
190 190 void QChartAxis::setGridVisible(bool visible)
191 191 {
192 192 if (m_gridVisible!=visible) {
193 193 m_gridVisible=visible;
194 194 emit updated();
195 195 }
196 196 }
197 197
198 198 /*!
199 199 Sets \a pen used to draw grid.
200 200 */
201 201 void QChartAxis::setGridPen(const QPen& pen)
202 202 {
203 203 if (m_gridPen!=pen) {
204 204 m_gridPen=pen;
205 205 emit updated();
206 206 }
207 207 }
208 208
209 209 /*!
210 210 Sets if axis' labels are \a visible.
211 211 */
212 212 void QChartAxis::setLabelsVisible(bool visible)
213 213 {
214 214 if(m_labelsVisible!=visible) {
215 215 m_labelsVisible=visible;
216 216 emit updated();
217 217 }
218 218 }
219 219
220 220 /*!
221 221 Sets \a pen used to draw labels.
222 222 */
223 223 void QChartAxis::setLabelsPen(const QPen& pen)
224 224 {
225 225 if(m_labelsPen!=pen) {
226 226 m_labelsPen=pen;
227 227 emit updated();
228 228 }
229 229 }
230 230
231 231 /*!
232 232 Sets \a brush used to draw labels.
233 233 */
234 234 void QChartAxis::setLabelsBrush(const QBrush& brush)
235 235 {
236 236 if(m_labelsBrush!=brush) {
237 237 m_labelsBrush=brush;
238 238 emit updated();
239 239 }
240 240 }
241 241
242 242 /*!
243 243 Sets \a font used to draw labels.
244 244 */
245 245 void QChartAxis::setLabelsFont(const QFont& font)
246 246 {
247 247 if(m_labelsFont!=font) {
248 248 m_labelsFont=font;
249 249 emit updated();
250 250 }
251 251 }
252 252
253 253 /*!
254 254 Sets \a angle for all the labels on given axis.
255 255 */
256 256 void QChartAxis::setLabelsAngle(int angle)
257 257 {
258 258 if(m_labelsAngle!=angle) {
259 259 m_labelsAngle=angle;
260 260 emit updated();
261 261 }
262 262 }
263 263
264 264 /*!
265 265 Sets if shades are \a visible.
266 266 */
267 267 void QChartAxis::setShadesVisible(bool visible)
268 268 {
269 269 if(m_shadesVisible!=visible) {
270 270 m_shadesVisible=visible;
271 271 emit updated();
272 272 }
273 273 }
274 274
275 275 /*!
276 276 Sets \a pen used to draw shades.
277 277 */
278 278 void QChartAxis::setShadesPen(const QPen& pen)
279 279 {
280 280 if(m_shadesPen!=pen) {
281 281 m_shadesPen=pen;
282 282 emit updated();
283 283 }
284 284 }
285 285
286 286 /*!
287 287 Sets \a brush used to draw shades.
288 288 */
289 289 void QChartAxis::setShadesBrush(const QBrush& brush)
290 290 {
291 291 if(m_shadesBrush!=brush) {
292 292 m_shadesBrush=brush;
293 293 emit updated();
294 294 }
295 295 }
296 296
297 297 /*!
298 298 Sets \a opacity of the shades.
299 299 */
300 300 void QChartAxis::setShadesOpacity(qreal opacity)
301 301 {
302 302 if(m_shadesOpacity!=opacity) {
303 303 m_shadesOpacity=opacity;
304 304 emit updated();
305 305 }
306 306 }
307 307
308 308 /*!
309 309 Sets \a min value on the axis.
310 310 */
311 311 void QChartAxis::setMin(qreal min)
312 312 {
313 313 setRange(min,m_max);
314 314 }
315 315
316 316 /*!
317 317 Sets \a max value on the axis.
318 318 */
319 319 void QChartAxis::setMax(qreal max)
320 320 {
321 321 setRange(m_min,max);
322 322 }
323 323
324 324 /*!
325 325 Sets range from \a min to \a max on the axis.
326 326 */
327 327 void QChartAxis::setRange(qreal min, qreal max)
328 328 {
329 329 bool changed = false;
330 330 if(m_min!=min) {
331 331 m_min=min;
332 332 emit minChanged(min);
333 333 }
334 334
335 335 if(m_max!=max) {
336 336 m_max=max;
337 337 emit maxChanged(max);
338 338 }
339 339
340 340 if(changed) emit rangeChanged(m_min,m_max);
341 341 }
342 342
343 343 void QChartAxis::handleAxisRangeChanged(qreal min, qreal max)
344 344 {
345 345 setRange(min,max);
346 346 }
347 347
348 348 /*!
349 349 Sets \a count for ticks on the axis.
350 350 */
351 351 void QChartAxis::setTicksCount(int count)
352 352 {
353 353 if(m_ticksCount!=count) {
354 354 m_ticksCount=count;
355 355 emit updated();
356 356 }
357 357 }
358 358
359 359 /*!
360 360 TODO: refactor me. Sets string \a label for \a value on the axis.
361 361 */
362 362 void QChartAxis::addAxisTickLabel(qreal value,const QString& label)
363 363 {
364 364 m_ticks.insert(value,label);
365 365 emit updated();
366 366 }
367 367
368 368 /*!
369 369 TODO: refactor me. Removes label for \a value on the axis.
370 370 */
371 371 void QChartAxis::removeAxisTickLabel(qreal value)
372 372 {
373 373 m_ticks.remove(value);
374 374 emit updated();
375 375 }
376 376
377 377 /*!
378 378 TODO: refactor me. Returns label for \a value on the axis.
379 379 */
380 380 QString QChartAxis::axisTickLabel(qreal value) const
381 381 {
382 382 return m_ticks.value(value);
383 383 }
384 384
385 385 /*!
386 386 TODO: refactor me. Removes all the string labels for on the axis.
387 387 */
388 388 void QChartAxis::clearAxisTickLabels()
389 389 {
390 390 m_ticks.clear();
391 391 emit updated();
392 392 }
393 393
394 394 #include "moc_qchartaxis.cpp"
395 395
396 396 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now