##// END OF EJS Templates
Remove QML LogValueAxis documentation as it is not implemented...
Miikka Heikkinen -
r2438:df26734569cc
parent child
Show More
@@ -1,96 +1,95
1 1 /*!
2 2 \page qml.html
3 3 \title QtCommercial Charts QML API
4 4 \keyword Charts QML API
5 5
6 6 QtCommercial Charts QML API is an intuitive and simple way to show charts in your QML
7 7 applications.
8 8
9 9 \table
10 10 \row
11 11 \o \br
12 12 Use the following QML to create a simple pie chart:
13 13 \br
14 14 \br
15 15 \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 1
16 16 \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 2
17 17 \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 3
18 18 \o \inlineimage examples_qmlpiechart.png
19 19 \endtable
20 20
21 21 \raw HTML
22 22 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
23 23 <tr>
24 24 <th class="titleheader" width="25%"> ChartView and it's properties </th>
25 25 </tr>
26 26 <tr>
27 27 <td valign="top">
28 28 <ul>
29 29 <li><a href="qml-chartview.html">ChartView</a></li>
30 30 <li><a href="qml-abstractaxis.html">AbstractAxis</a></li>
31 31 <li><a href="qml-valueaxis.html">ValueAxis</a></li>
32 <li><a href="qml-logvaluesaxis.html">LogValueAxis</a></li>
33 32 <li><a href="qml-categoryaxis.html">CategoryAxis</a></li>
34 33 <li><a href="qml-categoryrange.html">CategoryRange</a></li>
35 34 <li><a href="qml-barcategoryaxis.html">BarCategoryAxis</a></li>
36 35 <li><a href="qml-datetimeaxis.html">DateTimeAxis</a></li>
37 36 <li><a href="qml-legend.html">Legend</a></li>
38 37 <li><a href="qml-abstractseries.html">AbstractSeries</a></li>
39 38 </ul>
40 39 </td>
41 40 </tr>
42 41 </table>
43 42 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
44 43 <tr>
45 44 <th class="titleheader" width="25%"> XY chart </th>
46 45 </tr>
47 46 <tr>
48 47 <td valign="top">
49 48 <ul>
50 49 <li><a href="qml-xyseries.html">XYSeries</a></li>
51 50 <li><a href="qml-lineseries.html">LineSeries</a></li>
52 51 <li><a href="qml-areaseries.html">AreaSeries</a></li>
53 52 <li><a href="qml-scatterseries.html">ScatterSeries</a></li>
54 53 <li><a href="qml-splineseries.html">SplineSeries</a></li>
55 54 <li><a href="qml-xypoint.html">XYPoint</a></li>
56 55 <li><a href="qml-hxymodelmapper.html">HXYModelMapper</a></li>
57 56 <li><a href="qml-vxymodelmapper.html">VXYModelMapper</a></li>
58 57 </ul>
59 58 </td>
60 59 </tr>
61 60 </table>
62 61 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
63 62 <tr>
64 63 <th class="titleheader" width="25%"> Pie chart </th>
65 64 <tr>
66 65 <td valign="top">
67 66 <ul>
68 67 <li><a href="qml-pieseries.html">PieSeries</a></li>
69 68 <li><a href="qml-pieslice.html">PieSlice</a></li>
70 69 <li><a href="qml-hpiemodelmapper.html">HPieModelMapper</a></li>
71 70 <li><a href="qml-vpiemodelmapper.html">VPieModelMapper</a></li>
72 71 </ul>
73 72 </td>
74 73 </tr>
75 74 </table>
76 75 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
77 76 <tr>
78 77 <th class="titleheader" width="25%"> Bar chart </th>
79 78 <tr>
80 79 <td valign="top">
81 80 <ul>
82 81 <li><a href="qml-barseries.html">BarSeries</a></li>
83 82 <li><a href="qml-stackedbarseries.html">StackedBarSeries</a></li>
84 83 <li><a href="qml-percentbarseries.html">PercentBarSeries</a></li>
85 84 <li><a href="qml-horizontalbarseries.html">HorizontalBarSeries</a></li>
86 85 <li><a href="qml-horizontalstackedbarseries.html">HorizontalStackedBarSeries</a></li>
87 86 <li><a href="qml-horizontalpercentbarseries.html">HorizontalPercentBarSeries</a></li>
88 87 <li><a href="qml-barset.html">BarSet</a></li>
89 88 <li><a href="qml-hbarmodelmapper.html">HBarModelMapper</a></li>
90 89 <li><a href="qml-vbarmodelmapper.html">VBarModelMapper</a></li>
91 90 </ul>
92 91 </td>
93 92 </tr>
94 93 </table>
95 94 \endraw
96 95 */
@@ -1,384 +1,333
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "qlogvalueaxis.h"
22 22 #include "qlogvalueaxis_p.h"
23 23 #include "chartlogvalueaxisx_p.h"
24 24 #include "chartlogvalueaxisy_p.h"
25 25 #include "abstractdomain_p.h"
26 26 #include <float.h>
27 27 #include <cmath>
28 28
29 29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 30 /*!
31 31 \class QLogValueAxis
32 32 \brief The QLogValueAxis class is used for manipulating chart's axis.
33 33 \mainclass
34 34
35 35 \note If a QLogValueAxis is attached to a series with one or more points with
36 36 negative or zero values on the associated dimension, the series will not be
37 37 plotted at all. This is particularly relevant when XYModelMappers are used,
38 38 since empty cells in models typically contain zero values.
39 39 */
40 40
41 41 /*!
42 \qmlclass LogValuesAxis QLogValueAxis
43 \brief The LogValueAxis element is used for manipulating chart's axes
44 \inherits AbstractAxis
45
46 \note If a LogValueAxis is attached to a series with one or more points with
47 negative or zero values on the associated dimension, the series will not be
48 plotted at all. This is particularly relevant when XYModelMappers are used,
49 since empty cells in models typically contain zero values.
50 */
51
52 /*!
53 42 \property QLogValueAxis::min
54 43 Defines the minimum value on the axis.
55 44 When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
56 45 Value has to be greater then 0.
57 46 */
58 /*!
59 \qmlproperty real LogValuesAxis::min
60 Defines the minimum value on the axis.
61 When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
62 Value has to be greater then 0.
63 */
64 47
65 48 /*!
66 49 \property QLogValueAxis::max
67 50 Defines the maximum value on the axis.
68 51 When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
69 52 Value has to be greater then 0.
70 53 */
71 /*!
72 \qmlproperty real LogValuesAxis::max
73 Defines the maximum value on the axis.
74 When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
75 Value has to be greater then 0.
76 */
77 54
78 55 /*!
79 56 \property QLogValueAxis::base
80 57 Defines the base of the logarithm.
81 58 Value has to be greater then 0 and not equal 1
82 59 */
83 /*!
84 \qmlproperty real LogValuesAxis::base
85 Defines the maximum value on the axis.
86 Defines the base of the logarithm.
87 Value has to be greater then 0 and not equal 1
88 */
89 60
90 61 /*!
91 62 \property QLogValueAxis::labelFormat
92 63 Defines the label format of the axis.
93 64 Supported specifiers are: d, i, o, x, X, f, F, e, E, g, G, c
94 65 See QString::sprintf() for additional details.
95 66 */
96 /*!
97 \qmlproperty real LogValuesAxis::labelFormat
98 Defines the label format of the axis.
99 Supported specifiers are: d, i, o, x, X, f, F, e, E, g, G, c
100 See QString::sprintf() for additional details.
101 */
102 67
103 68 /*!
104 69 \fn void QLogValueAxis::minChanged(qreal min)
105 70 Axis emits signal when \a min of axis has changed.
106 71 */
107 /*!
108 \qmlsignal LogValuesAxis::onMinChanged(qreal min)
109 Axis emits signal when \a min of axis has changed.
110 */
111 72
112 73 /*!
113 74 \fn void QLogValueAxis::maxChanged(qreal max)
114 75 Axis emits signal when \a max of axis has changed.
115 76 */
116 /*!
117 \qmlsignal LogValuesAxis::onMaxChanged(qreal max)
118 Axis emits signal when \a max of axis has changed.
119 */
120 77
121 78 /*!
122 79 \fn void QLogValueAxis::rangeChanged(qreal min, qreal max)
123 80 Axis emits signal when \a min or \a max of axis has changed.
124 81 */
125 82
126 83 /*!
127 84 \fn void QLogValueAxis::labelFormatChanged(const QString &format)
128 85 Axis emits signal when \a format of axis labels has changed.
129 86 */
130 /*!
131 \qmlsignal LogValueAxis::labelFormatChanged(const QString &format)
132 Axis emits signal when \a format of axis labels has changed.
133 */
134 87
135 88 /*!
136 89 \fn void QLogValueAxis::baseChanged(qreal base)
137 90 Axis emits signal when \a base of logarithm of the axis has changed.
138 91 */
139 /*!
140 \qmlsignal LogValuesAxis::baseChanged(qreal base)
141 Axis emits signal when \a base of logarithm of the axis has changed.
142 */
143 92
144 93 /*!
145 94 Constructs an axis object which is a child of \a parent.
146 95 */
147 96 QLogValueAxis::QLogValueAxis(QObject *parent) :
148 97 QAbstractAxis(*new QLogValueAxisPrivate(this), parent)
149 98 {
150 99
151 100 }
152 101
153 102 /*!
154 103 \internal
155 104 */
156 105 QLogValueAxis::QLogValueAxis(QLogValueAxisPrivate &d, QObject *parent) : QAbstractAxis(d, parent)
157 106 {
158 107
159 108 }
160 109
161 110 /*!
162 111 Destroys the object
163 112 */
164 113 QLogValueAxis::~QLogValueAxis()
165 114 {
166 115 Q_D(QLogValueAxis);
167 116 if (d->m_chart)
168 117 d->m_chart->removeAxis(this);
169 118 }
170 119
171 120 void QLogValueAxis::setMin(qreal min)
172 121 {
173 122 Q_D(QLogValueAxis);
174 123 setRange(min, qMax(d->m_max, min));
175 124 }
176 125
177 126 qreal QLogValueAxis::min() const
178 127 {
179 128 Q_D(const QLogValueAxis);
180 129 return d->m_min;
181 130 }
182 131
183 132 void QLogValueAxis::setMax(qreal max)
184 133 {
185 134 Q_D(QLogValueAxis);
186 135 setRange(qMin(d->m_min, max), max);
187 136 }
188 137
189 138 qreal QLogValueAxis::max() const
190 139 {
191 140 Q_D(const QLogValueAxis);
192 141 return d->m_max;
193 142 }
194 143
195 144 /*!
196 145 Sets range from \a min to \a max on the axis.
197 146 If min is greater than max then this function returns without making any changes.
198 147 */
199 148 void QLogValueAxis::setRange(qreal min, qreal max)
200 149 {
201 150 Q_D(QLogValueAxis);
202 151 bool changed = false;
203 152
204 153 if (min > max)
205 154 return;
206 155
207 156 if (min > 0) {
208 157 if (!qFuzzyCompare(d->m_min, min)) {
209 158 d->m_min = min;
210 159 changed = true;
211 160 emit minChanged(min);
212 161 }
213 162
214 163 if (!qFuzzyCompare(d->m_max, max)) {
215 164 d->m_max = max;
216 165 changed = true;
217 166 emit maxChanged(max);
218 167 }
219 168
220 169 if (changed) {
221 170 emit rangeChanged(min, max);
222 171 emit d->rangeChanged(min,max);
223 172 }
224 173 }
225 174 }
226 175
227 176 void QLogValueAxis::setLabelFormat(const QString &format)
228 177 {
229 178 Q_D(QLogValueAxis);
230 179 d->m_format = format;
231 180 emit labelFormatChanged(format);
232 181 }
233 182
234 183 QString QLogValueAxis::labelFormat() const
235 184 {
236 185 Q_D(const QLogValueAxis);
237 186 return d->m_format;
238 187 }
239 188
240 189 void QLogValueAxis::setBase(qreal base)
241 190 {
242 191 // check if base is correct
243 192 if (qFuzzyCompare(base, 1))
244 193 return;
245 194
246 195 if (base > 0) {
247 196 Q_D(QLogValueAxis);
248 197 d->m_base = base;
249 198 emit baseChanged(base);
250 199 }
251 200 }
252 201
253 202 qreal QLogValueAxis::base() const
254 203 {
255 204 Q_D(const QLogValueAxis);
256 205 return d->m_base;
257 206 }
258 207
259 208 /*!
260 209 Returns the type of the axis
261 210 */
262 211 QAbstractAxis::AxisType QLogValueAxis::type() const
263 212 {
264 213 return AxisTypeLogValue;
265 214 }
266 215
267 216 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
268 217
269 218 QLogValueAxisPrivate::QLogValueAxisPrivate(QLogValueAxis *q)
270 219 : QAbstractAxisPrivate(q),
271 220 m_min(1),
272 221 m_max(1),
273 222 m_base(10),
274 223 m_format(QString::null)
275 224 {
276 225 }
277 226
278 227 QLogValueAxisPrivate::~QLogValueAxisPrivate()
279 228 {
280 229
281 230 }
282 231
283 232 void QLogValueAxisPrivate::setMin(const QVariant &min)
284 233 {
285 234 Q_Q(QLogValueAxis);
286 235 bool ok;
287 236 qreal value = min.toReal(&ok);
288 237 if (ok)
289 238 q->setMin(value);
290 239 }
291 240
292 241 void QLogValueAxisPrivate::setMax(const QVariant &max)
293 242 {
294 243
295 244 Q_Q(QLogValueAxis);
296 245 bool ok;
297 246 qreal value = max.toReal(&ok);
298 247 if (ok)
299 248 q->setMax(value);
300 249 }
301 250
302 251 void QLogValueAxisPrivate::setRange(const QVariant &min, const QVariant &max)
303 252 {
304 253 Q_Q(QLogValueAxis);
305 254 bool ok1;
306 255 bool ok2;
307 256 qreal value1 = min.toReal(&ok1);
308 257 qreal value2 = max.toReal(&ok2);
309 258 if (ok1 && ok2)
310 259 q->setRange(value1, value2);
311 260 }
312 261
313 262 void QLogValueAxisPrivate::setRange(qreal min, qreal max)
314 263 {
315 264 Q_Q(QLogValueAxis);
316 265 bool changed = false;
317 266
318 267 if (min > max)
319 268 return;
320 269
321 270 if (min > 0) {
322 271 if (!qFuzzyCompare(m_min, min)) {
323 272 m_min = min;
324 273 changed = true;
325 274 emit q->minChanged(min);
326 275 }
327 276
328 277 if (!qFuzzyCompare(m_max, max)) {
329 278 m_max = max;
330 279 changed = true;
331 280 emit q->maxChanged(max);
332 281 }
333 282
334 283 if (changed) {
335 284 emit rangeChanged(min,max);
336 285 emit q->rangeChanged(min, max);
337 286 }
338 287 }
339 288 }
340 289
341 290 void QLogValueAxisPrivate::initializeGraphics(QGraphicsItem* parent)
342 291 {
343 292 Q_Q(QLogValueAxis);
344 293 ChartAxis* axis(0);
345 294 if (orientation() == Qt::Vertical)
346 295 axis = new ChartLogValueAxisY(q,parent);
347 296 if (orientation() == Qt::Horizontal)
348 297 axis = new ChartLogValueAxisX(q,parent);
349 298
350 299 m_item.reset(axis);
351 300 QAbstractAxisPrivate::initializeGraphics(parent);
352 301 }
353 302
354 303
355 304 void QLogValueAxisPrivate::initializeDomain(AbstractDomain *domain)
356 305 {
357 306 if (orientation() == Qt::Vertical) {
358 307 if(!qFuzzyCompare(m_max, m_min)) {
359 308 domain->setRangeY(m_min, m_max);
360 309 } else if ( domain->minY() > 0) {
361 310 setRange(domain->minY(), domain->maxY());
362 311 } else if (domain->maxY() > 0) {
363 312 domain->setRangeY(m_min, domain->maxY());
364 313 } else {
365 314 domain->setRangeY(1, 10);
366 315 }
367 316 }
368 317 if (orientation() == Qt::Horizontal) {
369 318 if(!qFuzzyCompare(m_max, m_min)) {
370 319 domain->setRangeX(m_min, m_max);
371 320 } else if (domain->minX() > 0){
372 321 setRange(domain->minX(), domain->maxX());
373 322 } else if (domain->maxX() > 0) {
374 323 domain->setRangeX(m_min, domain->maxX());
375 324 } else {
376 325 domain->setRangeX(1, 10);
377 326 }
378 327 }
379 328 }
380 329
381 330 #include "moc_qlogvalueaxis.cpp"
382 331 #include "moc_qlogvalueaxis_p.cpp"
383 332
384 333 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now