##// END OF EJS Templates
Readme up to date for 1.3.0, and some minor doc fixes...
Miikka Heikkinen -
r2571:ceb9510a0ade
parent child
Show More
@@ -1,87 +1,98
1 --------------------------------
1 --------------------------------
2 Commercial Charts Add-on 1.3.0
2 Commercial Charts Add-on 1.3.0
3 --------------------------------
3 --------------------------------
4
4
5 What's in Qt Commercial Charts
5 What's in Qt Commercial Charts
6 =============================
6 =============================
7
7
8 Directory structure:
8 Directory structure:
9
9
10 src/
10 src/
11 Source code of the Qt Commercial Charts
11 Source code of the Qt Commercial Charts
12 plugins/
12 plugins/
13 QML bindings plugin and QtCreator plugin
13 QML bindings plugins and QtCreator plugin
14 examples/
14 examples/
15 Some examples of using Qt Commercial Charts
15 Some examples of using Qt Commercial Charts
16 demos/
16 demos/
17 More versatile example applications showing how to customize charts,
17 More versatile example applications showing how to customize charts,
18 combine several chart types and implement interaction in charts
18 combine several chart types and implement interaction in charts
19 doc/
19 doc/
20 Documentation
20 Documentation
21 licenses/
21 licenses/
22 Licensing information
22 Licensing information
23
23
24 Building
24 Building
25 ========
25 ========
26 Please note that if you have already installed a previous version of
26 Please note that if you have already installed a previous version of
27 QtCommercial Charts, you should first uninstall it with
27 QtCommercial Charts, you should first uninstall it with
28 make uninstall
28 make uninstall
29
29
30 Configure project with qmake and build project with make:
30 Configure project with qmake and build project with make:
31 (Linux) make
31 (Linux) make
32 (Windows with MinGw) mingw32-make
32 (Windows with MinGw) mingw32-make
33 (Visual Studio) nmake
33 (Visual Studio) nmake
34 (OSX) make
34 (OSX) make
35
35
36 For debug builds:
36 For debug builds:
37 qmake CONFIG+=debug; make
37 qmake CONFIG+=debug; make
38 or
38 or
39 qmake CONFIG+=debug_and_release; make debug
39 qmake CONFIG+=debug_and_release; make debug
40
40
41 For release builds:
41 For release builds:
42 qmake CONFIG+=release ; make
42 qmake CONFIG+=release ; make
43 or
43 or
44 qmake CONFIG+=debug_and_release; make release
44 qmake CONFIG+=debug_and_release; make release
45
45
46 For both builds
46 For both builds
47 qmake CONFIG+="debug_and_release build_all"; make
47 qmake CONFIG+="debug_and_release build_all"; make
48
48
49 If you want to install the libraries to your Qt library directory use:
49 If you want to install the libraries to your Qt library directory use:
50 make install
50 make install
51
51
52 If you want to uninstall the libraries
52 If you want to uninstall the libraries
53 make uninstall
53 make uninstall
54
54
55 Building as a statically linked library
55 Building as a statically linked library
56 =======================================
56 =======================================
57
57
58 The same as above applies you will just have to add staticlib to the CONFIG:
58 The same as above applies you will just have to add staticlib to the CONFIG:
59 qmake CONFIG+=staticlib
59 qmake CONFIG+=staticlib
60
60
61 Documentation
61 Documentation
62 =============
62 =============
63 Documentation can be found from doc/html and doc/qch directories. The documentation
63 Documentation can be found from doc/html and doc/qch directories. The documentation
64 can also be generated with:
64 can also be generated with:
65 make docs
65 make docs
66
66
67 Main Changes between 1.2.1 and 1.3.0
67 Main Changes between 1.2.1 and 1.3.0
68 ===================================
68 ====================================
69
69
70 - New chart type added: Polar chart
70 - New chart type added: Polar chart
71 - New series type added: Box and whiskers
71 - QtQuick 2 support added
72 - QtQuick 2 support added
72
73
73 Bug Fixes
74 Bug Fixes and minor new features
74 ==========
75 ================================
75 TODO
76
76
77 Known Issues
77 - New: Added missing QML support for LogValueAxis
78 ============
78 - New: Implement index based removing/replacing points in series
79 - Automatic scaling of the axes is only done when you add a series on a chart
79 - New: Added API to specify plot area background
80 - DateTimeAxis is not supported on ARM because of floating point precision
80 - New: Added HTML support for various text items
81 issues (qreals are floats)
81 Note that '\n' no longer causes new line in text items, use HTML tag <br/> instead
82 - Declarative plugin is available from Qt 4.7.4 onwards because of missing
82 - New: Added QChart::zoomReset() and QChart::isZoomed()
83 Q_REVISION macro in the earlier Qt releases
83 - New: Added API for setting roundness of the corners for the background of the chart
84 - Defining axis min-max values sometimes affects other axes with the same orientation
84 - Fixed: If vertical QLogValueAxis base is selected so that it has only single visible tick,
85 - See for example the secondary y-axis of QML Weather demo application
85 its label always displays as "..."
86 - The work-around is to set axis range dynamically instead of initializing min and
86 - Fixed: Crash when removing pie series from chart
87 max properties to certain values
87 - Fixed: Most themes disable axis shades
88 - Fixed: Lingering shades from high contrast theme
89 - Fixed: Crash when adding/removing points during animation
90 - Fixed: Wrong expand direction with rotated chart view
91 - Fixed: Android build errors
92 - Fixed: Legend marker brush for series with black pen
93 - Fixed: Explicitly set default pen/brush/font got overridden by theme
94 - Fixed: Multi-line axis titles and labels now position correctly
95 - Fixed: Legend markers text truncation with small font sizes
96 - Fixed: QChartView right click zoom out when zooming only along one axis
97 - Fixed: Crash or memory leak when resetting animation options mid-animation
98 - Fixed: QBarCategoryAxis doesn't notify domain on category remove
@@ -1,104 +1,107
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 \note Since QtCommercial Charts utilizes Qt Graphics View Framework for drawing, it works best
21 \note Since QtCommercial Charts utilizes Qt Graphics View Framework for drawing, it works best
22 with QtQuick 1, which is based on the same framework.
22 with QtQuick 1, which is based on the same framework.
23 As of release 1.3.0, QtCommercial Charts is also usable with QtQuick 2, though the performance
23 As of release 1.3.0, QtCommercial Charts is also usable with QtQuick 2, though the performance
24 is slightly worse than with QtQuick 1 due to additional rendering step that is required.
24 is slightly worse than with QtQuick 1 due to additional rendering step that is required.
25
25
26 \note QtQuick 1 is supported from Qt 4.7.4 onwards because of missing
27 Q_REVISION macro in the earlier Qt releases. QtQuick 2 is supported with only Qt 5.
28
26 \raw HTML
29 \raw HTML
27 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
30 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
28 <tr>
31 <tr>
29 <th class="titleheader" width="25%"> ChartView and it's properties </th>
32 <th class="titleheader" width="25%"> ChartView and it's properties </th>
30 </tr>
33 </tr>
31 <tr>
34 <tr>
32 <td valign="top">
35 <td valign="top">
33 <ul>
36 <ul>
34 <li><a href="qml-chartview.html">ChartView</a></li>
37 <li><a href="qml-chartview.html">ChartView</a></li>
35 <li><a href="qml-polarchartview.html">PolarChartView</a></li>
38 <li><a href="qml-polarchartview.html">PolarChartView</a></li>
36 <li><a href="qml-abstractaxis.html">AbstractAxis</a></li>
39 <li><a href="qml-abstractaxis.html">AbstractAxis</a></li>
37 <li><a href="qml-valueaxis.html">ValueAxis</a></li>
40 <li><a href="qml-valueaxis.html">ValueAxis</a></li>
38 <li><a href="qml-logvaluesaxis.html">LogValueAxis</a></li>
41 <li><a href="qml-logvaluesaxis.html">LogValueAxis</a></li>
39 <li><a href="qml-categoryaxis.html">CategoryAxis</a></li>
42 <li><a href="qml-categoryaxis.html">CategoryAxis</a></li>
40 <li><a href="qml-categoryrange.html">CategoryRange</a></li>
43 <li><a href="qml-categoryrange.html">CategoryRange</a></li>
41 <li><a href="qml-barcategoryaxis.html">BarCategoryAxis</a></li>
44 <li><a href="qml-barcategoryaxis.html">BarCategoryAxis</a></li>
42 <li><a href="qml-datetimeaxis.html">DateTimeAxis</a></li>
45 <li><a href="qml-datetimeaxis.html">DateTimeAxis</a></li>
43 <li><a href="qml-legend.html">Legend</a></li>
46 <li><a href="qml-legend.html">Legend</a></li>
44 <li><a href="qml-abstractseries.html">AbstractSeries</a></li>
47 <li><a href="qml-abstractseries.html">AbstractSeries</a></li>
45 </ul>
48 </ul>
46 </td>
49 </td>
47 </tr>
50 </tr>
48 </table>
51 </table>
49 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
52 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
50 <tr>
53 <tr>
51 <th class="titleheader" width="25%"> XY chart </th>
54 <th class="titleheader" width="25%"> XY chart </th>
52 </tr>
55 </tr>
53 <tr>
56 <tr>
54 <td valign="top">
57 <td valign="top">
55 <ul>
58 <ul>
56 <li><a href="qml-xyseries.html">XYSeries</a></li>
59 <li><a href="qml-xyseries.html">XYSeries</a></li>
57 <li><a href="qml-lineseries.html">LineSeries</a></li>
60 <li><a href="qml-lineseries.html">LineSeries</a></li>
58 <li><a href="qml-areaseries.html">AreaSeries</a></li>
61 <li><a href="qml-areaseries.html">AreaSeries</a></li>
59 <li><a href="qml-scatterseries.html">ScatterSeries</a></li>
62 <li><a href="qml-scatterseries.html">ScatterSeries</a></li>
60 <li><a href="qml-splineseries.html">SplineSeries</a></li>
63 <li><a href="qml-splineseries.html">SplineSeries</a></li>
61 <li><a href="qml-xypoint.html">XYPoint</a></li>
64 <li><a href="qml-xypoint.html">XYPoint</a></li>
62 <li><a href="qml-hxymodelmapper.html">HXYModelMapper</a></li>
65 <li><a href="qml-hxymodelmapper.html">HXYModelMapper</a></li>
63 <li><a href="qml-vxymodelmapper.html">VXYModelMapper</a></li>
66 <li><a href="qml-vxymodelmapper.html">VXYModelMapper</a></li>
64 </ul>
67 </ul>
65 </td>
68 </td>
66 </tr>
69 </tr>
67 </table>
70 </table>
68 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
71 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
69 <tr>
72 <tr>
70 <th class="titleheader" width="25%"> Pie chart </th>
73 <th class="titleheader" width="25%"> Pie chart </th>
71 <tr>
74 <tr>
72 <td valign="top">
75 <td valign="top">
73 <ul>
76 <ul>
74 <li><a href="qml-pieseries.html">PieSeries</a></li>
77 <li><a href="qml-pieseries.html">PieSeries</a></li>
75 <li><a href="qml-pieslice.html">PieSlice</a></li>
78 <li><a href="qml-pieslice.html">PieSlice</a></li>
76 <li><a href="qml-hpiemodelmapper.html">HPieModelMapper</a></li>
79 <li><a href="qml-hpiemodelmapper.html">HPieModelMapper</a></li>
77 <li><a href="qml-vpiemodelmapper.html">VPieModelMapper</a></li>
80 <li><a href="qml-vpiemodelmapper.html">VPieModelMapper</a></li>
78 </ul>
81 </ul>
79 </td>
82 </td>
80 </tr>
83 </tr>
81 </table>
84 </table>
82 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
85 <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
83 <tr>
86 <tr>
84 <th class="titleheader" width="25%"> Bar chart </th>
87 <th class="titleheader" width="25%"> Bar chart </th>
85 <tr>
88 <tr>
86 <td valign="top">
89 <td valign="top">
87 <ul>
90 <ul>
88 <li><a href="qml-barseries.html">BarSeries</a></li>
91 <li><a href="qml-barseries.html">BarSeries</a></li>
89 <li><a href="qml-stackedbarseries.html">StackedBarSeries</a></li>
92 <li><a href="qml-stackedbarseries.html">StackedBarSeries</a></li>
90 <li><a href="qml-percentbarseries.html">PercentBarSeries</a></li>
93 <li><a href="qml-percentbarseries.html">PercentBarSeries</a></li>
91 <li><a href="qml-horizontalbarseries.html">HorizontalBarSeries</a></li>
94 <li><a href="qml-horizontalbarseries.html">HorizontalBarSeries</a></li>
92 <li><a href="qml-horizontalstackedbarseries.html">HorizontalStackedBarSeries</a></li>
95 <li><a href="qml-horizontalstackedbarseries.html">HorizontalStackedBarSeries</a></li>
93 <li><a href="qml-horizontalpercentbarseries.html">HorizontalPercentBarSeries</a></li>
96 <li><a href="qml-horizontalpercentbarseries.html">HorizontalPercentBarSeries</a></li>
94 <li><a href="qml-barset.html">BarSet</a></li>
97 <li><a href="qml-barset.html">BarSet</a></li>
95 <li><a href="qml-boxplotseries.html">BoxPlotSeries</a></li>
98 <li><a href="qml-boxplotseries.html">BoxPlotSeries</a></li>
96 <li><a href="qml-boxset.html">BoxSet</a></li>
99 <li><a href="qml-boxset.html">BoxSet</a></li>
97 <li><a href="qml-hbarmodelmapper.html">HBarModelMapper</a></li>
100 <li><a href="qml-hbarmodelmapper.html">HBarModelMapper</a></li>
98 <li><a href="qml-vbarmodelmapper.html">VBarModelMapper</a></li>
101 <li><a href="qml-vbarmodelmapper.html">VBarModelMapper</a></li>
99 </ul>
102 </ul>
100 </td>
103 </td>
101 </tr>
104 </tr>
102 </table>
105 </table>
103 \endraw
106 \endraw
104 */
107 */
@@ -1,310 +1,312
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2013 Digia Plc
3 ** Copyright (C) 2013 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 "qabstractseries.h"
21 #include "qabstractseries.h"
22 #include "qabstractseries_p.h"
22 #include "qabstractseries_p.h"
23 #include "chartdataset_p.h"
23 #include "chartdataset_p.h"
24 #include "qchart.h"
24 #include "qchart.h"
25 #include "qchart_p.h"
25 #include "qchart_p.h"
26 #include "chartitem_p.h"
26 #include "chartitem_p.h"
27 #include "xydomain_p.h"
27 #include "xydomain_p.h"
28 #include "xlogydomain_p.h"
28 #include "xlogydomain_p.h"
29 #include "logxydomain_p.h"
29 #include "logxydomain_p.h"
30 #include "logxlogydomain_p.h"
30 #include "logxlogydomain_p.h"
31
31
32 QTCOMMERCIALCHART_BEGIN_NAMESPACE
32 QTCOMMERCIALCHART_BEGIN_NAMESPACE
33
33
34 /*!
34 /*!
35 \class QAbstractSeries
35 \class QAbstractSeries
36 \brief Base class for all QtCommercial Chart series.
36 \brief Base class for all QtCommercial Chart series.
37 \mainclass
37 \mainclass
38
38
39 Usually you use the series type specific inherited classes instead of the base class.
39 Usually you use the series type specific inherited classes instead of the base class.
40 \sa QXYSeries, QLineSeries, QSplineSeries, QScatterSeries, QAreaSeries, QAbstractBarSeries, QStackedBarSeries,
40 \sa QXYSeries, QLineSeries, QSplineSeries, QScatterSeries, QAreaSeries, QAbstractBarSeries, QStackedBarSeries,
41 QPercentBarSeries, QPieSeries
41 QPercentBarSeries, QPieSeries
42 */
42 */
43 /*!
43 /*!
44 \qmlclass AbstractSeries
44 \qmlclass AbstractSeries
45 AbstractSeries is the base class for all series.
45 AbstractSeries is the base class for all series.
46 The class cannot be instantiated by the user.
46 The class cannot be instantiated by the user.
47 */
47 */
48
48
49 /*!
49 /*!
50 \enum QAbstractSeries::SeriesType
50 \enum QAbstractSeries::SeriesType
51
51
52 The type of the series object.
52 The type of the series object.
53
53
54 \value SeriesTypeLine
54 \value SeriesTypeLine
55 \value SeriesTypeArea
55 \value SeriesTypeArea
56 \value SeriesTypeBar
56 \value SeriesTypeBar
57 \value SeriesTypeStackedBar
57 \value SeriesTypeStackedBar
58 \value SeriesTypePercentBar
58 \value SeriesTypePercentBar
59 \value SeriesTypePie
59 \value SeriesTypePie
60 \value SeriesTypeScatter
60 \value SeriesTypeScatter
61 \value SeriesTypeSpline
61 \value SeriesTypeSpline
62 \value SeriesTypeHorizontalBar
62 \value SeriesTypeHorizontalBar
63 \value SeriesTypeHorizontalStackedBar
63 \value SeriesTypeHorizontalStackedBar
64 \value SeriesTypeHorizontalPercentBar
64 \value SeriesTypeHorizontalPercentBar
65 \value SeriesTypeBoxPlot
65 \value SeriesTypeBoxPlot
66 */
66 */
67
67
68 /*!
68 /*!
69 \property QAbstractSeries::type
69 \property QAbstractSeries::type
70 The type of the series.
70 The type of the series.
71 */
71 */
72 /*!
72 /*!
73 \qmlproperty ChartView.SeriesType AbstractSeries::type
73 \qmlproperty ChartView.SeriesType AbstractSeries::type
74 The type of the series.
74 The type of the series.
75 */
75 */
76
76
77 /*!
77 /*!
78 \property QAbstractSeries::name
78 \property QAbstractSeries::name
79 \brief name of the series property. The name is shown in legend for series and supports html formatting.
79 \brief name of the series property. The name is shown in legend for series and supports html formatting.
80 */
80 */
81 /*!
81 /*!
82 \qmlproperty string AbstractSeries::name
82 \qmlproperty string AbstractSeries::name
83 Name of the series. The name is shown in legend for series and supports html formatting.
83 Name of the series. The name is shown in legend for series and supports html formatting.
84 */
84 */
85
85
86 /*!
86 /*!
87 \fn void QAbstractSeries::nameChanged()
87 \fn void QAbstractSeries::nameChanged()
88 This signal is emitted when the series name changes.
88 This signal is emitted when the series name changes.
89 */
89 */
90 /*!
90 /*!
91 \qmlsignal AbstractSeries::onNameChanged()
91 \qmlsignal AbstractSeries::onNameChanged()
92 This signal is emitted when the series name changes.
92 This signal is emitted when the series name changes.
93 */
93 */
94
94
95 /*!
95 /*!
96 \property QAbstractSeries::visible
96 \property QAbstractSeries::visible
97 \brief whether the series is visible or not; true by default.
97 \brief whether the series is visible or not; true by default.
98 */
98 */
99 /*!
99 /*!
100 \qmlproperty bool AbstractSeries::visible
100 \qmlproperty bool AbstractSeries::visible
101 Visibility of the series. True by default.
101 Visibility of the series. True by default.
102 */
102 */
103
103
104 /*!
104 /*!
105 \fn void QAbstractSeries::visibleChanged()
105 \fn void QAbstractSeries::visibleChanged()
106 Emitted when the series visibility changes.
106 Emitted when the series visibility changes.
107 */
107 */
108 /*!
108 /*!
109 \qmlsignal AbstractSeries::onVisibleChanged()
109 \qmlsignal AbstractSeries::onVisibleChanged()
110 Emitted when the series visibility changes.
110 Emitted when the series visibility changes.
111 */
111 */
112
112
113 /*!
113 /*!
114 \property QAbstractSeries::opacity
114 \property QAbstractSeries::opacity
115 \brief The opacity of the series.
115 \brief The opacity of the series.
116
116
117 By default the opacity is 1.0. The valid values range from 0.0 (transparent) to 1.0 (opaque).
117 By default the opacity is 1.0. The valid values range from 0.0 (transparent) to 1.0 (opaque).
118 */
118 */
119 /*!
119 /*!
120 \qmlproperty real AbstractSeries::opacity
120 \qmlproperty real AbstractSeries::opacity
121 The opacity of the series. By default the opacity is 1.0.
121 The opacity of the series. By default the opacity is 1.0.
122 The valid values range from 0.0 (transparent) to 1.0 (opaque).
122 The valid values range from 0.0 (transparent) to 1.0 (opaque).
123 */
123 */
124
124
125 /*!
125 /*!
126 \fn void QAbstractSeries::opacityChanged()
126 \fn void QAbstractSeries::opacityChanged()
127 Emitted when the opacity of the series changes.
127 Emitted when the opacity of the series changes.
128 */
128 */
129 /*!
129 /*!
130 \qmlsignal AbstractSeries::onOpacityChanged()
130 \qmlsignal AbstractSeries::onOpacityChanged()
131 Emitted when the opacity of the series changes.
131 Emitted when the opacity of the series changes.
132 */
132 */
133
133
134 /*!
134 /*!
135 \internal
135 \internal
136 \brief Constructs QAbstractSeries object with \a parent.
136 \brief Constructs QAbstractSeries object with \a parent.
137 */
137 */
138 QAbstractSeries::QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent) :
138 QAbstractSeries::QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent) :
139 QObject(parent),
139 QObject(parent),
140 d_ptr(&d)
140 d_ptr(&d)
141 {
141 {
142 }
142 }
143
143
144 /*!
144 /*!
145 \brief Virtual destructor for the chart series.
145 \brief Virtual destructor for the chart series.
146 */
146 */
147 QAbstractSeries::~QAbstractSeries()
147 QAbstractSeries::~QAbstractSeries()
148 {
148 {
149 if (d_ptr->m_chart)
149 if (d_ptr->m_chart)
150 qFatal("Series still bound to a chart when destroyed!");
150 qFatal("Series still bound to a chart when destroyed!");
151 }
151 }
152
152
153 void QAbstractSeries::setName(const QString &name)
153 void QAbstractSeries::setName(const QString &name)
154 {
154 {
155 if (name != d_ptr->m_name) {
155 if (name != d_ptr->m_name) {
156 d_ptr->m_name = name;
156 d_ptr->m_name = name;
157 emit nameChanged();
157 emit nameChanged();
158 }
158 }
159 }
159 }
160
160
161 QString QAbstractSeries::name() const
161 QString QAbstractSeries::name() const
162 {
162 {
163 return d_ptr->m_name;
163 return d_ptr->m_name;
164 }
164 }
165
165
166 void QAbstractSeries::setVisible(bool visible)
166 void QAbstractSeries::setVisible(bool visible)
167 {
167 {
168 if (visible != d_ptr->m_visible) {
168 if (visible != d_ptr->m_visible) {
169 d_ptr->m_visible = visible;
169 d_ptr->m_visible = visible;
170 emit visibleChanged();
170 emit visibleChanged();
171 }
171 }
172 }
172 }
173
173
174 bool QAbstractSeries::isVisible() const
174 bool QAbstractSeries::isVisible() const
175 {
175 {
176 return d_ptr->m_visible;
176 return d_ptr->m_visible;
177 }
177 }
178
178
179 qreal QAbstractSeries::opacity() const
179 qreal QAbstractSeries::opacity() const
180 {
180 {
181 return d_ptr->m_opacity;
181 return d_ptr->m_opacity;
182 }
182 }
183
183
184 void QAbstractSeries::setOpacity(qreal opacity)
184 void QAbstractSeries::setOpacity(qreal opacity)
185 {
185 {
186 if (opacity != d_ptr->m_opacity) {
186 if (opacity != d_ptr->m_opacity) {
187 d_ptr->m_opacity = opacity;
187 d_ptr->m_opacity = opacity;
188 emit opacityChanged();
188 emit opacityChanged();
189 }
189 }
190 }
190 }
191
191
192 /*!
192 /*!
193 \brief Returns the chart where series belongs to.
193 \brief Returns the chart where series belongs to.
194
194
195 Set automatically when the series is added to the chart
195 Set automatically when the series is added to the chart
196 and unset when the series is removed from the chart.
196 and unset when the series is removed from the chart.
197 */
197 */
198 QChart *QAbstractSeries::chart() const
198 QChart *QAbstractSeries::chart() const
199 {
199 {
200 return d_ptr->m_chart;
200 return d_ptr->m_chart;
201 }
201 }
202
202
203 /*!
203 /*!
204 \brief Sets the visibility of the series to true.
204 \brief Sets the visibility of the series to true.
205
205
206 \sa setVisible(), isVisible()
206 \sa setVisible(), isVisible()
207 */
207 */
208 void QAbstractSeries::show()
208 void QAbstractSeries::show()
209 {
209 {
210 setVisible(true);
210 setVisible(true);
211 }
211 }
212
212
213 /*!
213 /*!
214 \brief Sets the visibility of the series to false.
214 \brief Sets the visibility of the series to false.
215
215
216 \sa setVisible(), isVisible()
216 \sa setVisible(), isVisible()
217 */
217 */
218 void QAbstractSeries::hide()
218 void QAbstractSeries::hide()
219 {
219 {
220 setVisible(false);
220 setVisible(false);
221 }
221 }
222
222
223 /*!
223 /*!
224 Attach \a axis to the series.
224 Attach \a axis to the series.
225 \return true if the axis was attached successfully, false otherwise.
225 \return true if the axis was attached successfully, false otherwise.
226 \note If multiple axes of same orientation are attached to same series,
227 they will have same min/max ranges.
226 \sa QChart::addAxis(), QChart::createDefaultAxes()
228 \sa QChart::addAxis(), QChart::createDefaultAxes()
227 */
229 */
228 bool QAbstractSeries::attachAxis(QAbstractAxis* axis)
230 bool QAbstractSeries::attachAxis(QAbstractAxis* axis)
229 {
231 {
230 if(d_ptr->m_chart) {
232 if(d_ptr->m_chart) {
231 return d_ptr->m_chart->d_ptr->m_dataset->attachAxis(this, axis);
233 return d_ptr->m_chart->d_ptr->m_dataset->attachAxis(this, axis);
232 } else {
234 } else {
233 qWarning()<<"Series not in the chart. Please addSeries to chart first.";
235 qWarning()<<"Series not in the chart. Please addSeries to chart first.";
234 return false;
236 return false;
235 }
237 }
236 }
238 }
237
239
238 /*!
240 /*!
239 Detach \a axis from the series.
241 Detach \a axis from the series.
240 \return true if the axis was detached successfully, false otherwise.
242 \return true if the axis was detached successfully, false otherwise.
241 \sa QChart::removeAxis()
243 \sa QChart::removeAxis()
242 */
244 */
243 bool QAbstractSeries::detachAxis(QAbstractAxis* axis)
245 bool QAbstractSeries::detachAxis(QAbstractAxis* axis)
244 {
246 {
245 if(d_ptr->m_chart) {
247 if(d_ptr->m_chart) {
246 return d_ptr->m_chart->d_ptr->m_dataset->detachAxis(this, axis);
248 return d_ptr->m_chart->d_ptr->m_dataset->detachAxis(this, axis);
247 }
249 }
248 else {
250 else {
249 qWarning()<<"Series not in the chart. Please addSeries to chart first.";
251 qWarning()<<"Series not in the chart. Please addSeries to chart first.";
250 return false;
252 return false;
251 }
253 }
252 }
254 }
253
255
254 /*!
256 /*!
255 Returns the list of axes attached to the series. Usually there is an x-axis and a y-axis attached to a series, except
257 Returns the list of axes attached to the series. Usually there is an x-axis and a y-axis attached to a series, except
256 in case of a QPieSeries, which does not have any axes attached.
258 in case of a QPieSeries, which does not have any axes attached.
257 \sa attachAxis(), detachAxis()
259 \sa attachAxis(), detachAxis()
258 */
260 */
259 QList<QAbstractAxis*> QAbstractSeries::attachedAxes()
261 QList<QAbstractAxis*> QAbstractSeries::attachedAxes()
260 {
262 {
261 return d_ptr->m_axes;
263 return d_ptr->m_axes;
262 }
264 }
263
265
264 ///////////////////////////////////////////////////////////////////////////////////////////////////
266 ///////////////////////////////////////////////////////////////////////////////////////////////////
265
267
266 QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries *q)
268 QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries *q)
267 : q_ptr(q),
269 : q_ptr(q),
268 m_chart(0),
270 m_chart(0),
269 m_item(0),
271 m_item(0),
270 m_domain(new XYDomain()),
272 m_domain(new XYDomain()),
271 m_visible(true),
273 m_visible(true),
272 m_opacity(1.0)
274 m_opacity(1.0)
273 {
275 {
274 }
276 }
275
277
276 QAbstractSeriesPrivate::~QAbstractSeriesPrivate()
278 QAbstractSeriesPrivate::~QAbstractSeriesPrivate()
277 {
279 {
278 }
280 }
279
281
280 void QAbstractSeriesPrivate::setDomain(AbstractDomain* domain)
282 void QAbstractSeriesPrivate::setDomain(AbstractDomain* domain)
281 {
283 {
282 Q_ASSERT(domain);
284 Q_ASSERT(domain);
283 if(m_domain.data()!=domain) {
285 if(m_domain.data()!=domain) {
284 if(!m_item.isNull()) QObject::disconnect(m_domain.data(), SIGNAL(updated()), m_item.data(), SLOT(handleDomainUpdated()));
286 if(!m_item.isNull()) QObject::disconnect(m_domain.data(), SIGNAL(updated()), m_item.data(), SLOT(handleDomainUpdated()));
285 m_domain.reset(domain);
287 m_domain.reset(domain);
286 if(!m_item.isNull()) {
288 if(!m_item.isNull()) {
287 QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated()));
289 QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated()));
288 m_item->handleDomainUpdated();
290 m_item->handleDomainUpdated();
289 }
291 }
290 }
292 }
291 }
293 }
292
294
293 void QAbstractSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
295 void QAbstractSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
294 {
296 {
295 Q_ASSERT(!m_item.isNull());
297 Q_ASSERT(!m_item.isNull());
296 Q_UNUSED(parent);
298 Q_UNUSED(parent);
297 QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated()));
299 QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated()));
298 }
300 }
299
301
300 void QAbstractSeriesPrivate::initializeAnimations(QChart::AnimationOptions options)
302 void QAbstractSeriesPrivate::initializeAnimations(QChart::AnimationOptions options)
301 {
303 {
302 Q_UNUSED(options);
304 Q_UNUSED(options);
303 }
305 }
304
306
305 #include "moc_qabstractseries.cpp"
307 #include "moc_qabstractseries.cpp"
306 #include "moc_qabstractseries_p.cpp"
308 #include "moc_qabstractseries_p.cpp"
307
309
308 QTCOMMERCIALCHART_END_NAMESPACE
310 QTCOMMERCIALCHART_END_NAMESPACE
309
311
310
312
General Comments 0
You need to be logged in to leave comments. Login now