##// END OF EJS Templates
Added links LogValueAxis to demos and qml docs pages
Marek Rosa -
r2343:cd130a1062f2
parent child
Show More
@@ -1,96 +1,97
1 /*!
1 /*!
2 \page classes.html
2 \page classes.html
3 \title QtCommercial Charts API
3 \title QtCommercial Charts API
4 \keyword All Classes
4 \keyword All Classes
5
5
6 Charts API is build on top of Qt Graphics View Framework. Charts can be displayed as QGraphicsWidget using QChart class. However
6 Charts API is build on top of Qt Graphics View Framework. Charts can be displayed as QGraphicsWidget using QChart class. However
7 there is also convenience class QChartView which is QWidget based. These lets quickly use QCharts as normal Qt widget.
7 there is also convenience class QChartView which is QWidget based. These lets quickly use QCharts as normal Qt widget.
8
8
9 Each chart type is represented by QAbstractSeries derived class. To create given chart type users have to use instance of related series class and add it to QChart instance.
9 Each chart type is represented by QAbstractSeries derived class. To create given chart type users have to use instance of related series class and add it to QChart instance.
10 \code
10 \code
11 QLineSeries* series = new QLineSeries();
11 QLineSeries* series = new QLineSeries();
12 series->add(0, 6);
12 series->add(0, 6);
13 series->add(2, 4);
13 series->add(2, 4);
14 ...
14 ...
15 chartView->chart()->addSeries(series);
15 chartView->chart()->addSeries(series);
16 chartView->chart()->createDefaultAxes();
16 chartView->chart()->createDefaultAxes();
17 \endcode
17 \endcode
18
18
19 \raw HTML
19 \raw HTML
20 <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
20 <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
21 <tr>
21 <tr>
22 <th class="titleheader" width="25%">
22 <th class="titleheader" width="25%">
23 Common and global
23 Common and global
24 </th>
24 </th>
25 <th class="titleheader" width="25%">
25 <th class="titleheader" width="25%">
26 XY chart
26 XY chart
27 </th>
27 </th>
28 </tr>
28 </tr>
29 <tr>
29 <tr>
30 <td valign="top">
30 <td valign="top">
31 <ul>
31 <ul>
32 <li><a href="qchart.html">QChart</a></li>
32 <li><a href="qchart.html">QChart</a></li>
33 <li><a href="qchartview.html">QChartView</a></li>
33 <li><a href="qchartview.html">QChartView</a></li>
34 <li><a href="qabstractaxis.html">QAbstractAxis</a></li>
34 <li><a href="qabstractaxis.html">QAbstractAxis</a></li>
35 <li><a href="qvalueaxis.html">QValueAxis</a></li>
35 <li><a href="qvalueaxis.html">QValueAxis</a></li>
36 <li><a href="qlogvalueaxis.html">QLogValueAxis</a></li>
36 <li><a href="qbarcategoryaxis.html">QBarCategoryAxis</a></li>
37 <li><a href="qbarcategoryaxis.html">QBarCategoryAxis</a></li>
37 <li><a href="qcategoryaxis.html">QCategoryAxis</a></li>
38 <li><a href="qcategoryaxis.html">QCategoryAxis</a></li>
38 <li><a href="qdatetimeaxis.html">QDateTimeAxis</a></li>
39 <li><a href="qdatetimeaxis.html">QDateTimeAxis</a></li>
39 <li><a href="qlegend.html">QLegend</a></li>
40 <li><a href="qlegend.html">QLegend</a></li>
40 <li><a href="qlegendmarker.html">QLegendMarker</a></li>
41 <li><a href="qlegendmarker.html">QLegendMarker</a></li>
41 <li><a href="qpielegendmarker.html">QPieLegendMarker</a></li>
42 <li><a href="qpielegendmarker.html">QPieLegendMarker</a></li>
42 <li><a href="qxylegendmarker.html">QXYLegendMarker</a></li>
43 <li><a href="qxylegendmarker.html">QXYLegendMarker</a></li>
43 <li><a href="qbarlegendmarker.html">QBarLegendMarker</a></li>
44 <li><a href="qbarlegendmarker.html">QBarLegendMarker</a></li>
44 <li><a href="qarealegendmarker.html">QAreaLegendMarker</a></li>
45 <li><a href="qarealegendmarker.html">QAreaLegendMarker</a></li>
45 <li><a href="qabstractseries.html">QAbstractSeries</a></li>
46 <li><a href="qabstractseries.html">QAbstractSeries</a></li>
46 <li><a href="qchartglobal.html">QChartGlobal</a></li>
47 <li><a href="qchartglobal.html">QChartGlobal</a></li>
47 </ul>
48 </ul>
48 </td>
49 </td>
49 <td valign="top">
50 <td valign="top">
50 <ul>
51 <ul>
51 <li><a href="qxyseries.html">QXYSeries</a></li>
52 <li><a href="qxyseries.html">QXYSeries</a></li>
52 <li><a href="qlineseries.html">QLineSeries</a></li>
53 <li><a href="qlineseries.html">QLineSeries</a></li>
53 <li><a href="qareaseries.html">QAreaSeries</a></li>
54 <li><a href="qareaseries.html">QAreaSeries</a></li>
54 <li><a href="qscatterseries.html">QScatterSeries</a></li>
55 <li><a href="qscatterseries.html">QScatterSeries</a></li>
55 <li><a href="qsplineseries.html">QSplineSeries</a></li>
56 <li><a href="qsplineseries.html">QSplineSeries</a></li>
56 <li><a href="qhxymodelmapper.html">QHXYModelMapper</a></li>
57 <li><a href="qhxymodelmapper.html">QHXYModelMapper</a></li>
57 <li><a href="qvxymodelmapper.html">QVXYModelMapper</a></li>
58 <li><a href="qvxymodelmapper.html">QVXYModelMapper</a></li>
58 </ul>
59 </ul>
59 </td>
60 </td>
60 </tr>
61 </tr>
61 </table>
62 </table>
62 <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
63 <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
63 <tr>
64 <tr>
64 <th class="titleheader" width="25%">
65 <th class="titleheader" width="25%">
65 Pie chart
66 Pie chart
66 </th>
67 </th>
67 <th class="titleheader" width="25%">
68 <th class="titleheader" width="25%">
68 Bar chart
69 Bar chart
69 </th>
70 </th>
70 <tr>
71 <tr>
71 <td valign="top">
72 <td valign="top">
72 <ul>
73 <ul>
73 <li><a href="qpieseries.html">QPieSeries</a></li>
74 <li><a href="qpieseries.html">QPieSeries</a></li>
74 <li><a href="qpieslice.html">QPieSlice</a></li>
75 <li><a href="qpieslice.html">QPieSlice</a></li>
75 <li><a href="qhpiemodelmapper.html">QHPieModelMapper</a></li>
76 <li><a href="qhpiemodelmapper.html">QHPieModelMapper</a></li>
76 <li><a href="qvpiemodelmapper.html">QVPieModelMapper</a></li>
77 <li><a href="qvpiemodelmapper.html">QVPieModelMapper</a></li>
77 </ul>
78 </ul>
78 </td>
79 </td>
79 <td valign="top">
80 <td valign="top">
80 <ul>
81 <ul>
81 <li><a href="qbarseries.html">QBarSeries</a></li>
82 <li><a href="qbarseries.html">QBarSeries</a></li>
82 <li><a href="qbarset.html">QBarSet</a></li>
83 <li><a href="qbarset.html">QBarSet</a></li>
83 <li><a href="qpercentbarseries.html">QPercentBarSeries</a></li>
84 <li><a href="qpercentbarseries.html">QPercentBarSeries</a></li>
84 <li><a href="qstackedbarseries.html">QStackedBarSeries</a></li>
85 <li><a href="qstackedbarseries.html">QStackedBarSeries</a></li>
85 <li><a href="qhbarmodelmapper.html">QHBarModelMapper</a></li>
86 <li><a href="qhbarmodelmapper.html">QHBarModelMapper</a></li>
86 <li><a href="qvbarmodelmapper.html">QVBarModelMapper</a></li>
87 <li><a href="qvbarmodelmapper.html">QVBarModelMapper</a></li>
87 <li><a href="qhorizontalbarseries.html">QHorizontalBarSeries</a></li>
88 <li><a href="qhorizontalbarseries.html">QHorizontalBarSeries</a></li>
88 <li><a href="qhorizontalstackedbarseries.html">QHorizontalStackedBarSeries</a></li>
89 <li><a href="qhorizontalstackedbarseries.html">QHorizontalStackedBarSeries</a></li>
89 <li><a href="qhorizontalpercentbarseries.html">QHorizontalPercentBarSeries</a></li>
90 <li><a href="qhorizontalpercentbarseries.html">QHorizontalPercentBarSeries</a></li>
90 </ul>
91 </ul>
91 </td>
92 </td>
92 </tr>
93 </tr>
93 </table>
94 </table>
94 \endraw
95 \endraw
95
96
96 */
97 */
@@ -1,95 +1,96
1 /*!
1 /*!
2 \page qml.html
2 \page qml.html
3 \title QtCommercial Charts QML API
3 \title QtCommercial Charts QML API
4 \keyword Charts QML API
4 \keyword Charts QML API
5
5
6 QtCommercial Charts QML API is an intuitive and simple way to show charts in your QML
6 QtCommercial Charts QML API is an intuitive and simple way to show charts in your QML
7 applications.
7 applications.
8
8
9 \table
9 \table
10 \row
10 \row
11 \o \br
11 \o \br
12 Use the following QML to create a simple pie chart:
12 Use the following QML to create a simple pie chart:
13 \br
13 \br
14 \br
14 \br
15 \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 1
15 \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 1
16 \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 2
16 \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 2
17 \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 3
17 \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 3
18 \o \inlineimage examples_qmlpiechart.png
18 \o \inlineimage examples_qmlpiechart.png
19 \endtable
19 \endtable
20
20
21 \raw HTML
21 \raw HTML
22 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
22 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
23 <tr>
23 <tr>
24 <th class="titleheader" width="25%"> ChartView and it's properties </th>
24 <th class="titleheader" width="25%"> ChartView and it's properties </th>
25 </tr>
25 </tr>
26 <tr>
26 <tr>
27 <td valign="top">
27 <td valign="top">
28 <ul>
28 <ul>
29 <li><a href="qml-chartview.html">ChartView</a></li>
29 <li><a href="qml-chartview.html">ChartView</a></li>
30 <li><a href="qml-abstractaxis.html">AbstractAxis</a></li>
30 <li><a href="qml-abstractaxis.html">AbstractAxis</a></li>
31 <li><a href="qml-valueaxis.html">ValueAxis</a></li>
31 <li><a href="qml-valueaxis.html">ValueAxis</a></li>
32 <li><a href="qml-logvaluesaxis.html">LogValueAxis</a></li>
32 <li><a href="qml-categoryaxis.html">CategoryAxis</a></li>
33 <li><a href="qml-categoryaxis.html">CategoryAxis</a></li>
33 <li><a href="qml-categoryrange.html">CategoryRange</a></li>
34 <li><a href="qml-categoryrange.html">CategoryRange</a></li>
34 <li><a href="qml-barcategoryaxis.html">BarCategoryAxis</a></li>
35 <li><a href="qml-barcategoryaxis.html">BarCategoryAxis</a></li>
35 <li><a href="qml-datetimeaxis.html">DateTimeAxis</a></li>
36 <li><a href="qml-datetimeaxis.html">DateTimeAxis</a></li>
36 <li><a href="qml-legend.html">Legend</a></li>
37 <li><a href="qml-legend.html">Legend</a></li>
37 <li><a href="qml-abstractseries.html">AbstractSeries</a></li>
38 <li><a href="qml-abstractseries.html">AbstractSeries</a></li>
38 </ul>
39 </ul>
39 </td>
40 </td>
40 </tr>
41 </tr>
41 </table>
42 </table>
42 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
43 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
43 <tr>
44 <tr>
44 <th class="titleheader" width="25%"> XY chart </th>
45 <th class="titleheader" width="25%"> XY chart </th>
45 </tr>
46 </tr>
46 <tr>
47 <tr>
47 <td valign="top">
48 <td valign="top">
48 <ul>
49 <ul>
49 <li><a href="qml-xyseries.html">XYSeries</a></li>
50 <li><a href="qml-xyseries.html">XYSeries</a></li>
50 <li><a href="qml-lineseries.html">LineSeries</a></li>
51 <li><a href="qml-lineseries.html">LineSeries</a></li>
51 <li><a href="qml-areaseries.html">AreaSeries</a></li>
52 <li><a href="qml-areaseries.html">AreaSeries</a></li>
52 <li><a href="qml-scatterseries.html">ScatterSeries</a></li>
53 <li><a href="qml-scatterseries.html">ScatterSeries</a></li>
53 <li><a href="qml-splineseries.html">SplineSeries</a></li>
54 <li><a href="qml-splineseries.html">SplineSeries</a></li>
54 <li><a href="qml-xypoint.html">XYPoint</a></li>
55 <li><a href="qml-xypoint.html">XYPoint</a></li>
55 <li><a href="qml-hxymodelmapper.html">HXYModelMapper</a></li>
56 <li><a href="qml-hxymodelmapper.html">HXYModelMapper</a></li>
56 <li><a href="qml-vxymodelmapper.html">VXYModelMapper</a></li>
57 <li><a href="qml-vxymodelmapper.html">VXYModelMapper</a></li>
57 </ul>
58 </ul>
58 </td>
59 </td>
59 </tr>
60 </tr>
60 </table>
61 </table>
61 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
62 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
62 <tr>
63 <tr>
63 <th class="titleheader" width="25%"> Pie chart </th>
64 <th class="titleheader" width="25%"> Pie chart </th>
64 <tr>
65 <tr>
65 <td valign="top">
66 <td valign="top">
66 <ul>
67 <ul>
67 <li><a href="qml-pieseries.html">PieSeries</a></li>
68 <li><a href="qml-pieseries.html">PieSeries</a></li>
68 <li><a href="qml-pieslice.html">PieSlice</a></li>
69 <li><a href="qml-pieslice.html">PieSlice</a></li>
69 <li><a href="qml-hpiemodelmapper.html">HPieModelMapper</a></li>
70 <li><a href="qml-hpiemodelmapper.html">HPieModelMapper</a></li>
70 <li><a href="qml-vpiemodelmapper.html">VPieModelMapper</a></li>
71 <li><a href="qml-vpiemodelmapper.html">VPieModelMapper</a></li>
71 </ul>
72 </ul>
72 </td>
73 </td>
73 </tr>
74 </tr>
74 </table>
75 </table>
75 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
76 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
76 <tr>
77 <tr>
77 <th class="titleheader" width="25%"> Bar chart </th>
78 <th class="titleheader" width="25%"> Bar chart </th>
78 <tr>
79 <tr>
79 <td valign="top">
80 <td valign="top">
80 <ul>
81 <ul>
81 <li><a href="qml-barseries.html">BarSeries</a></li>
82 <li><a href="qml-barseries.html">BarSeries</a></li>
82 <li><a href="qml-stackedbarseries.html">StackedBarSeries</a></li>
83 <li><a href="qml-stackedbarseries.html">StackedBarSeries</a></li>
83 <li><a href="qml-percentbarseries.html">PercentBarSeries</a></li>
84 <li><a href="qml-percentbarseries.html">PercentBarSeries</a></li>
84 <li><a href="qml-horizontalbarseries.html">HorizontalBarSeries</a></li>
85 <li><a href="qml-horizontalbarseries.html">HorizontalBarSeries</a></li>
85 <li><a href="qml-horizontalstackedbarseries.html">HorizontalStackedBarSeries</a></li>
86 <li><a href="qml-horizontalstackedbarseries.html">HorizontalStackedBarSeries</a></li>
86 <li><a href="qml-horizontalpercentbarseries.html">HorizontalPercentBarSeries</a></li>
87 <li><a href="qml-horizontalpercentbarseries.html">HorizontalPercentBarSeries</a></li>
87 <li><a href="qml-barset.html">BarSet</a></li>
88 <li><a href="qml-barset.html">BarSet</a></li>
88 <li><a href="qml-hbarmodelmapper.html">HBarModelMapper</a></li>
89 <li><a href="qml-hbarmodelmapper.html">HBarModelMapper</a></li>
89 <li><a href="qml-vbarmodelmapper.html">VBarModelMapper</a></li>
90 <li><a href="qml-vbarmodelmapper.html">VBarModelMapper</a></li>
90 </ul>
91 </ul>
91 </td>
92 </td>
92 </tr>
93 </tr>
93 </table>
94 </table>
94 \endraw
95 \endraw
95 */
96 */
@@ -1,372 +1,372
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 "qlogvalueaxis.h"
21 #include "qlogvalueaxis.h"
22 #include "qlogvalueaxis_p.h"
22 #include "qlogvalueaxis_p.h"
23 #include "chartlogvalueaxisx_p.h"
23 #include "chartlogvalueaxisx_p.h"
24 #include "chartlogvalueaxisy_p.h"
24 #include "chartlogvalueaxisy_p.h"
25 #include "abstractdomain_p.h"
25 #include "abstractdomain_p.h"
26 #include <float.h>
26 #include <float.h>
27 #include <cmath>
27 #include <cmath>
28
28
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 /*!
30 /*!
31 \class QLogValueAxis
31 \class QLogValueAxis
32 \brief The QLogValueAxis class is used for manipulating chart's axis.
32 \brief The QLogValueAxis class is used for manipulating chart's axis.
33 \mainclass
33 \mainclass
34 */
34 */
35
35
36 /*!
36 /*!
37 \qmlclass DateTimeAxis QLogValueAxis
37 \qmlclass LogValuesAxis QLogValueAxis
38 \brief The QLogValueAxis element is used for manipulating chart's axes
38 \brief The LogValueAxis element is used for manipulating chart's axes
39 \inherits AbstractAxis
39 \inherits AbstractAxis
40 */
40 */
41
41
42 /*!
42 /*!
43 \property QLogValueAxis::min
43 \property QLogValueAxis::min
44 Defines the minimum value on the axis.
44 Defines the minimum value on the axis.
45 When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
45 When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
46 Value has to be greater then 0.
46 Value has to be greater then 0.
47 */
47 */
48 /*!
48 /*!
49 \qmlproperty real LogValuesAxis::min
49 \qmlproperty real LogValuesAxis::min
50 Defines the minimum value on the axis.
50 Defines the minimum value on the axis.
51 When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
51 When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
52 Value has to be greater then 0.
52 Value has to be greater then 0.
53 */
53 */
54
54
55 /*!
55 /*!
56 \property QLogValueAxis::max
56 \property QLogValueAxis::max
57 Defines the maximum value on the axis.
57 Defines the maximum value on the axis.
58 When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
58 When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
59 Value has to be greater then 0.
59 Value has to be greater then 0.
60 */
60 */
61 /*!
61 /*!
62 \qmlproperty real LogValuesAxis::max
62 \qmlproperty real LogValuesAxis::max
63 Defines the maximum value on the axis.
63 Defines the maximum value on the axis.
64 When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
64 When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
65 Value has to be greater then 0.
65 Value has to be greater then 0.
66 */
66 */
67
67
68 /*!
68 /*!
69 \property QLogValueAxis::base
69 \property QLogValueAxis::base
70 Defines the base of the logarithm.
70 Defines the base of the logarithm.
71 Value has to be greater then 0 and not equal 1
71 Value has to be greater then 0 and not equal 1
72 */
72 */
73 /*!
73 /*!
74 \qmlproperty real LogValuesAxis::base
74 \qmlproperty real LogValuesAxis::base
75 Defines the maximum value on the axis.
75 Defines the maximum value on the axis.
76 Defines the base of the logarithm.
76 Defines the base of the logarithm.
77 Value has to be greater then 0 and not equal 1
77 Value has to be greater then 0 and not equal 1
78 */
78 */
79
79
80 /*!
80 /*!
81 \property QLogValueAxis::labelFormat
81 \property QLogValueAxis::labelFormat
82 Defines the label format of the axis.
82 Defines the label format of the axis.
83 Supported specifiers are: d, i, o, x, X, f, F, e, E, g, G, c
83 Supported specifiers are: d, i, o, x, X, f, F, e, E, g, G, c
84 See QString::sprintf() for additional details.
84 See QString::sprintf() for additional details.
85 */
85 */
86 /*!
86 /*!
87 \qmlproperty real LogValuesAxis::labelFormat
87 \qmlproperty real LogValuesAxis::labelFormat
88 Defines the label format of the axis.
88 Defines the label format of the axis.
89 Supported specifiers are: d, i, o, x, X, f, F, e, E, g, G, c
89 Supported specifiers are: d, i, o, x, X, f, F, e, E, g, G, c
90 See QString::sprintf() for additional details.
90 See QString::sprintf() for additional details.
91 */
91 */
92
92
93 /*!
93 /*!
94 \fn void QLogValueAxis::minChanged(qreal min)
94 \fn void QLogValueAxis::minChanged(qreal min)
95 Axis emits signal when \a min of axis has changed.
95 Axis emits signal when \a min of axis has changed.
96 */
96 */
97 /*!
97 /*!
98 \qmlsignal LogValuesAxis::onMinChanged(qreal min)
98 \qmlsignal LogValuesAxis::onMinChanged(qreal min)
99 Axis emits signal when \a min of axis has changed.
99 Axis emits signal when \a min of axis has changed.
100 */
100 */
101
101
102 /*!
102 /*!
103 \fn void QLogValueAxis::maxChanged(qreal max)
103 \fn void QLogValueAxis::maxChanged(qreal max)
104 Axis emits signal when \a max of axis has changed.
104 Axis emits signal when \a max of axis has changed.
105 */
105 */
106 /*!
106 /*!
107 \qmlsignal LogValuesAxis::onMaxChanged(qreal max)
107 \qmlsignal LogValuesAxis::onMaxChanged(qreal max)
108 Axis emits signal when \a max of axis has changed.
108 Axis emits signal when \a max of axis has changed.
109 */
109 */
110
110
111 /*!
111 /*!
112 \fn void QLogValueAxis::rangeChanged(qreal min, qreal max)
112 \fn void QLogValueAxis::rangeChanged(qreal min, qreal max)
113 Axis emits signal when \a min or \a max of axis has changed.
113 Axis emits signal when \a min or \a max of axis has changed.
114 */
114 */
115
115
116 /*!
116 /*!
117 \fn void QLogValueAxis::labelFormatChanged(const QString &format)
117 \fn void QLogValueAxis::labelFormatChanged(const QString &format)
118 Axis emits signal when \a format of axis labels has changed.
118 Axis emits signal when \a format of axis labels has changed.
119 */
119 */
120 /*!
120 /*!
121 \qmlsignal LogValueAxis::labelFormatChanged(const QString &format)
121 \qmlsignal LogValueAxis::labelFormatChanged(const QString &format)
122 Axis emits signal when \a format of axis labels has changed.
122 Axis emits signal when \a format of axis labels has changed.
123 */
123 */
124
124
125 /*!
125 /*!
126 \fn void QLogValueAxis::baseChanged(qreal base)
126 \fn void QLogValueAxis::baseChanged(qreal base)
127 Axis emits signal when \a base of logarithm of the axis has changed.
127 Axis emits signal when \a base of logarithm of the axis has changed.
128 */
128 */
129 /*!
129 /*!
130 \qmlsignal LogValuesAxis::baseChanged(qreal base)
130 \qmlsignal LogValuesAxis::baseChanged(qreal base)
131 Axis emits signal when \a base of logarithm of the axis has changed.
131 Axis emits signal when \a base of logarithm of the axis has changed.
132 */
132 */
133
133
134 /*!
134 /*!
135 Constructs an axis object which is a child of \a parent.
135 Constructs an axis object which is a child of \a parent.
136 */
136 */
137 QLogValueAxis::QLogValueAxis(QObject *parent) :
137 QLogValueAxis::QLogValueAxis(QObject *parent) :
138 QAbstractAxis(*new QLogValueAxisPrivate(this), parent)
138 QAbstractAxis(*new QLogValueAxisPrivate(this), parent)
139 {
139 {
140
140
141 }
141 }
142
142
143 /*!
143 /*!
144 \internal
144 \internal
145 */
145 */
146 QLogValueAxis::QLogValueAxis(QLogValueAxisPrivate &d, QObject *parent) : QAbstractAxis(d, parent)
146 QLogValueAxis::QLogValueAxis(QLogValueAxisPrivate &d, QObject *parent) : QAbstractAxis(d, parent)
147 {
147 {
148
148
149 }
149 }
150
150
151 /*!
151 /*!
152 Destroys the object
152 Destroys the object
153 */
153 */
154 QLogValueAxis::~QLogValueAxis()
154 QLogValueAxis::~QLogValueAxis()
155 {
155 {
156 Q_D(QLogValueAxis);
156 Q_D(QLogValueAxis);
157 if (d->m_chart)
157 if (d->m_chart)
158 d->m_chart->removeAxis(this);
158 d->m_chart->removeAxis(this);
159 }
159 }
160
160
161 void QLogValueAxis::setMin(qreal min)
161 void QLogValueAxis::setMin(qreal min)
162 {
162 {
163 Q_D(QLogValueAxis);
163 Q_D(QLogValueAxis);
164 setRange(min, qMax(d->m_max, min));
164 setRange(min, qMax(d->m_max, min));
165 }
165 }
166
166
167 qreal QLogValueAxis::min() const
167 qreal QLogValueAxis::min() const
168 {
168 {
169 Q_D(const QLogValueAxis);
169 Q_D(const QLogValueAxis);
170 return d->m_min;
170 return d->m_min;
171 }
171 }
172
172
173 void QLogValueAxis::setMax(qreal max)
173 void QLogValueAxis::setMax(qreal max)
174 {
174 {
175 Q_D(QLogValueAxis);
175 Q_D(QLogValueAxis);
176 setRange(qMin(d->m_min, max), max);
176 setRange(qMin(d->m_min, max), max);
177 }
177 }
178
178
179 qreal QLogValueAxis::max() const
179 qreal QLogValueAxis::max() const
180 {
180 {
181 Q_D(const QLogValueAxis);
181 Q_D(const QLogValueAxis);
182 return d->m_max;
182 return d->m_max;
183 }
183 }
184
184
185 /*!
185 /*!
186 Sets range from \a min to \a max on the axis.
186 Sets range from \a min to \a max on the axis.
187 If min is greater than max then this function returns without making any changes.
187 If min is greater than max then this function returns without making any changes.
188 */
188 */
189 void QLogValueAxis::setRange(qreal min, qreal max)
189 void QLogValueAxis::setRange(qreal min, qreal max)
190 {
190 {
191 Q_D(QLogValueAxis);
191 Q_D(QLogValueAxis);
192 bool changed = false;
192 bool changed = false;
193
193
194 if (min > max)
194 if (min > max)
195 return;
195 return;
196
196
197 if (min > 0) {
197 if (min > 0) {
198 if (!qFuzzyCompare(d->m_min, min)) {
198 if (!qFuzzyCompare(d->m_min, min)) {
199 d->m_min = min;
199 d->m_min = min;
200 changed = true;
200 changed = true;
201 emit minChanged(min);
201 emit minChanged(min);
202 }
202 }
203
203
204 if (!qFuzzyCompare(d->m_max, max)) {
204 if (!qFuzzyCompare(d->m_max, max)) {
205 d->m_max = max;
205 d->m_max = max;
206 changed = true;
206 changed = true;
207 emit maxChanged(max);
207 emit maxChanged(max);
208 }
208 }
209
209
210 if (changed) {
210 if (changed) {
211 emit rangeChanged(min, max);
211 emit rangeChanged(min, max);
212 emit d->rangeChanged(min,max);
212 emit d->rangeChanged(min,max);
213 }
213 }
214 }
214 }
215 }
215 }
216
216
217 void QLogValueAxis::setLabelFormat(const QString &format)
217 void QLogValueAxis::setLabelFormat(const QString &format)
218 {
218 {
219 Q_D(QLogValueAxis);
219 Q_D(QLogValueAxis);
220 d->m_format = format;
220 d->m_format = format;
221 emit labelFormatChanged(format);
221 emit labelFormatChanged(format);
222 }
222 }
223
223
224 QString QLogValueAxis::labelFormat() const
224 QString QLogValueAxis::labelFormat() const
225 {
225 {
226 Q_D(const QLogValueAxis);
226 Q_D(const QLogValueAxis);
227 return d->m_format;
227 return d->m_format;
228 }
228 }
229
229
230 void QLogValueAxis::setBase(qreal base)
230 void QLogValueAxis::setBase(qreal base)
231 {
231 {
232 // check if base is correct
232 // check if base is correct
233 if (qFuzzyCompare(base, 1))
233 if (qFuzzyCompare(base, 1))
234 return;
234 return;
235
235
236 if (base > 0) {
236 if (base > 0) {
237 Q_D(QLogValueAxis);
237 Q_D(QLogValueAxis);
238 d->m_base = base;
238 d->m_base = base;
239 emit baseChanged(base);
239 emit baseChanged(base);
240 }
240 }
241 }
241 }
242
242
243 qreal QLogValueAxis::base() const
243 qreal QLogValueAxis::base() const
244 {
244 {
245 Q_D(const QLogValueAxis);
245 Q_D(const QLogValueAxis);
246 return d->m_base;
246 return d->m_base;
247 }
247 }
248
248
249 /*!
249 /*!
250 Returns the type of the axis
250 Returns the type of the axis
251 */
251 */
252 QAbstractAxis::AxisType QLogValueAxis::type() const
252 QAbstractAxis::AxisType QLogValueAxis::type() const
253 {
253 {
254 return AxisTypeLogValue;
254 return AxisTypeLogValue;
255 }
255 }
256
256
257 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
257 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
258
258
259 QLogValueAxisPrivate::QLogValueAxisPrivate(QLogValueAxis *q)
259 QLogValueAxisPrivate::QLogValueAxisPrivate(QLogValueAxis *q)
260 : QAbstractAxisPrivate(q),
260 : QAbstractAxisPrivate(q),
261 m_min(1),
261 m_min(1),
262 m_max(1),
262 m_max(1),
263 m_base(10),
263 m_base(10),
264 m_format(QString::null)
264 m_format(QString::null)
265 {
265 {
266 }
266 }
267
267
268 QLogValueAxisPrivate::~QLogValueAxisPrivate()
268 QLogValueAxisPrivate::~QLogValueAxisPrivate()
269 {
269 {
270
270
271 }
271 }
272
272
273 void QLogValueAxisPrivate::setMin(const QVariant &min)
273 void QLogValueAxisPrivate::setMin(const QVariant &min)
274 {
274 {
275 Q_Q(QLogValueAxis);
275 Q_Q(QLogValueAxis);
276 bool ok;
276 bool ok;
277 qreal value = min.toReal(&ok);
277 qreal value = min.toReal(&ok);
278 if (ok)
278 if (ok)
279 q->setMin(value);
279 q->setMin(value);
280 }
280 }
281
281
282 void QLogValueAxisPrivate::setMax(const QVariant &max)
282 void QLogValueAxisPrivate::setMax(const QVariant &max)
283 {
283 {
284
284
285 Q_Q(QLogValueAxis);
285 Q_Q(QLogValueAxis);
286 bool ok;
286 bool ok;
287 qreal value = max.toReal(&ok);
287 qreal value = max.toReal(&ok);
288 if (ok)
288 if (ok)
289 q->setMax(value);
289 q->setMax(value);
290 }
290 }
291
291
292 void QLogValueAxisPrivate::setRange(const QVariant &min, const QVariant &max)
292 void QLogValueAxisPrivate::setRange(const QVariant &min, const QVariant &max)
293 {
293 {
294 Q_Q(QLogValueAxis);
294 Q_Q(QLogValueAxis);
295 bool ok1;
295 bool ok1;
296 bool ok2;
296 bool ok2;
297 qreal value1 = min.toReal(&ok1);
297 qreal value1 = min.toReal(&ok1);
298 qreal value2 = max.toReal(&ok2);
298 qreal value2 = max.toReal(&ok2);
299 if (ok1 && ok2)
299 if (ok1 && ok2)
300 q->setRange(value1, value2);
300 q->setRange(value1, value2);
301 }
301 }
302
302
303 void QLogValueAxisPrivate::setRange(qreal min, qreal max)
303 void QLogValueAxisPrivate::setRange(qreal min, qreal max)
304 {
304 {
305 Q_Q(QLogValueAxis);
305 Q_Q(QLogValueAxis);
306 bool changed = false;
306 bool changed = false;
307
307
308 if (min > max)
308 if (min > max)
309 return;
309 return;
310
310
311 if (min > 0) {
311 if (min > 0) {
312 if (!qFuzzyCompare(m_min, min)) {
312 if (!qFuzzyCompare(m_min, min)) {
313 m_min = min;
313 m_min = min;
314 changed = true;
314 changed = true;
315 emit q->minChanged(min);
315 emit q->minChanged(min);
316 }
316 }
317
317
318 if (!qFuzzyCompare(m_max, max)) {
318 if (!qFuzzyCompare(m_max, max)) {
319 m_max = max;
319 m_max = max;
320 changed = true;
320 changed = true;
321 emit q->maxChanged(max);
321 emit q->maxChanged(max);
322 }
322 }
323
323
324 if (changed) {
324 if (changed) {
325 emit rangeChanged(min,max);
325 emit rangeChanged(min,max);
326 emit q->rangeChanged(min, max);
326 emit q->rangeChanged(min, max);
327 }
327 }
328 }
328 }
329 }
329 }
330
330
331 void QLogValueAxisPrivate::initializeGraphics(QGraphicsItem* parent)
331 void QLogValueAxisPrivate::initializeGraphics(QGraphicsItem* parent)
332 {
332 {
333 Q_Q(QLogValueAxis);
333 Q_Q(QLogValueAxis);
334 ChartAxis* axis(0);
334 ChartAxis* axis(0);
335 if (orientation() == Qt::Vertical)
335 if (orientation() == Qt::Vertical)
336 axis = new ChartLogValueAxisY(q,parent);
336 axis = new ChartLogValueAxisY(q,parent);
337 if (orientation() == Qt::Horizontal)
337 if (orientation() == Qt::Horizontal)
338 axis = new ChartLogValueAxisX(q,parent);
338 axis = new ChartLogValueAxisX(q,parent);
339
339
340 m_item.reset(axis);
340 m_item.reset(axis);
341 QAbstractAxisPrivate::initializeGraphics(parent);
341 QAbstractAxisPrivate::initializeGraphics(parent);
342 }
342 }
343
343
344
344
345 void QLogValueAxisPrivate::initializeDomain(AbstractDomain *domain)
345 void QLogValueAxisPrivate::initializeDomain(AbstractDomain *domain)
346 {
346 {
347 if (orientation() == Qt::Vertical) {
347 if (orientation() == Qt::Vertical) {
348 if(!qFuzzyCompare(m_max, m_min)) {
348 if(!qFuzzyCompare(m_max, m_min)) {
349 domain->setRangeY(m_min, m_max);
349 domain->setRangeY(m_min, m_max);
350 }
350 }
351 else if ( domain->minY() > 0) {
351 else if ( domain->minY() > 0) {
352 setRange(domain->minY(), domain->maxY());
352 setRange(domain->minY(), domain->maxY());
353 } else {
353 } else {
354 domain->setRangeY(m_min, domain->maxY());
354 domain->setRangeY(m_min, domain->maxY());
355 }
355 }
356 }
356 }
357 if (orientation() == Qt::Horizontal) {
357 if (orientation() == Qt::Horizontal) {
358 if(!qFuzzyCompare(m_max, m_min)) {
358 if(!qFuzzyCompare(m_max, m_min)) {
359 domain->setRangeX(m_min, m_max);
359 domain->setRangeX(m_min, m_max);
360 }
360 }
361 else if (domain->minX() > 0){
361 else if (domain->minX() > 0){
362 setRange(domain->minX(), domain->maxX());
362 setRange(domain->minX(), domain->maxX());
363 } else {
363 } else {
364 domain->setRangeX(m_min, domain->maxX());
364 domain->setRangeX(m_min, domain->maxX());
365 }
365 }
366 }
366 }
367 }
367 }
368
368
369 #include "moc_qlogvalueaxis.cpp"
369 #include "moc_qlogvalueaxis.cpp"
370 #include "moc_qlogvalueaxis_p.cpp"
370 #include "moc_qlogvalueaxis_p.cpp"
371
371
372 QTCOMMERCIALCHART_END_NAMESPACE
372 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now