@@ -1,155 +1,161 | |||||
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 | import QtQuick 1.0 |
|
21 | import QtQuick 1.0 | |
22 | import QtCommercial.Chart 1.0 |
|
22 | import QtCommercial.Chart 1.0 | |
23 | import QmlCustomModel 1.0 |
|
23 | import QmlCustomModel 1.0 | |
24 |
|
24 | |||
25 | Rectangle { |
|
25 | Rectangle { | |
26 | anchors.fill: parent |
|
26 | anchors.fill: parent | |
27 |
|
27 | |||
28 | //![1] |
|
28 | //![1] | |
29 | ChartView { |
|
29 | ChartView { | |
30 | id: chartView |
|
30 | id: chartView | |
31 | title: "Top-5 car brand shares in Finland" |
|
31 | title: "Top-5 car brand shares in Finland" | |
32 | anchors.fill: parent |
|
32 | anchors.fill: parent | |
33 | animationOptions: ChartView.SeriesAnimations |
|
33 | animationOptions: ChartView.SeriesAnimations | |
34 |
|
34 | |||
35 | BarCategoriesAxis { |
|
35 | BarCategoriesAxis { | |
36 | id: categoryAxis |
|
36 | id: categoryAxis | |
37 | categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] |
|
37 | categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] | |
38 | } |
|
38 | } | |
39 | // ... |
|
39 | // ... | |
40 | //![1] |
|
40 | //![1] | |
41 |
|
41 | |||
42 | //![2] |
|
42 | //![2] | |
43 | CustomModel { |
|
43 | CustomModel { | |
44 | id: customModel |
|
44 | id: customModel | |
45 | verticalHeaders: ["Manufacturer", "Volkswagen", "Toyota", "Ford", "Skoda", "Volvo", "Others"] |
|
45 | verticalHeaders: ["Manufacturer", "Volkswagen", "Toyota", "Ford", "Skoda", "Volvo", "Others"] | |
46 | CustomModelElement { values: [0, "Manufacturer", 0, 1, 2, 3, 4] } |
|
46 | CustomModelElement { values: [0, "Manufacturer", 0, 1, 2, 3, 4] } | |
47 | CustomModelElement { values: [1, "Volkswagen", 10.3, 12.0, 12.8, 13.0, 13.8] } |
|
47 | CustomModelElement { values: [1, "Volkswagen", 10.3, 12.0, 12.8, 13.0, 13.8] } | |
48 | CustomModelElement { values: [2, "Toyota", 13.8, 13.5, 16.2, 13.7, 10.7] } |
|
48 | CustomModelElement { values: [2, "Toyota", 13.8, 13.5, 16.2, 13.7, 10.7] } | |
49 | CustomModelElement { values: [3, "Ford", 6.4, 7.1, 8.9, 8.2, 8.6] } |
|
49 | CustomModelElement { values: [3, "Ford", 6.4, 7.1, 8.9, 8.2, 8.6] } | |
50 | CustomModelElement { values: [4, "Skoda", 4.7, 5.8, 6.9, 8.3, 8.2] } |
|
50 | CustomModelElement { values: [4, "Skoda", 4.7, 5.8, 6.9, 8.3, 8.2] } | |
51 | CustomModelElement { values: [5, "Volvo", 7.1, 6.7, 6.5, 6.3, 7.0] } |
|
51 | CustomModelElement { values: [5, "Volvo", 7.1, 6.7, 6.5, 6.3, 7.0] } | |
52 | CustomModelElement { values: [6, "Others", 57.7, 54.9, 48.7, 50.5, 51.7] } |
|
52 | CustomModelElement { values: [6, "Others", 57.7, 54.9, 48.7, 50.5, 51.7] } | |
53 | } |
|
53 | } | |
54 | //![2] |
|
54 | //![2] | |
55 |
|
55 | |||
56 | //![5] |
|
56 | //![5] | |
57 | BarSeries { |
|
57 | BarSeries { | |
|
58 | id: myBarSeries | |||
58 | name: "Others" |
|
59 | name: "Others" | |
59 | barWidth: 0.9 |
|
60 | barWidth: 0.9 | |
60 | visible: false |
|
61 | // visible: false | |
61 | HBarModelMapper { |
|
62 | HBarModelMapper { | |
62 | model: customModel |
|
63 | model: customModel | |
63 | firstBarSetRow: 6 |
|
64 | firstBarSetRow: 6 | |
64 | lastBarSetRow: 6 |
|
65 | lastBarSetRow: 6 | |
65 | firstColumn: 2 |
|
66 | firstColumn: 2 | |
66 | } |
|
67 | } | |
67 | } |
|
68 | } | |
68 | //![5] |
|
69 | //![5] | |
69 |
|
70 | |||
70 | //![4] |
|
71 | //![4] | |
71 | LineSeries { |
|
72 | LineSeries { | |
72 | name: "Volkswagen" |
|
73 | name: "Volkswagen" | |
73 | visible: false |
|
74 | //visible: false | |
74 | HXYModelMapper { |
|
75 | HXYModelMapper { | |
75 | model: customModel |
|
76 | model: customModel | |
76 | xRow: 0 |
|
77 | xRow: 0 | |
77 | yRow: 1 |
|
78 | yRow: 1 | |
78 | firstColumn: 2 |
|
79 | firstColumn: 2 | |
79 | } |
|
80 | } | |
80 | } |
|
81 | } | |
81 | //![4] |
|
82 | //![4] | |
82 |
|
83 | |||
83 | LineSeries { |
|
84 | LineSeries { | |
84 | name: "Toyota" |
|
85 | name: "Toyota" | |
85 | visible: false |
|
86 | visible: false | |
86 | HXYModelMapper { |
|
87 | HXYModelMapper { | |
87 | model: customModel |
|
88 | model: customModel | |
88 | xRow: 0 |
|
89 | xRow: 0 | |
89 | yRow: 2 |
|
90 | yRow: 2 | |
90 | firstColumn: 2 |
|
91 | firstColumn: 2 | |
91 | } |
|
92 | } | |
92 | } |
|
93 | } | |
93 |
|
94 | |||
94 | LineSeries { |
|
95 | LineSeries { | |
95 | name: "Ford" |
|
96 | name: "Ford" | |
96 | visible: false |
|
97 | visible: false | |
97 | HXYModelMapper { |
|
98 | HXYModelMapper { | |
98 | model: customModel |
|
99 | model: customModel | |
99 | xRow: 0 |
|
100 | xRow: 0 | |
100 | yRow: 3 |
|
101 | yRow: 3 | |
101 | firstColumn: 2 |
|
102 | firstColumn: 2 | |
102 | } |
|
103 | } | |
103 | } |
|
104 | } | |
104 |
|
105 | |||
105 | LineSeries { |
|
106 | LineSeries { | |
106 | name: "Skoda" |
|
107 | name: "Skoda" | |
107 | visible: false |
|
108 | visible: false | |
108 | HXYModelMapper { |
|
109 | HXYModelMapper { | |
109 | model: customModel |
|
110 | model: customModel | |
110 | xRow: 0 |
|
111 | xRow: 0 | |
111 | yRow: 4 |
|
112 | yRow: 4 | |
112 | firstColumn: 2 |
|
113 | firstColumn: 2 | |
113 | } |
|
114 | } | |
114 | } |
|
115 | } | |
115 |
|
116 | |||
116 | LineSeries { |
|
117 | LineSeries { | |
117 | name: "Volvo" |
|
118 | name: "Volvo" | |
118 | visible: false |
|
119 | visible: false | |
119 | HXYModelMapper { |
|
120 | HXYModelMapper { | |
120 | model: customModel |
|
121 | model: customModel | |
121 | xRow: 0 |
|
122 | xRow: 0 | |
122 | yRow: 5 |
|
123 | yRow: 5 | |
123 | firstColumn: 2 |
|
124 | firstColumn: 2 | |
124 | } |
|
125 | } | |
125 | } |
|
126 | } | |
126 |
|
127 | |||
127 | //![3] |
|
128 | //![3] | |
128 | PieSeries { |
|
129 | PieSeries { | |
129 | id: pieSeries |
|
130 | id: pieSeries | |
130 | size: 0.4 |
|
131 | size: 0.4 | |
131 | horizontalPosition: 0.7 |
|
132 | horizontalPosition: 0.7 | |
132 | verticalPosition: 0.4 |
|
133 | verticalPosition: 0.4 | |
133 | onClicked: { |
|
134 | onClicked: { | |
134 | // Show the selection by exploding the slice |
|
135 | // Show the selection by exploding the slice | |
135 | slice.exploded = !slice.exploded; |
|
136 | slice.exploded = !slice.exploded; | |
136 |
|
137 | |||
137 | // Update the line series to show the yearly data for this slice |
|
138 | // Update the line series to show the yearly data for this slice | |
138 | for (var i = 0; i < chartView.count; i++) { |
|
139 | for (var i = 0; i < chartView.count; i++) { | |
139 | if (chartView.series(i).name == slice.label) { |
|
140 | if (chartView.series(i).name == slice.label) { | |
140 | chartView.series(i).visible = slice.exploded; |
|
141 | chartView.series(i).visible = slice.exploded; | |
141 | } |
|
142 | } | |
142 | } |
|
143 | } | |
143 | } |
|
144 | } | |
144 | } |
|
145 | } | |
145 | //![3] |
|
146 | //![3] | |
146 |
|
147 | |||
147 | VPieModelMapper { |
|
148 | VPieModelMapper { | |
148 | series: pieSeries |
|
149 | series: pieSeries | |
149 | model: customModel |
|
150 | model: customModel | |
150 |
|
|
151 | labelsColumn: 1 | |
151 | valuesColumn: 2 |
|
152 | valuesColumn: 2 | |
152 | firstRow: 1 |
|
153 | firstRow: 1 | |
153 | } |
|
154 | } | |
|
155 | ||||
|
156 | Component.onCompleted: { | |||
|
157 | createDefaultAxes(); | |||
|
158 | setAxisX(categoryAxis,myBarSeries) | |||
|
159 | } | |||
154 | } |
|
160 | } | |
155 | } |
|
161 | } |
@@ -1,446 +1,447 | |||||
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 "chartdataset_p.h" |
|
21 | #include "chartdataset_p.h" | |
22 | #include "qchart.h" |
|
22 | #include "qchart.h" | |
23 | #include "qvaluesaxis.h" |
|
23 | #include "qvaluesaxis.h" | |
24 | #include "qbarcategoriesaxis.h" |
|
24 | #include "qbarcategoriesaxis.h" | |
25 | #include "qvaluesaxis_p.h" |
|
25 | #include "qvaluesaxis_p.h" | |
26 | #include "qabstractseries_p.h" |
|
26 | #include "qabstractseries_p.h" | |
27 | #include "qabstractbarseries.h" |
|
27 | #include "qabstractbarseries.h" | |
28 | #include "qstackedbarseries.h" |
|
28 | #include "qstackedbarseries.h" | |
29 | #include "qpercentbarseries.h" |
|
29 | #include "qpercentbarseries.h" | |
30 | #include "qpieseries.h" |
|
30 | #include "qpieseries.h" | |
31 |
|
31 | |||
32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
33 |
|
33 | |||
34 | ChartDataSet::ChartDataSet(QChart *parent):QObject(parent), |
|
34 | ChartDataSet::ChartDataSet(QChart *parent):QObject(parent), | |
35 | m_domainIndex(0) |
|
35 | m_domainIndex(0) | |
36 | { |
|
36 | { | |
37 |
|
37 | |||
38 | } |
|
38 | } | |
39 |
|
39 | |||
40 | ChartDataSet::~ChartDataSet() |
|
40 | ChartDataSet::~ChartDataSet() | |
41 | { |
|
41 | { | |
42 | removeAllSeries(); |
|
42 | removeAllSeries(); | |
43 | } |
|
43 | } | |
44 |
|
44 | |||
45 | void ChartDataSet::addSeries(QAbstractSeries* series) |
|
45 | void ChartDataSet::addSeries(QAbstractSeries* series) | |
46 | { |
|
46 | { | |
47 | Domain* domain = m_seriesDomainMap.value(series); |
|
47 | Domain* domain = m_seriesDomainMap.value(series); | |
48 |
|
48 | |||
49 | if(domain) { |
|
49 | if(domain) { | |
50 | qWarning() << "Can not add series. Series already on the chart"; |
|
50 | qWarning() << "Can not add series. Series already on the chart"; | |
51 | return; |
|
51 | return; | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 | series->setParent(this); // take ownership |
|
54 | series->setParent(this); // take ownership | |
55 |
|
55 | |||
56 | domain = new Domain(series); |
|
56 | domain = new Domain(series); | |
57 |
|
57 | |||
58 | m_seriesDomainMap.insert(series,domain); |
|
58 | m_seriesDomainMap.insert(series,domain); | |
59 |
|
59 | |||
60 | series->d_ptr->scaleDomain(*domain); |
|
60 | series->d_ptr->scaleDomain(*domain); | |
61 |
|
61 | |||
62 | QMapIterator<int, QAbstractSeries*> i(m_indexSeriesMap); |
|
62 | QMapIterator<int, QAbstractSeries*> i(m_indexSeriesMap); | |
63 |
|
63 | |||
64 | int key=0; |
|
64 | int key=0; | |
65 | while (i.hasNext()) { |
|
65 | while (i.hasNext()) { | |
66 | i.next(); |
|
66 | i.next(); | |
67 | if(i.key()!=key) { |
|
67 | if(i.key()!=key) { | |
68 | break; |
|
68 | break; | |
69 | } |
|
69 | } | |
70 | key++; |
|
70 | key++; | |
71 | } |
|
71 | } | |
72 |
|
72 | |||
73 | m_indexSeriesMap.insert(key,series); |
|
73 | m_indexSeriesMap.insert(key,series); | |
74 |
|
74 | |||
75 | series->d_ptr->m_chart = qobject_cast<QChart*>(parent()); |
|
75 | series->d_ptr->m_chart = qobject_cast<QChart*>(parent()); | |
76 | series->d_ptr->m_dataset = this; |
|
76 | series->d_ptr->m_dataset = this; | |
77 |
|
77 | |||
78 | emit seriesAdded(series,domain); |
|
78 | emit seriesAdded(series,domain); | |
79 |
|
79 | |||
80 | } |
|
80 | } | |
81 |
|
81 | |||
82 | void ChartDataSet::createDefaultAxes() |
|
82 | void ChartDataSet::createDefaultAxes() | |
83 | { |
|
83 | { | |
84 |
|
84 | |||
85 | if(m_seriesDomainMap.isEmpty()) return; |
|
85 | if(m_seriesDomainMap.isEmpty()) return; | |
86 |
|
86 | |||
87 | QAbstractAxis::AxisTypes typeX(0); |
|
87 | QAbstractAxis::AxisTypes typeX(0); | |
88 | QAbstractAxis::AxisTypes typeY(0); |
|
88 | QAbstractAxis::AxisTypes typeY(0); | |
89 |
|
89 | |||
90 | QMapIterator<QAbstractSeries*, Domain*> i(m_seriesDomainMap); |
|
90 | QMapIterator<QAbstractSeries*, Domain*> i(m_seriesDomainMap); | |
91 | while (i.hasNext()) { |
|
91 | while (i.hasNext()) { | |
92 | i.next(); |
|
92 | i.next(); | |
93 | removeAxes(i.key()); |
|
93 | removeAxes(i.key()); | |
94 | } |
|
94 | } | |
95 |
|
95 | |||
96 | i.toFront(); |
|
96 | i.toFront(); | |
97 |
|
97 | |||
98 | while (i.hasNext()) { |
|
98 | while (i.hasNext()) { | |
99 | i.next(); |
|
99 | i.next(); | |
100 | QAbstractAxis* axisX = m_seriesAxisXMap.value(i.key()); |
|
100 | QAbstractAxis* axisX = m_seriesAxisXMap.value(i.key()); | |
101 | QAbstractAxis* axisY = m_seriesAxisYMap.value(i.key()); |
|
101 | QAbstractAxis* axisY = m_seriesAxisYMap.value(i.key()); | |
102 | if(axisX) typeX&=axisX->type(); |
|
102 | if(axisX) typeX&=axisX->type(); | |
103 | else typeX|=i.key()->d_ptr->defaultAxisXType(); |
|
103 | else typeX|=i.key()->d_ptr->defaultAxisXType(); | |
104 | if(axisY) typeY&=axisY->type(); |
|
104 | if(axisY) typeY&=axisY->type(); | |
105 | else typeY|=i.key()->d_ptr->defaultAxisYType(); |
|
105 | else typeY|=i.key()->d_ptr->defaultAxisYType(); | |
106 | } |
|
106 | } | |
107 |
|
107 | |||
108 |
|
108 | |||
109 | if(typeX.testFlag(QAbstractAxis::AxisTypeValues) && typeX.testFlag(QAbstractAxis::AxisTypeCategories)) |
|
109 | if(typeX.testFlag(QAbstractAxis::AxisTypeValues) && typeX.testFlag(QAbstractAxis::AxisTypeCategories)) | |
110 | { |
|
110 | { | |
111 | i.toFront(); |
|
111 | i.toFront(); | |
112 | while (i.hasNext()) { |
|
112 | while (i.hasNext()) { | |
113 | i.next(); |
|
113 | i.next(); | |
114 | QAbstractAxis* axis = createAxis(i.key()->d_ptr->defaultAxisXType()); |
|
114 | QAbstractAxis* axis = createAxis(i.key()->d_ptr->defaultAxisXType()); | |
|
115 | if(!axis) continue; | |||
115 | i.key()->d_ptr->initializeAxisX(axis); |
|
116 | i.key()->d_ptr->initializeAxisX(axis); | |
116 | addAxisX(axis,i.key()); |
|
117 | addAxisX(axis,i.key()); | |
117 | emit axisAdded(axis,i.value()); |
|
118 | emit axisAdded(axis,i.value()); | |
118 | } |
|
119 | } | |
119 |
|
120 | |||
120 | }else if(!typeY.testFlag(QAbstractAxis::AxisTypeNoAxis)){ |
|
121 | }else if(!typeY.testFlag(QAbstractAxis::AxisTypeNoAxis)){ | |
121 | QAbstractAxis* axis = createAxis(QAbstractAxis::AxisType(int(typeX))); |
|
122 | QAbstractAxis* axis = createAxis(QAbstractAxis::AxisType(int(typeX))); | |
122 | i.toFront(); |
|
123 | i.toFront(); | |
123 | while (i.hasNext()) { |
|
124 | while (i.hasNext()) { | |
124 | i.next(); |
|
125 | i.next(); | |
125 | i.key()->d_ptr->initializeAxisX(axis); |
|
126 | i.key()->d_ptr->initializeAxisX(axis); | |
126 | addAxisX(axis,i.key()); |
|
127 | addAxisX(axis,i.key()); | |
127 | } |
|
128 | } | |
128 | emit axisAdded(axis,i.value()); |
|
129 | emit axisAdded(axis,i.value()); | |
129 |
|
130 | |||
130 | } |
|
131 | } | |
131 |
|
132 | |||
132 | if(typeY.testFlag(QAbstractAxis::AxisTypeValues) && typeY.testFlag(QAbstractAxis::AxisTypeCategories)) |
|
133 | if(typeY.testFlag(QAbstractAxis::AxisTypeValues) && typeY.testFlag(QAbstractAxis::AxisTypeCategories)) | |
133 | { |
|
134 | { | |
134 | i.toFront(); |
|
135 | i.toFront(); | |
135 | while (i.hasNext()) { |
|
136 | while (i.hasNext()) { | |
136 | i.next(); |
|
137 | i.next(); | |
137 | QAbstractAxis* axis = createAxis(i.key()->d_ptr->defaultAxisYType()); |
|
138 | QAbstractAxis* axis = createAxis(i.key()->d_ptr->defaultAxisYType()); | |
138 | i.key()->d_ptr->initializeAxisY(axis); |
|
139 | i.key()->d_ptr->initializeAxisY(axis); | |
139 | addAxisY(axis,i.key()); |
|
140 | addAxisY(axis,i.key()); | |
140 | emit axisAdded(axis,i.value()); |
|
141 | emit axisAdded(axis,i.value()); | |
141 | } |
|
142 | } | |
142 |
|
143 | |||
143 | }else if(!typeY.testFlag(QAbstractAxis::AxisTypeNoAxis)){ |
|
144 | }else if(!typeY.testFlag(QAbstractAxis::AxisTypeNoAxis)){ | |
144 | QAbstractAxis* axis = createAxis(QAbstractAxis::AxisType(int(typeY))); |
|
145 | QAbstractAxis* axis = createAxis(QAbstractAxis::AxisType(int(typeY))); | |
145 | i.toFront(); |
|
146 | i.toFront(); | |
146 | while (i.hasNext()) { |
|
147 | while (i.hasNext()) { | |
147 | i.next(); |
|
148 | i.next(); | |
148 | i.key()->d_ptr->initializeAxisY(axis); |
|
149 | i.key()->d_ptr->initializeAxisY(axis); | |
149 | addAxisY(axis,i.key()); |
|
150 | addAxisY(axis,i.key()); | |
150 | } |
|
151 | } | |
151 | emit axisAdded(axis,i.value()); |
|
152 | emit axisAdded(axis,i.value()); | |
152 |
|
153 | |||
153 | } |
|
154 | } | |
154 | } |
|
155 | } | |
155 |
|
156 | |||
156 |
|
157 | |||
157 | QAbstractAxis* ChartDataSet::createAxis(QAbstractAxis::AxisType type) |
|
158 | QAbstractAxis* ChartDataSet::createAxis(QAbstractAxis::AxisType type) | |
158 | { |
|
159 | { | |
159 | QAbstractAxis* axis =0; |
|
160 | QAbstractAxis* axis =0; | |
160 |
|
161 | |||
161 | switch(type) { |
|
162 | switch(type) { | |
162 | case QAbstractAxis::AxisTypeValues: |
|
163 | case QAbstractAxis::AxisTypeValues: | |
163 | axis = new QValuesAxis(this); |
|
164 | axis = new QValuesAxis(this); | |
164 | break; |
|
165 | break; | |
165 | case QAbstractAxis::AxisTypeCategories: |
|
166 | case QAbstractAxis::AxisTypeCategories: | |
166 | axis = new QBarCategoriesAxis(this); |
|
167 | axis = new QBarCategoriesAxis(this); | |
167 | break; |
|
168 | break; | |
168 | default: |
|
169 | default: | |
169 | axis = 0; |
|
170 | axis = 0; | |
170 | break; |
|
171 | break; | |
171 | } |
|
172 | } | |
172 |
|
173 | |||
173 | return axis; |
|
174 | return axis; | |
174 | } |
|
175 | } | |
175 |
|
176 | |||
176 | void ChartDataSet::addAxisX(QAbstractAxis* axis,QAbstractSeries* series) { |
|
177 | void ChartDataSet::addAxisX(QAbstractAxis* axis,QAbstractSeries* series) { | |
177 | Domain* domain = m_seriesDomainMap.value(series); |
|
178 | Domain* domain = m_seriesDomainMap.value(series); | |
178 | QObject::connect(axis->d_ptr.data(),SIGNAL(changed(qreal,qreal,int,bool)),domain,SLOT(handleAxisXChanged(qreal,qreal,int,bool))); |
|
179 | QObject::connect(axis->d_ptr.data(),SIGNAL(changed(qreal,qreal,int,bool)),domain,SLOT(handleAxisXChanged(qreal,qreal,int,bool))); | |
179 | QObject::connect(domain,SIGNAL(rangeXChanged(qreal,qreal,int)),axis->d_ptr.data(),SLOT(handleAxisRangeChanged(qreal,qreal,int))); |
|
180 | QObject::connect(domain,SIGNAL(rangeXChanged(qreal,qreal,int)),axis->d_ptr.data(),SLOT(handleAxisRangeChanged(qreal,qreal,int))); | |
180 | axis->d_ptr->m_orientation=Qt::Horizontal; |
|
181 | axis->d_ptr->m_orientation=Qt::Horizontal; | |
181 | m_seriesAxisXMap.insert(series,axis); |
|
182 | m_seriesAxisXMap.insert(series,axis); | |
182 | } |
|
183 | } | |
183 |
|
184 | |||
184 | void ChartDataSet::addAxisY(QAbstractAxis* axis,QAbstractSeries* series) { |
|
185 | void ChartDataSet::addAxisY(QAbstractAxis* axis,QAbstractSeries* series) { | |
185 | Domain* domain = m_seriesDomainMap.value(series); |
|
186 | Domain* domain = m_seriesDomainMap.value(series); | |
186 | QObject::connect(axis->d_ptr.data(),SIGNAL(changed(qreal,qreal,int,bool)),domain,SLOT(handleAxisYChanged(qreal,qreal,int,bool))); |
|
187 | QObject::connect(axis->d_ptr.data(),SIGNAL(changed(qreal,qreal,int,bool)),domain,SLOT(handleAxisYChanged(qreal,qreal,int,bool))); | |
187 | QObject::connect(domain,SIGNAL(rangeYChanged(qreal,qreal,int)),axis->d_ptr.data(),SLOT(handleAxisRangeChanged(qreal,qreal,int))); |
|
188 | QObject::connect(domain,SIGNAL(rangeYChanged(qreal,qreal,int)),axis->d_ptr.data(),SLOT(handleAxisRangeChanged(qreal,qreal,int))); | |
188 | axis->d_ptr->m_orientation=Qt::Vertical; |
|
189 | axis->d_ptr->m_orientation=Qt::Vertical; | |
189 | m_seriesAxisYMap.insert(series,axis); |
|
190 | m_seriesAxisYMap.insert(series,axis); | |
190 | } |
|
191 | } | |
191 |
|
192 | |||
192 | void ChartDataSet::removeSeries(QAbstractSeries* series) |
|
193 | void ChartDataSet::removeSeries(QAbstractSeries* series) | |
193 | { |
|
194 | { | |
194 | Domain* domain = m_seriesDomainMap.take(series); |
|
195 | Domain* domain = m_seriesDomainMap.take(series); | |
195 |
|
196 | |||
196 | if(!domain) { |
|
197 | if(!domain) { | |
197 | qWarning()<<"Can not remove series. Series not found on the chart."; |
|
198 | qWarning()<<"Can not remove series. Series not found on the chart."; | |
198 | } |
|
199 | } | |
199 |
|
200 | |||
200 | emit seriesRemoved(series); |
|
201 | emit seriesRemoved(series); | |
201 |
|
202 | |||
202 | delete domain; |
|
203 | delete domain; | |
203 | domain = 0; |
|
204 | domain = 0; | |
204 |
|
205 | |||
205 | int key = seriesIndex(series); |
|
206 | int key = seriesIndex(series); | |
206 | Q_ASSERT(key!=-1); |
|
207 | Q_ASSERT(key!=-1); | |
207 |
|
208 | |||
208 | m_indexSeriesMap.remove(key); |
|
209 | m_indexSeriesMap.remove(key); | |
209 |
|
210 | |||
210 | series->setParent(0); |
|
211 | series->setParent(0); | |
211 | series->d_ptr->m_chart = 0; |
|
212 | series->d_ptr->m_chart = 0; | |
212 | series->d_ptr->m_dataset = 0; |
|
213 | series->d_ptr->m_dataset = 0; | |
213 |
|
214 | |||
214 | removeAxes(series); |
|
215 | removeAxes(series); | |
215 | } |
|
216 | } | |
216 |
|
217 | |||
217 | void ChartDataSet::removeAxes(QAbstractSeries* series) |
|
218 | void ChartDataSet::removeAxes(QAbstractSeries* series) | |
218 | { |
|
219 | { | |
219 | QAbstractAxis* axisX = m_seriesAxisXMap.take(series); |
|
220 | QAbstractAxis* axisX = m_seriesAxisXMap.take(series); | |
220 |
|
221 | |||
221 | if(axisX) { |
|
222 | if(axisX) { | |
222 | QList<QAbstractAxis*> axesX = m_seriesAxisXMap.values(); |
|
223 | QList<QAbstractAxis*> axesX = m_seriesAxisXMap.values(); | |
223 | int x = axesX.indexOf(axisX); |
|
224 | int x = axesX.indexOf(axisX); | |
224 |
|
225 | |||
225 | if(x==-1) { |
|
226 | if(x==-1) { | |
226 | emit axisRemoved(axisX); |
|
227 | emit axisRemoved(axisX); | |
227 | axisX->deleteLater(); |
|
228 | axisX->deleteLater(); | |
228 | } |
|
229 | } | |
229 | } |
|
230 | } | |
230 |
|
231 | |||
231 | QAbstractAxis* axisY = m_seriesAxisYMap.take(series); |
|
232 | QAbstractAxis* axisY = m_seriesAxisYMap.take(series); | |
232 |
|
233 | |||
233 | if(axisY) { |
|
234 | if(axisY) { | |
234 | QList<QAbstractAxis*> axesY = m_seriesAxisYMap.values(); |
|
235 | QList<QAbstractAxis*> axesY = m_seriesAxisYMap.values(); | |
235 |
|
236 | |||
236 | int y = axesY.indexOf(axisY); |
|
237 | int y = axesY.indexOf(axisY); | |
237 |
|
238 | |||
238 | if(y==-1) { |
|
239 | if(y==-1) { | |
239 | emit axisRemoved(axisY); |
|
240 | emit axisRemoved(axisY); | |
240 | axisY->deleteLater(); |
|
241 | axisY->deleteLater(); | |
241 | } |
|
242 | } | |
242 | } |
|
243 | } | |
243 | } |
|
244 | } | |
244 |
|
245 | |||
245 | void ChartDataSet::removeAllSeries() |
|
246 | void ChartDataSet::removeAllSeries() | |
246 | { |
|
247 | { | |
247 | QList<QAbstractSeries*> series = m_seriesDomainMap.keys(); |
|
248 | QList<QAbstractSeries*> series = m_seriesDomainMap.keys(); | |
248 | foreach(QAbstractSeries *s , series) { |
|
249 | foreach(QAbstractSeries *s , series) { | |
249 | removeSeries(s); |
|
250 | removeSeries(s); | |
250 | } |
|
251 | } | |
251 |
|
252 | |||
252 | Q_ASSERT(m_seriesAxisXMap.count()==0); |
|
253 | Q_ASSERT(m_seriesAxisXMap.count()==0); | |
253 | Q_ASSERT(m_seriesAxisXMap.count()==0); |
|
254 | Q_ASSERT(m_seriesAxisXMap.count()==0); | |
254 | Q_ASSERT(m_seriesDomainMap.count()==0); |
|
255 | Q_ASSERT(m_seriesDomainMap.count()==0); | |
255 |
|
256 | |||
256 | qDeleteAll(series); |
|
257 | qDeleteAll(series); | |
257 | } |
|
258 | } | |
258 |
|
259 | |||
259 | void ChartDataSet::zoomInDomain(const QRectF& rect, const QSizeF& size) |
|
260 | void ChartDataSet::zoomInDomain(const QRectF& rect, const QSizeF& size) | |
260 | { |
|
261 | { | |
261 | //for performance reasons block, signals and scale "full" domain one by one. Gives twice less screen updates |
|
262 | //for performance reasons block, signals and scale "full" domain one by one. Gives twice less screen updates | |
262 |
|
263 | |||
263 | blockAxisSignals(true); |
|
264 | blockAxisSignals(true); | |
264 |
|
265 | |||
265 | QMapIterator<QAbstractSeries*, Domain*> i(m_seriesDomainMap); |
|
266 | QMapIterator<QAbstractSeries*, Domain*> i(m_seriesDomainMap); | |
266 |
|
267 | |||
267 | while (i.hasNext()) { |
|
268 | while (i.hasNext()) { | |
268 | i.next(); |
|
269 | i.next(); | |
269 | i.value()->zoomIn(rect,size); |
|
270 | i.value()->zoomIn(rect,size); | |
270 | } |
|
271 | } | |
271 |
|
272 | |||
272 | blockAxisSignals(false); |
|
273 | blockAxisSignals(false); | |
273 |
|
274 | |||
274 | } |
|
275 | } | |
275 |
|
276 | |||
276 | void ChartDataSet::zoomOutDomain(const QRectF& rect, const QSizeF& size) |
|
277 | void ChartDataSet::zoomOutDomain(const QRectF& rect, const QSizeF& size) | |
277 | { |
|
278 | { | |
278 | //for performance reasons block, signals and scale "full" domain one by one. Gives twice less screen updates |
|
279 | //for performance reasons block, signals and scale "full" domain one by one. Gives twice less screen updates | |
279 |
|
280 | |||
280 | blockAxisSignals(true); |
|
281 | blockAxisSignals(true); | |
281 |
|
282 | |||
282 | QMapIterator<QAbstractSeries*, Domain*> i(m_seriesDomainMap); |
|
283 | QMapIterator<QAbstractSeries*, Domain*> i(m_seriesDomainMap); | |
283 |
|
284 | |||
284 | while (i.hasNext()) { |
|
285 | while (i.hasNext()) { | |
285 | i.next(); |
|
286 | i.next(); | |
286 | i.value()->zoomOut(rect,size); |
|
287 | i.value()->zoomOut(rect,size); | |
287 | } |
|
288 | } | |
288 |
|
289 | |||
289 | blockAxisSignals(false); |
|
290 | blockAxisSignals(false); | |
290 | } |
|
291 | } | |
291 |
|
292 | |||
292 | void ChartDataSet::blockAxisSignals(bool enabled) |
|
293 | void ChartDataSet::blockAxisSignals(bool enabled) | |
293 | { |
|
294 | { | |
294 | QMapIterator<QAbstractSeries*, Domain*> i(m_seriesDomainMap); |
|
295 | QMapIterator<QAbstractSeries*, Domain*> i(m_seriesDomainMap); | |
295 |
|
296 | |||
296 | while (i.hasNext()) { |
|
297 | while (i.hasNext()) { | |
297 | i.next(); |
|
298 | i.next(); | |
298 | QAbstractAxis* axisX = m_seriesAxisXMap.value(i.key()); |
|
299 | QAbstractAxis* axisX = m_seriesAxisXMap.value(i.key()); | |
299 | QAbstractAxis* axisY = m_seriesAxisYMap.value(i.key()); |
|
300 | QAbstractAxis* axisY = m_seriesAxisYMap.value(i.key()); | |
300 | if(axisX) axisX->blockSignals(enabled); |
|
301 | if(axisX) axisX->blockSignals(enabled); | |
301 | if(axisY) axisY->blockSignals(enabled); |
|
302 | if(axisY) axisY->blockSignals(enabled); | |
302 | } |
|
303 | } | |
303 | } |
|
304 | } | |
304 |
|
305 | |||
305 | int ChartDataSet::seriesCount(QAbstractSeries::SeriesType type) |
|
306 | int ChartDataSet::seriesCount(QAbstractSeries::SeriesType type) | |
306 | { |
|
307 | { | |
307 | int count=0; |
|
308 | int count=0; | |
308 | QMapIterator<QAbstractSeries*, Domain*> i(m_seriesDomainMap); |
|
309 | QMapIterator<QAbstractSeries*, Domain*> i(m_seriesDomainMap); | |
309 | while (i.hasNext()) { |
|
310 | while (i.hasNext()) { | |
310 | i.next(); |
|
311 | i.next(); | |
311 | if(i.key()->type()==type) count++; |
|
312 | if(i.key()->type()==type) count++; | |
312 | } |
|
313 | } | |
313 | return count; |
|
314 | return count; | |
314 | } |
|
315 | } | |
315 |
|
316 | |||
316 | int ChartDataSet::seriesIndex(QAbstractSeries *series) |
|
317 | int ChartDataSet::seriesIndex(QAbstractSeries *series) | |
317 | { |
|
318 | { | |
318 | QMapIterator<int, QAbstractSeries*> i(m_indexSeriesMap); |
|
319 | QMapIterator<int, QAbstractSeries*> i(m_indexSeriesMap); | |
319 | while (i.hasNext()) { |
|
320 | while (i.hasNext()) { | |
320 | i.next(); |
|
321 | i.next(); | |
321 | if (i.value() == series) |
|
322 | if (i.value() == series) | |
322 | return i.key(); |
|
323 | return i.key(); | |
323 | } |
|
324 | } | |
324 | return -1; |
|
325 | return -1; | |
325 | } |
|
326 | } | |
326 |
|
327 | |||
327 | QAbstractAxis* ChartDataSet::axisX(QAbstractSeries *series) const |
|
328 | QAbstractAxis* ChartDataSet::axisX(QAbstractSeries *series) const | |
328 | { |
|
329 | { | |
329 | if(series == 0) return m_seriesAxisXMap.begin().value(); |
|
330 | if(series == 0) return m_seriesAxisXMap.begin().value(); | |
330 | return m_seriesAxisXMap.value(series); |
|
331 | return m_seriesAxisXMap.value(series); | |
331 | } |
|
332 | } | |
332 |
|
333 | |||
333 | QAbstractAxis* ChartDataSet::axisY(QAbstractSeries *series) const |
|
334 | QAbstractAxis* ChartDataSet::axisY(QAbstractSeries *series) const | |
334 | { |
|
335 | { | |
335 | if(series == 0) return m_seriesAxisYMap.begin().value(); |
|
336 | if(series == 0) return m_seriesAxisYMap.begin().value(); | |
336 | return m_seriesAxisYMap.value(series); |
|
337 | return m_seriesAxisYMap.value(series); | |
337 | } |
|
338 | } | |
338 |
|
339 | |||
339 | void ChartDataSet::setAxisX(QAbstractSeries *series, QAbstractAxis *axis) |
|
340 | void ChartDataSet::setAxisX(QAbstractSeries *series, QAbstractAxis *axis) | |
340 | { |
|
341 | { | |
341 | Q_ASSERT(axis); |
|
342 | Q_ASSERT(axis); | |
342 | Domain* domain = m_seriesDomainMap.value(series); |
|
343 | Domain* domain = m_seriesDomainMap.value(series); | |
343 |
|
344 | |||
344 | if(!domain) { |
|
345 | if(!domain) { | |
345 | qWarning() << "Series not found on the chart."; |
|
346 | qWarning() << "Series not found on the chart."; | |
346 | return; |
|
347 | return; | |
347 | } |
|
348 | } | |
348 |
|
349 | |||
349 | if(axis->d_ptr->m_orientation==Qt::Vertical) { |
|
350 | if(axis->d_ptr->m_orientation==Qt::Vertical) { | |
350 | qWarning()<<"Axis already defined as axis Y"; |
|
351 | qWarning()<<"Axis already defined as axis Y"; | |
351 | return; |
|
352 | return; | |
352 | } |
|
353 | } | |
353 |
|
354 | |||
354 | QAbstractAxis *oldAxis = m_seriesAxisXMap.take(series); |
|
355 | QAbstractAxis *oldAxis = m_seriesAxisXMap.take(series); | |
355 | QList<QAbstractAxis*> axesX = m_seriesAxisXMap.values(); |
|
356 | QList<QAbstractAxis*> axesX = m_seriesAxisXMap.values(); | |
356 |
|
357 | |||
357 | if(oldAxis) { |
|
358 | if(oldAxis) { | |
358 |
|
359 | |||
359 | int x = axesX.indexOf(oldAxis); |
|
360 | int x = axesX.indexOf(oldAxis); | |
360 | if(x==-1) { |
|
361 | if(x==-1) { | |
361 | emit axisRemoved(oldAxis); |
|
362 | emit axisRemoved(oldAxis); | |
362 | oldAxis->deleteLater(); |
|
363 | oldAxis->deleteLater(); | |
363 | } |
|
364 | } | |
364 | } |
|
365 | } | |
365 |
|
366 | |||
366 | QObject::connect(axis->d_ptr.data(),SIGNAL(changed(qreal,qreal,int,bool)),domain,SLOT(handleAxisXChanged(qreal,qreal,int,bool))); |
|
367 | QObject::connect(axis->d_ptr.data(),SIGNAL(changed(qreal,qreal,int,bool)),domain,SLOT(handleAxisXChanged(qreal,qreal,int,bool))); | |
367 | QObject::connect(domain,SIGNAL(rangeXChanged(qreal,qreal,int)),axis->d_ptr.data(),SLOT(handleAxisRangeChanged(qreal,qreal,int))); |
|
368 | QObject::connect(domain,SIGNAL(rangeXChanged(qreal,qreal,int)),axis->d_ptr.data(),SLOT(handleAxisRangeChanged(qreal,qreal,int))); | |
368 |
|
369 | |||
369 | int x = axesX.indexOf(axis); |
|
370 | int x = axesX.indexOf(axis); | |
370 | if(x==-1) { |
|
371 | if(x==-1) { | |
371 | axis->d_ptr->m_orientation=Qt::Horizontal; |
|
372 | axis->d_ptr->m_orientation=Qt::Horizontal; | |
372 | emit axisAdded(axis,domain); |
|
373 | emit axisAdded(axis,domain); | |
373 | } |
|
374 | } | |
374 |
|
375 | |||
375 | m_seriesAxisXMap.insert(series,axis); |
|
376 | m_seriesAxisXMap.insert(series,axis); | |
376 | axis->d_ptr->emitRange(); |
|
377 | axis->d_ptr->emitRange(); | |
377 | } |
|
378 | } | |
378 |
|
379 | |||
379 | void ChartDataSet::setAxisY(QAbstractSeries *series, QAbstractAxis *axis) |
|
380 | void ChartDataSet::setAxisY(QAbstractSeries *series, QAbstractAxis *axis) | |
380 | { |
|
381 | { | |
381 | Q_ASSERT(axis); |
|
382 | Q_ASSERT(axis); | |
382 | Domain* domain = m_seriesDomainMap.value(series); |
|
383 | Domain* domain = m_seriesDomainMap.value(series); | |
383 |
|
384 | |||
384 | if(!domain) { |
|
385 | if(!domain) { | |
385 | qWarning() << "Series not found on the chart."; |
|
386 | qWarning() << "Series not found on the chart."; | |
386 | return; |
|
387 | return; | |
387 | } |
|
388 | } | |
388 |
|
389 | |||
389 | if(axis->d_ptr->m_orientation==Qt::Horizontal) { |
|
390 | if(axis->d_ptr->m_orientation==Qt::Horizontal) { | |
390 | qWarning()<<"Axis already defined as axis X"; |
|
391 | qWarning()<<"Axis already defined as axis X"; | |
391 | return; |
|
392 | return; | |
392 | } |
|
393 | } | |
393 |
|
394 | |||
394 | QAbstractAxis *oldAxis = m_seriesAxisYMap.take(series); |
|
395 | QAbstractAxis *oldAxis = m_seriesAxisYMap.take(series); | |
395 | QList<QAbstractAxis*> axesY = m_seriesAxisYMap.values(); |
|
396 | QList<QAbstractAxis*> axesY = m_seriesAxisYMap.values(); | |
396 |
|
397 | |||
397 | if(oldAxis) { |
|
398 | if(oldAxis) { | |
398 | int y = axesY.indexOf(oldAxis); |
|
399 | int y = axesY.indexOf(oldAxis); | |
399 | if(y==-1) { |
|
400 | if(y==-1) { | |
400 | emit axisRemoved(oldAxis); |
|
401 | emit axisRemoved(oldAxis); | |
401 | oldAxis->deleteLater(); |
|
402 | oldAxis->deleteLater(); | |
402 | } |
|
403 | } | |
403 | } |
|
404 | } | |
404 |
|
405 | |||
405 | QObject::connect(axis->d_ptr.data(),SIGNAL(changed(qreal,qreal,int,bool)),domain,SLOT(handleAxisYChanged(qreal,qreal,int,bool))); |
|
406 | QObject::connect(axis->d_ptr.data(),SIGNAL(changed(qreal,qreal,int,bool)),domain,SLOT(handleAxisYChanged(qreal,qreal,int,bool))); | |
406 | QObject::connect(domain,SIGNAL(rangeYChanged(qreal,qreal,int)),axis->d_ptr.data(),SLOT(handleAxisRangeChanged(qreal,qreal,int))); |
|
407 | QObject::connect(domain,SIGNAL(rangeYChanged(qreal,qreal,int)),axis->d_ptr.data(),SLOT(handleAxisRangeChanged(qreal,qreal,int))); | |
407 |
|
408 | |||
408 | int y = axesY.indexOf(axis); |
|
409 | int y = axesY.indexOf(axis); | |
409 | if(y==-1) { |
|
410 | if(y==-1) { | |
410 | axis->d_ptr->m_orientation=Qt::Vertical; |
|
411 | axis->d_ptr->m_orientation=Qt::Vertical; | |
411 | emit axisAdded(axis,domain); |
|
412 | emit axisAdded(axis,domain); | |
412 | } |
|
413 | } | |
413 |
|
414 | |||
414 | m_seriesAxisYMap.insert(series,axis); |
|
415 | m_seriesAxisYMap.insert(series,axis); | |
415 | axis->d_ptr->emitRange(); |
|
416 | axis->d_ptr->emitRange(); | |
416 | } |
|
417 | } | |
417 |
|
418 | |||
418 | Domain* ChartDataSet::domain(QAbstractSeries *series) const |
|
419 | Domain* ChartDataSet::domain(QAbstractSeries *series) const | |
419 | { |
|
420 | { | |
420 | return m_seriesDomainMap.value(series); |
|
421 | return m_seriesDomainMap.value(series); | |
421 | } |
|
422 | } | |
422 |
|
423 | |||
423 | void ChartDataSet::scrollDomain(qreal dx,qreal dy,const QSizeF& size) |
|
424 | void ChartDataSet::scrollDomain(qreal dx,qreal dy,const QSizeF& size) | |
424 | { |
|
425 | { | |
425 | blockAxisSignals(true); |
|
426 | blockAxisSignals(true); | |
426 | QMapIterator<QAbstractSeries*, Domain*> i(m_seriesDomainMap); |
|
427 | QMapIterator<QAbstractSeries*, Domain*> i(m_seriesDomainMap); | |
427 | while (i.hasNext()) { |
|
428 | while (i.hasNext()) { | |
428 | i.next(); |
|
429 | i.next(); | |
429 | i.value()->move(dx,dy,size); |
|
430 | i.value()->move(dx,dy,size); | |
430 | } |
|
431 | } | |
431 | blockAxisSignals(false); |
|
432 | blockAxisSignals(false); | |
432 | } |
|
433 | } | |
433 |
|
434 | |||
434 | QList<QAbstractSeries*> ChartDataSet::series() const |
|
435 | QList<QAbstractSeries*> ChartDataSet::series() const | |
435 | { |
|
436 | { | |
436 | return m_seriesAxisXMap.keys(); |
|
437 | return m_seriesAxisXMap.keys(); | |
437 | } |
|
438 | } | |
438 |
|
439 | |||
439 | void ChartDataSet::updateSeries(QAbstractSeries *series) |
|
440 | void ChartDataSet::updateSeries(QAbstractSeries *series) | |
440 | { |
|
441 | { | |
441 | emit seriesUpdated(series); |
|
442 | emit seriesUpdated(series); | |
442 | } |
|
443 | } | |
443 |
|
444 | |||
444 | #include "moc_chartdataset_p.cpp" |
|
445 | #include "moc_chartdataset_p.cpp" | |
445 |
|
446 | |||
446 | QTCOMMERCIALCHART_END_NAMESPACE |
|
447 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now