@@ -1,407 +1,410 | |||||
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 "chartpresenter_p.h" |
|
22 | #include "chartpresenter_p.h" | |
23 | #include "qchart.h" |
|
23 | #include "qchart.h" | |
24 | #include "qchart_p.h" |
|
24 | #include "qchart_p.h" | |
25 | #include "qvalueaxis.h" |
|
25 | #include "qvalueaxis.h" | |
26 | #include "qbarcategoryaxis.h" |
|
26 | #include "qbarcategoryaxis.h" | |
27 | #include "qvalueaxis_p.h" |
|
27 | #include "qvalueaxis_p.h" | |
28 | #include "qcategoryaxis.h" |
|
28 | #include "qcategoryaxis.h" | |
29 | #include "qabstractseries_p.h" |
|
29 | #include "qabstractseries_p.h" | |
30 | #include "qabstractbarseries.h" |
|
30 | #include "qabstractbarseries.h" | |
31 | #include "qstackedbarseries.h" |
|
31 | #include "qstackedbarseries.h" | |
32 | #include "qpercentbarseries.h" |
|
32 | #include "qpercentbarseries.h" | |
33 | #include "qpieseries.h" |
|
33 | #include "qpieseries.h" | |
34 | #include "chartitem_p.h" |
|
34 | #include "chartitem_p.h" | |
35 | #include "xydomain_p.h" |
|
35 | #include "xydomain_p.h" | |
|
36 | #include "xlogydomain_p.h" | |||
|
37 | #include "logxydomain_p.h" | |||
|
38 | #include "logxlogydomain_p.h" | |||
36 |
|
39 | |||
37 | #ifndef QT_ON_ARM |
|
40 | #ifndef QT_ON_ARM | |
38 | #include "qdatetimeaxis.h" |
|
41 | #include "qdatetimeaxis.h" | |
39 | #endif |
|
42 | #endif | |
40 |
|
43 | |||
41 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
44 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
42 |
|
45 | |||
43 | ChartDataSet::ChartDataSet(QChart *chart) |
|
46 | ChartDataSet::ChartDataSet(QChart *chart) | |
44 | : QObject(chart), |
|
47 | : QObject(chart), | |
45 | m_chart(chart) |
|
48 | m_chart(chart) | |
46 | { |
|
49 | { | |
47 |
|
50 | |||
48 | } |
|
51 | } | |
49 |
|
52 | |||
50 | ChartDataSet::~ChartDataSet() |
|
53 | ChartDataSet::~ChartDataSet() | |
51 | { |
|
54 | { | |
52 | removeAllSeries(); |
|
55 | removeAllSeries(); | |
53 | removeAllAxes(); |
|
56 | removeAllAxes(); | |
54 | } |
|
57 | } | |
55 |
|
58 | |||
56 | /* |
|
59 | /* | |
57 | * This method adds series to chartdataset, series ownership is taken from caller. |
|
60 | * This method adds series to chartdataset, series ownership is taken from caller. | |
58 | */ |
|
61 | */ | |
59 | void ChartDataSet::addSeries(QAbstractSeries *series) |
|
62 | void ChartDataSet::addSeries(QAbstractSeries *series) | |
60 | { |
|
63 | { | |
61 | if (m_seriesList.contains(series)) { |
|
64 | if (m_seriesList.contains(series)) { | |
62 | qWarning() << QObject::tr("Can not add series. Series already on the chart."); |
|
65 | qWarning() << QObject::tr("Can not add series. Series already on the chart."); | |
63 | return; |
|
66 | return; | |
64 | } |
|
67 | } | |
65 |
|
68 | |||
66 | series->d_ptr->initializeDomain(); |
|
69 | series->d_ptr->initializeDomain(); | |
67 | m_seriesList.append(series); |
|
70 | m_seriesList.append(series); | |
68 |
|
71 | |||
69 | series->setParent(this); // take ownership |
|
72 | series->setParent(this); // take ownership | |
70 | series->d_ptr->m_chart = m_chart; |
|
73 | series->d_ptr->m_chart = m_chart; | |
71 |
|
74 | |||
72 | emit seriesAdded(series); |
|
75 | emit seriesAdded(series); | |
73 | } |
|
76 | } | |
74 |
|
77 | |||
75 | /* |
|
78 | /* | |
76 | * This method adds axis to chartdataset, axis ownership is taken from caller. |
|
79 | * This method adds axis to chartdataset, axis ownership is taken from caller. | |
77 | */ |
|
80 | */ | |
78 | void ChartDataSet::addAxis(QAbstractAxis *axis,Qt::Alignment aligment) |
|
81 | void ChartDataSet::addAxis(QAbstractAxis *axis,Qt::Alignment aligment) | |
79 | { |
|
82 | { | |
80 | if (m_axisList.contains(axis)) { |
|
83 | if (m_axisList.contains(axis)) { | |
81 | qWarning() << QObject::tr("Can not add axis. Axis already on the chart."); |
|
84 | qWarning() << QObject::tr("Can not add axis. Axis already on the chart."); | |
82 | return; |
|
85 | return; | |
83 | } |
|
86 | } | |
84 |
|
87 | |||
85 | axis->d_ptr->setAlignment(aligment); |
|
88 | axis->d_ptr->setAlignment(aligment); | |
86 |
|
89 | |||
87 | if(!axis->alignment()) { |
|
90 | if(!axis->alignment()) { | |
88 | qWarning()<< QObject::tr("No alignment specified !"); |
|
91 | qWarning()<< QObject::tr("No alignment specified !"); | |
89 | return; |
|
92 | return; | |
90 | }; |
|
93 | }; | |
91 |
|
94 | |||
92 | QSharedPointer<AbstractDomain> domain(new XYDomain()); |
|
95 | QSharedPointer<AbstractDomain> domain(new XYDomain()); | |
93 | axis->d_ptr->initializeDomain(domain.data()); |
|
96 | axis->d_ptr->initializeDomain(domain.data()); | |
94 |
|
97 | |||
95 | axis->setParent(this); |
|
98 | axis->setParent(this); | |
96 | axis->d_ptr->m_chart = m_chart; |
|
99 | axis->d_ptr->m_chart = m_chart; | |
97 | m_axisList.append(axis); |
|
100 | m_axisList.append(axis); | |
98 |
|
101 | |||
99 | emit axisAdded(axis); |
|
102 | emit axisAdded(axis); | |
100 | } |
|
103 | } | |
101 |
|
104 | |||
102 | /* |
|
105 | /* | |
103 | * This method removes series form chartdataset, series ownership is passed back to caller. |
|
106 | * This method removes series form chartdataset, series ownership is passed back to caller. | |
104 | */ |
|
107 | */ | |
105 | void ChartDataSet::removeSeries(QAbstractSeries *series) |
|
108 | void ChartDataSet::removeSeries(QAbstractSeries *series) | |
106 | { |
|
109 | { | |
107 |
|
110 | |||
108 | if (! m_seriesList.contains(series)) { |
|
111 | if (! m_seriesList.contains(series)) { | |
109 | qWarning() << QObject::tr("Can not remove series. Series not found on the chart."); |
|
112 | qWarning() << QObject::tr("Can not remove series. Series not found on the chart."); | |
110 | return; |
|
113 | return; | |
111 | } |
|
114 | } | |
112 |
|
115 | |||
113 | emit seriesRemoved(series); |
|
116 | emit seriesRemoved(series); | |
114 | m_seriesList.removeAll(series); |
|
117 | m_seriesList.removeAll(series); | |
115 |
|
118 | |||
116 | series->setParent(0); |
|
119 | series->setParent(0); | |
117 | series->d_ptr->m_chart = 0; |
|
120 | series->d_ptr->m_chart = 0; | |
118 | series->d_ptr->m_domain.clear(); |
|
121 | series->d_ptr->m_domain.clear(); | |
119 |
|
122 | |||
120 | QList<QAbstractAxis*> axes = series->d_ptr->m_axes; |
|
123 | QList<QAbstractAxis*> axes = series->d_ptr->m_axes; | |
121 |
|
124 | |||
122 | foreach(QAbstractAxis* axis, axes) { |
|
125 | foreach(QAbstractAxis* axis, axes) { | |
123 | axis->d_ptr->m_series.removeAll(series); |
|
126 | axis->d_ptr->m_series.removeAll(series); | |
124 | series->d_ptr->m_axes.removeAll(axis); |
|
127 | series->d_ptr->m_axes.removeAll(axis); | |
125 | } |
|
128 | } | |
126 | } |
|
129 | } | |
127 |
|
130 | |||
128 | /* |
|
131 | /* | |
129 | * This method removes axis form chartdataset, series ownership is passed back to caller. |
|
132 | * This method removes axis form chartdataset, series ownership is passed back to caller. | |
130 | */ |
|
133 | */ | |
131 | void ChartDataSet::removeAxis(QAbstractAxis *axis) |
|
134 | void ChartDataSet::removeAxis(QAbstractAxis *axis) | |
132 | { |
|
135 | { | |
133 | if (! m_axisList.contains(axis)) { |
|
136 | if (! m_axisList.contains(axis)) { | |
134 | qWarning() << QObject::tr("Can not remove axis. Axis not found on the chart."); |
|
137 | qWarning() << QObject::tr("Can not remove axis. Axis not found on the chart."); | |
135 | return; |
|
138 | return; | |
136 | } |
|
139 | } | |
137 |
|
140 | |||
138 | emit axisRemoved(axis); |
|
141 | emit axisRemoved(axis); | |
139 | m_axisList.removeAll(axis); |
|
142 | m_axisList.removeAll(axis); | |
140 |
|
143 | |||
141 | axis->setParent(0); |
|
144 | axis->setParent(0); | |
142 | axis->d_ptr->m_chart = 0; |
|
145 | axis->d_ptr->m_chart = 0; | |
143 |
|
146 | |||
144 | QList<QAbstractSeries*> series = axis->d_ptr->m_series; |
|
147 | QList<QAbstractSeries*> series = axis->d_ptr->m_series; | |
145 |
|
148 | |||
146 | foreach(QAbstractSeries* s, series) { |
|
149 | foreach(QAbstractSeries* s, series) { | |
147 | s->d_ptr->m_axes.removeAll(axis); |
|
150 | s->d_ptr->m_axes.removeAll(axis); | |
148 | axis->d_ptr->m_series.removeAll(s); |
|
151 | axis->d_ptr->m_series.removeAll(s); | |
149 | } |
|
152 | } | |
150 | } |
|
153 | } | |
151 |
|
154 | |||
152 | /* |
|
155 | /* | |
153 | * This method attach axis to series, return true if success. |
|
156 | * This method attach axis to series, return true if success. | |
154 | */ |
|
157 | */ | |
155 | bool ChartDataSet::attachAxis(QAbstractSeries* series,QAbstractAxis *axis) |
|
158 | bool ChartDataSet::attachAxis(QAbstractSeries* series,QAbstractAxis *axis) | |
156 | { |
|
159 | { | |
157 | Q_ASSERT(series); |
|
160 | Q_ASSERT(series); | |
158 | Q_ASSERT(axis); |
|
161 | Q_ASSERT(axis); | |
159 |
|
162 | |||
160 | QList<QAbstractSeries* > attachedSeriesList = axis->d_ptr->m_series; |
|
163 | QList<QAbstractSeries* > attachedSeriesList = axis->d_ptr->m_series; | |
161 | QList<QAbstractAxis* > attachedAxisList = series->d_ptr->m_axes; |
|
164 | QList<QAbstractAxis* > attachedAxisList = series->d_ptr->m_axes; | |
162 | QSharedPointer<AbstractDomain> domain = series->d_ptr->m_domain; |
|
165 | QSharedPointer<AbstractDomain> domain = series->d_ptr->m_domain; | |
163 |
|
166 | |||
164 | if (!m_seriesList.contains(series)) { |
|
167 | if (!m_seriesList.contains(series)) { | |
165 | qWarning() << QObject::tr("Can not find series on the chart."); |
|
168 | qWarning() << QObject::tr("Can not find series on the chart."); | |
166 | return false; |
|
169 | return false; | |
167 | } |
|
170 | } | |
168 |
|
171 | |||
169 | if (axis && !m_axisList.contains(axis)) { |
|
172 | if (axis && !m_axisList.contains(axis)) { | |
170 | qWarning() << QObject::tr("Can not find axis on the chart."); |
|
173 | qWarning() << QObject::tr("Can not find axis on the chart."); | |
171 | return false; |
|
174 | return false; | |
172 | } |
|
175 | } | |
173 |
|
176 | |||
174 | if (attachedAxisList.contains(axis)) { |
|
177 | if (attachedAxisList.contains(axis)) { | |
175 | qWarning() << QObject::tr("Axis already attached to series."); |
|
178 | qWarning() << QObject::tr("Axis already attached to series."); | |
176 | return false; |
|
179 | return false; | |
177 | } |
|
180 | } | |
178 |
|
181 | |||
179 | Q_ASSERT(!attachedSeriesList.contains(series)); |
|
182 | Q_ASSERT(!attachedSeriesList.contains(series)); | |
180 | Q_ASSERT(!domain.isNull()); |
|
183 | Q_ASSERT(!domain.isNull()); | |
181 |
|
184 | |||
182 | if(attachedSeriesList.isEmpty()){ |
|
185 | if(attachedSeriesList.isEmpty()){ | |
183 |
|
186 | |||
184 | }else{ |
|
187 | }else{ | |
185 | domain = attachedSeriesList.first()->d_ptr->domain(); |
|
188 | domain = attachedSeriesList.first()->d_ptr->domain(); | |
186 | Q_ASSERT(!domain.isNull()); |
|
189 | Q_ASSERT(!domain.isNull()); | |
187 | series->d_ptr->setDomain(domain); |
|
190 | series->d_ptr->setDomain(domain); | |
188 | } |
|
191 | } | |
189 |
|
192 | |||
190 | series->d_ptr->m_axes<<axis; |
|
193 | series->d_ptr->m_axes<<axis; | |
191 | axis->d_ptr->m_series<<series; |
|
194 | axis->d_ptr->m_series<<series; | |
192 |
|
195 | |||
193 | series->d_ptr->initializeAxes(); |
|
196 | series->d_ptr->initializeAxes(); | |
194 | axis->d_ptr->initializeDomain(domain.data()); |
|
197 | axis->d_ptr->initializeDomain(domain.data()); | |
195 |
|
198 | |||
196 | if(axis->orientation()==Qt::Vertical){ |
|
199 | if(axis->orientation()==Qt::Vertical){ | |
197 | QObject::connect(axis->d_ptr.data(), SIGNAL(rangeChanged(qreal,qreal)), domain.data(), SLOT(handleVerticalAxisRangeChanged(qreal,qreal))); |
|
200 | QObject::connect(axis->d_ptr.data(), SIGNAL(rangeChanged(qreal,qreal)), domain.data(), SLOT(handleVerticalAxisRangeChanged(qreal,qreal))); | |
198 | QObject::connect(domain.data(), SIGNAL(rangeVerticalChanged(qreal,qreal)), axis->d_ptr.data(), SLOT(handleRangeChanged(qreal,qreal))); |
|
201 | QObject::connect(domain.data(), SIGNAL(rangeVerticalChanged(qreal,qreal)), axis->d_ptr.data(), SLOT(handleRangeChanged(qreal,qreal))); | |
199 | } |
|
202 | } | |
200 |
|
203 | |||
201 | if(axis->orientation()==Qt::Horizontal){ |
|
204 | if(axis->orientation()==Qt::Horizontal){ | |
202 | QObject::connect(axis->d_ptr.data(), SIGNAL(rangeChanged(qreal,qreal)), domain.data(), SLOT(handleHorizontalAxisRangeChanged(qreal,qreal))); |
|
205 | QObject::connect(axis->d_ptr.data(), SIGNAL(rangeChanged(qreal,qreal)), domain.data(), SLOT(handleHorizontalAxisRangeChanged(qreal,qreal))); | |
203 | QObject::connect(domain.data(), SIGNAL(rangeHorizontalChanged(qreal,qreal)), axis->d_ptr.data(), SLOT(handleRangeChanged(qreal,qreal))); |
|
206 | QObject::connect(domain.data(), SIGNAL(rangeHorizontalChanged(qreal,qreal)), axis->d_ptr.data(), SLOT(handleRangeChanged(qreal,qreal))); | |
204 | } |
|
207 | } | |
205 |
|
208 | |||
206 | return true; |
|
209 | return true; | |
207 | } |
|
210 | } | |
208 |
|
211 | |||
209 | /* |
|
212 | /* | |
210 | * This method detach axis to series, return true if success. |
|
213 | * This method detach axis to series, return true if success. | |
211 | */ |
|
214 | */ | |
212 | bool ChartDataSet::detachAxis(QAbstractSeries* series,QAbstractAxis *axis) |
|
215 | bool ChartDataSet::detachAxis(QAbstractSeries* series,QAbstractAxis *axis) | |
213 | { |
|
216 | { | |
214 | Q_ASSERT(series); |
|
217 | Q_ASSERT(series); | |
215 | Q_ASSERT(axis); |
|
218 | Q_ASSERT(axis); | |
216 |
|
219 | |||
217 | QList<QAbstractSeries* > attachedSeriesList = axis->d_ptr->m_series; |
|
220 | QList<QAbstractSeries* > attachedSeriesList = axis->d_ptr->m_series; | |
218 | QList<QAbstractAxis* > attachedAxisList = series->d_ptr->m_axes; |
|
221 | QList<QAbstractAxis* > attachedAxisList = series->d_ptr->m_axes; | |
219 | QSharedPointer<AbstractDomain> domain = series->d_ptr->m_domain; |
|
222 | QSharedPointer<AbstractDomain> domain = series->d_ptr->m_domain; | |
220 |
|
223 | |||
221 | if (!m_seriesList.contains(series)) { |
|
224 | if (!m_seriesList.contains(series)) { | |
222 | qWarning() << QObject::tr("Can not find series on the chart."); |
|
225 | qWarning() << QObject::tr("Can not find series on the chart."); | |
223 | return false; |
|
226 | return false; | |
224 | } |
|
227 | } | |
225 |
|
228 | |||
226 | if (axis && !m_axisList.contains(axis)) { |
|
229 | if (axis && !m_axisList.contains(axis)) { | |
227 | qWarning() << QObject::tr("Can not find axis on the chart."); |
|
230 | qWarning() << QObject::tr("Can not find axis on the chart."); | |
228 | return false; |
|
231 | return false; | |
229 | } |
|
232 | } | |
230 |
|
233 | |||
231 | if (!attachedAxisList.contains(axis)) { |
|
234 | if (!attachedAxisList.contains(axis)) { | |
232 | qWarning() << QObject::tr("Axis not attached to series."); |
|
235 | qWarning() << QObject::tr("Axis not attached to series."); | |
233 | return false; |
|
236 | return false; | |
234 | } |
|
237 | } | |
235 |
|
238 | |||
236 | Q_ASSERT(axis->d_ptr->m_series.contains(series)); |
|
239 | Q_ASSERT(axis->d_ptr->m_series.contains(series)); | |
237 |
|
240 | |||
238 | series->d_ptr->m_axes.removeAll(axis); |
|
241 | series->d_ptr->m_axes.removeAll(axis); | |
239 | axis->d_ptr->m_series.removeAll(series); |
|
242 | axis->d_ptr->m_series.removeAll(series); | |
240 |
|
243 | |||
241 | if(axis->orientation()==Qt::Vertical){ |
|
244 | if(axis->orientation()==Qt::Vertical){ | |
242 | QObject::disconnect(axis->d_ptr.data(), SIGNAL(rangeChanged(qreal,qreal)), domain.data(), SLOT(handleVerticalAxisRangeChanged(qreal,qreal))); |
|
245 | QObject::disconnect(axis->d_ptr.data(), SIGNAL(rangeChanged(qreal,qreal)), domain.data(), SLOT(handleVerticalAxisRangeChanged(qreal,qreal))); | |
243 | QObject::disconnect(domain.data(), SIGNAL(rangeVerticalChanged(qreal,qreal)), axis->d_ptr.data(), SLOT(handleRangeChanged(qreal,qreal))); |
|
246 | QObject::disconnect(domain.data(), SIGNAL(rangeVerticalChanged(qreal,qreal)), axis->d_ptr.data(), SLOT(handleRangeChanged(qreal,qreal))); | |
244 | } |
|
247 | } | |
245 |
|
248 | |||
246 | if(axis->orientation()==Qt::Horizontal){ |
|
249 | if(axis->orientation()==Qt::Horizontal){ | |
247 | QObject::disconnect(axis->d_ptr.data(), SIGNAL(rangeChanged(qreal,qreal)), domain.data(), SLOT(handleHorizontalAxisRangeChanged(qreal,qreal))); |
|
250 | QObject::disconnect(axis->d_ptr.data(), SIGNAL(rangeChanged(qreal,qreal)), domain.data(), SLOT(handleHorizontalAxisRangeChanged(qreal,qreal))); | |
248 | QObject::disconnect(domain.data(), SIGNAL(rangeHorizontalChanged(qreal,qreal)), axis->d_ptr.data(), SLOT(handleRangeChanged(qreal,qreal))); |
|
251 | QObject::disconnect(domain.data(), SIGNAL(rangeHorizontalChanged(qreal,qreal)), axis->d_ptr.data(), SLOT(handleRangeChanged(qreal,qreal))); | |
249 | } |
|
252 | } | |
250 |
|
253 | |||
251 | return true; |
|
254 | return true; | |
252 | } |
|
255 | } | |
253 |
|
256 | |||
254 | void ChartDataSet::createDefaultAxes() |
|
257 | void ChartDataSet::createDefaultAxes() | |
255 | { |
|
258 | { | |
256 | if (m_seriesList.isEmpty()) |
|
259 | if (m_seriesList.isEmpty()) | |
257 | return; |
|
260 | return; | |
258 |
|
261 | |||
259 | QAbstractAxis::AxisTypes typeX(0); |
|
262 | QAbstractAxis::AxisTypes typeX(0); | |
260 | QAbstractAxis::AxisTypes typeY(0); |
|
263 | QAbstractAxis::AxisTypes typeY(0); | |
261 |
|
264 | |||
262 | // Remove possibly existing axes |
|
265 | // Remove possibly existing axes | |
263 | removeAllAxes(); |
|
266 | removeAllAxes(); | |
264 |
|
267 | |||
265 | Q_ASSERT(m_axisList.isEmpty()); |
|
268 | Q_ASSERT(m_axisList.isEmpty()); | |
266 |
|
269 | |||
267 | // Select the required axis x and axis y types based on the types of the current series |
|
270 | // Select the required axis x and axis y types based on the types of the current series | |
268 | foreach(QAbstractSeries* s, m_seriesList) { |
|
271 | foreach(QAbstractSeries* s, m_seriesList) { | |
269 | typeX |= s->d_ptr->defaultAxisType(Qt::Horizontal); |
|
272 | typeX |= s->d_ptr->defaultAxisType(Qt::Horizontal); | |
270 | typeY |= s->d_ptr->defaultAxisType(Qt::Vertical); |
|
273 | typeY |= s->d_ptr->defaultAxisType(Qt::Vertical); | |
271 | } |
|
274 | } | |
272 |
|
275 | |||
273 | // Create the axes of the types selected |
|
276 | // Create the axes of the types selected | |
274 | createAxes(typeX, Qt::Horizontal); |
|
277 | createAxes(typeX, Qt::Horizontal); | |
275 | createAxes(typeY, Qt::Vertical); |
|
278 | createAxes(typeY, Qt::Vertical); | |
276 |
|
279 | |||
277 | } |
|
280 | } | |
278 |
|
281 | |||
279 | void ChartDataSet::createAxes(QAbstractAxis::AxisTypes type, Qt::Orientation orientation) |
|
282 | void ChartDataSet::createAxes(QAbstractAxis::AxisTypes type, Qt::Orientation orientation) | |
280 | { |
|
283 | { | |
281 | QAbstractAxis *axis = 0; |
|
284 | QAbstractAxis *axis = 0; | |
282 | //decide what axis should be created |
|
285 | //decide what axis should be created | |
283 |
|
286 | |||
284 | switch (type) { |
|
287 | switch (type) { | |
285 | case QAbstractAxis::AxisTypeValue: |
|
288 | case QAbstractAxis::AxisTypeValue: | |
286 | axis = new QValueAxis(this); |
|
289 | axis = new QValueAxis(this); | |
287 | break; |
|
290 | break; | |
288 | case QAbstractAxis::AxisTypeBarCategory: |
|
291 | case QAbstractAxis::AxisTypeBarCategory: | |
289 | axis = new QBarCategoryAxis(this); |
|
292 | axis = new QBarCategoryAxis(this); | |
290 | break; |
|
293 | break; | |
291 | case QAbstractAxis::AxisTypeCategory: |
|
294 | case QAbstractAxis::AxisTypeCategory: | |
292 | axis = new QCategoryAxis(this); |
|
295 | axis = new QCategoryAxis(this); | |
293 | break; |
|
296 | break; | |
294 | #ifndef Q_WS_QWS |
|
297 | #ifndef Q_WS_QWS | |
295 | case QAbstractAxis::AxisTypeDateTime: |
|
298 | case QAbstractAxis::AxisTypeDateTime: | |
296 | axis = new QDateTimeAxis(this); |
|
299 | axis = new QDateTimeAxis(this); | |
297 | break; |
|
300 | break; | |
298 | #endif |
|
301 | #endif | |
299 | default: |
|
302 | default: | |
300 | axis = 0; |
|
303 | axis = 0; | |
301 | break; |
|
304 | break; | |
302 | } |
|
305 | } | |
303 |
|
306 | |||
304 | if (axis) { |
|
307 | if (axis) { | |
305 | //create one axis for all |
|
308 | //create one axis for all | |
306 |
|
309 | |||
307 | addAxis(axis,orientation==Qt::Horizontal?Qt::AlignBottom:Qt::AlignLeft); |
|
310 | addAxis(axis,orientation==Qt::Horizontal?Qt::AlignBottom:Qt::AlignLeft); | |
308 |
|
311 | |||
309 | foreach(QAbstractSeries *s, m_seriesList) { |
|
312 | foreach(QAbstractSeries *s, m_seriesList) { | |
310 | attachAxis(s,axis); |
|
313 | attachAxis(s,axis); | |
311 | } |
|
314 | } | |
312 |
|
315 | |||
313 | } |
|
316 | } | |
314 | else if (!type.testFlag(QAbstractAxis::AxisTypeNoAxis)) { |
|
317 | else if (!type.testFlag(QAbstractAxis::AxisTypeNoAxis)) { | |
315 | //create separate axis |
|
318 | //create separate axis | |
316 | foreach(QAbstractSeries *s, m_seriesList) { |
|
319 | foreach(QAbstractSeries *s, m_seriesList) { | |
317 | QAbstractAxis *axis = s->d_ptr->createDefaultAxis(orientation); |
|
320 | QAbstractAxis *axis = s->d_ptr->createDefaultAxis(orientation); | |
318 | if(axis) { |
|
321 | if(axis) { | |
319 | addAxis(axis,orientation==Qt::Horizontal?Qt::AlignBottom:Qt::AlignLeft); |
|
322 | addAxis(axis,orientation==Qt::Horizontal?Qt::AlignBottom:Qt::AlignLeft); | |
320 | attachAxis(s,axis); |
|
323 | attachAxis(s,axis); | |
321 | } |
|
324 | } | |
322 | } |
|
325 | } | |
323 | } |
|
326 | } | |
324 | } |
|
327 | } | |
325 |
|
328 | |||
326 | void ChartDataSet::removeAllSeries() |
|
329 | void ChartDataSet::removeAllSeries() | |
327 | { |
|
330 | { | |
328 | foreach (QAbstractSeries *s , m_seriesList) |
|
331 | foreach (QAbstractSeries *s , m_seriesList) | |
329 | removeSeries(s); |
|
332 | removeSeries(s); | |
330 |
|
333 | |||
331 | Q_ASSERT(m_seriesList.count() == 0); |
|
334 | Q_ASSERT(m_seriesList.count() == 0); | |
332 | qDeleteAll(m_seriesList); |
|
335 | qDeleteAll(m_seriesList); | |
333 | } |
|
336 | } | |
334 |
|
337 | |||
335 | void ChartDataSet::removeAllAxes() |
|
338 | void ChartDataSet::removeAllAxes() | |
336 | { |
|
339 | { | |
337 | foreach (QAbstractAxis *a , m_axisList) |
|
340 | foreach (QAbstractAxis *a , m_axisList) | |
338 | removeAxis(a); |
|
341 | removeAxis(a); | |
339 |
|
342 | |||
340 | Q_ASSERT(m_axisList.count() == 0); |
|
343 | Q_ASSERT(m_axisList.count() == 0); | |
341 | qDeleteAll(m_axisList); |
|
344 | qDeleteAll(m_axisList); | |
342 | } |
|
345 | } | |
343 |
|
346 | |||
344 | void ChartDataSet::zoomInDomain(const QRectF &rect) |
|
347 | void ChartDataSet::zoomInDomain(const QRectF &rect) | |
345 | { |
|
348 | { | |
346 | QList<AbstractDomain*> domains; |
|
349 | QList<AbstractDomain*> domains; | |
347 | foreach(QAbstractSeries *s, m_seriesList) { |
|
350 | foreach(QAbstractSeries *s, m_seriesList) { | |
348 | AbstractDomain* domain = s->d_ptr->m_domain.data(); |
|
351 | AbstractDomain* domain = s->d_ptr->m_domain.data(); | |
349 | if(domains.contains(domain)) continue; |
|
352 | if(domains.contains(domain)) continue; | |
350 | s->d_ptr->m_domain->blockAxisSignals(true); |
|
353 | s->d_ptr->m_domain->blockAxisSignals(true); | |
351 | domains<<domain; |
|
354 | domains<<domain; | |
352 | } |
|
355 | } | |
353 |
|
356 | |||
354 | foreach(AbstractDomain *domain, domains) |
|
357 | foreach(AbstractDomain *domain, domains) | |
355 | domain->zoomIn(rect); |
|
358 | domain->zoomIn(rect); | |
356 |
|
359 | |||
357 | foreach(AbstractDomain *domain, domains) |
|
360 | foreach(AbstractDomain *domain, domains) | |
358 | domain->blockAxisSignals(false); |
|
361 | domain->blockAxisSignals(false); | |
359 | } |
|
362 | } | |
360 |
|
363 | |||
361 | void ChartDataSet::zoomOutDomain(const QRectF &rect) |
|
364 | void ChartDataSet::zoomOutDomain(const QRectF &rect) | |
362 | { |
|
365 | { | |
363 | QList<AbstractDomain*> domains; |
|
366 | QList<AbstractDomain*> domains; | |
364 | foreach(QAbstractSeries *s, m_seriesList) { |
|
367 | foreach(QAbstractSeries *s, m_seriesList) { | |
365 | AbstractDomain* domain = s->d_ptr->m_domain.data(); |
|
368 | AbstractDomain* domain = s->d_ptr->m_domain.data(); | |
366 | if(domains.contains(domain)) continue; |
|
369 | if(domains.contains(domain)) continue; | |
367 | s->d_ptr->m_domain->blockAxisSignals(true); |
|
370 | s->d_ptr->m_domain->blockAxisSignals(true); | |
368 | domains<<domain; |
|
371 | domains<<domain; | |
369 | } |
|
372 | } | |
370 |
|
373 | |||
371 | foreach(AbstractDomain *domain, domains) |
|
374 | foreach(AbstractDomain *domain, domains) | |
372 | domain->zoomOut(rect); |
|
375 | domain->zoomOut(rect); | |
373 |
|
376 | |||
374 | foreach(AbstractDomain *domain, domains) |
|
377 | foreach(AbstractDomain *domain, domains) | |
375 | domain->blockAxisSignals(false); |
|
378 | domain->blockAxisSignals(false); | |
376 | } |
|
379 | } | |
377 |
|
380 | |||
378 | void ChartDataSet::scrollDomain(qreal dx, qreal dy) |
|
381 | void ChartDataSet::scrollDomain(qreal dx, qreal dy) | |
379 | { |
|
382 | { | |
380 | QList<AbstractDomain*> domains; |
|
383 | QList<AbstractDomain*> domains; | |
381 | foreach(QAbstractSeries *s, m_seriesList) { |
|
384 | foreach(QAbstractSeries *s, m_seriesList) { | |
382 | AbstractDomain* domain = s->d_ptr->m_domain.data(); |
|
385 | AbstractDomain* domain = s->d_ptr->m_domain.data(); | |
383 | if(domains.contains(domain)) continue; |
|
386 | if(domains.contains(domain)) continue; | |
384 | s->d_ptr->m_domain->blockAxisSignals(true); |
|
387 | s->d_ptr->m_domain->blockAxisSignals(true); | |
385 | domains<<domain; |
|
388 | domains<<domain; | |
386 | } |
|
389 | } | |
387 |
|
390 | |||
388 | foreach(AbstractDomain *domain, domains) |
|
391 | foreach(AbstractDomain *domain, domains) | |
389 | domain->move(dx, dy); |
|
392 | domain->move(dx, dy); | |
390 |
|
393 | |||
391 | foreach(AbstractDomain *domain, domains) |
|
394 | foreach(AbstractDomain *domain, domains) | |
392 | domain->blockAxisSignals(false); |
|
395 | domain->blockAxisSignals(false); | |
393 | } |
|
396 | } | |
394 |
|
397 | |||
395 | QList<QAbstractAxis*> ChartDataSet::axes() const |
|
398 | QList<QAbstractAxis*> ChartDataSet::axes() const | |
396 | { |
|
399 | { | |
397 | return m_axisList; |
|
400 | return m_axisList; | |
398 | } |
|
401 | } | |
399 |
|
402 | |||
400 | QList<QAbstractSeries *> ChartDataSet::series() const |
|
403 | QList<QAbstractSeries *> ChartDataSet::series() const | |
401 | { |
|
404 | { | |
402 | return m_seriesList; |
|
405 | return m_seriesList; | |
403 | } |
|
406 | } | |
404 |
|
407 | |||
405 | #include "moc_chartdataset_p.cpp" |
|
408 | #include "moc_chartdataset_p.cpp" | |
406 |
|
409 | |||
407 | QTCOMMERCIALCHART_END_NAMESPACE |
|
410 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,296 +1,190 | |||||
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 "abstractdomain_p.h" |
|
21 | #include "abstractdomain_p.h" | |
22 | #include "qabstractaxis_p.h" |
|
22 | #include "qabstractaxis_p.h" | |
23 | #include <qmath.h> |
|
23 | #include <qmath.h> | |
24 |
|
24 | |||
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
26 |
|
26 | |||
27 | AbstractDomain::AbstractDomain(QObject *parent) |
|
27 | AbstractDomain::AbstractDomain(QObject *parent) | |
28 | : QObject(parent), |
|
28 | : QObject(parent), | |
29 | m_minX(0), |
|
29 | m_minX(0), | |
30 | m_maxX(0), |
|
30 | m_maxX(0), | |
31 | m_minY(0), |
|
31 | m_minY(0), | |
32 | m_maxY(0), |
|
32 | m_maxY(0), | |
33 | m_axisSignalsBlocked(false) |
|
33 | m_axisSignalsBlocked(false) | |
34 | { |
|
34 | { | |
35 | } |
|
35 | } | |
36 |
|
36 | |||
37 | AbstractDomain::~AbstractDomain() |
|
37 | AbstractDomain::~AbstractDomain() | |
38 | { |
|
38 | { | |
39 | } |
|
39 | } | |
40 |
|
40 | |||
41 | void AbstractDomain::setSize(const QSizeF& size) |
|
41 | void AbstractDomain::setSize(const QSizeF& size) | |
42 | { |
|
42 | { | |
43 | if(m_size!=size) |
|
43 | if(m_size!=size) | |
44 | { |
|
44 | { | |
45 | m_size=size; |
|
45 | m_size=size; | |
46 | emit updated(); |
|
46 | emit updated(); | |
47 | } |
|
47 | } | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | QSizeF AbstractDomain::size() const |
|
50 | QSizeF AbstractDomain::size() const | |
51 | { |
|
51 | { | |
52 | return m_size; |
|
52 | return m_size; | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
55 | //void AbstractDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) |
|
|||
56 | //{ |
|
|||
57 | // bool axisXChanged = false; |
|
|||
58 | // bool axisYChanged = false; |
|
|||
59 |
|
||||
60 | // if (!qFuzzyIsNull(m_minX - minX) || !qFuzzyIsNull(m_maxX - maxX)) { |
|
|||
61 | // m_minX = minX; |
|
|||
62 | // m_maxX = maxX; |
|
|||
63 | // axisXChanged = true; |
|
|||
64 | // emit rangeHorizontalChanged(m_minX, m_maxX); |
|
|||
65 | // } |
|
|||
66 |
|
||||
67 | // if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) { |
|
|||
68 | // m_minY = minY; |
|
|||
69 | // m_maxY = maxY; |
|
|||
70 | // axisYChanged = true; |
|
|||
71 | // emit rangeVerticalChanged(m_minY, m_maxY); |
|
|||
72 | // } |
|
|||
73 |
|
||||
74 | // if (axisXChanged || axisYChanged) |
|
|||
75 | // emit updated(); |
|
|||
76 | //} |
|
|||
77 |
|
||||
78 | void AbstractDomain::setRangeX(qreal min, qreal max) |
|
55 | void AbstractDomain::setRangeX(qreal min, qreal max) | |
79 | { |
|
56 | { | |
80 | setRange(min, max, m_minY, m_maxY); |
|
57 | setRange(min, max, m_minY, m_maxY); | |
81 | } |
|
58 | } | |
82 |
|
59 | |||
83 | void AbstractDomain::setRangeY(qreal min, qreal max) |
|
60 | void AbstractDomain::setRangeY(qreal min, qreal max) | |
84 | { |
|
61 | { | |
85 | setRange(m_minX, m_maxX, min, max); |
|
62 | setRange(m_minX, m_maxX, min, max); | |
86 | } |
|
63 | } | |
87 |
|
64 | |||
88 | void AbstractDomain::setMinX(qreal min) |
|
65 | void AbstractDomain::setMinX(qreal min) | |
89 | { |
|
66 | { | |
90 | setRange(min, m_maxX, m_minY, m_maxY); |
|
67 | setRange(min, m_maxX, m_minY, m_maxY); | |
91 | } |
|
68 | } | |
92 |
|
69 | |||
93 | void AbstractDomain::setMaxX(qreal max) |
|
70 | void AbstractDomain::setMaxX(qreal max) | |
94 | { |
|
71 | { | |
95 | setRange(m_minX, max, m_minY, m_maxY); |
|
72 | setRange(m_minX, max, m_minY, m_maxY); | |
96 | } |
|
73 | } | |
97 |
|
74 | |||
98 | void AbstractDomain::setMinY(qreal min) |
|
75 | void AbstractDomain::setMinY(qreal min) | |
99 | { |
|
76 | { | |
100 | setRange(m_minX, m_maxX, min, m_maxY); |
|
77 | setRange(m_minX, m_maxX, min, m_maxY); | |
101 | } |
|
78 | } | |
102 |
|
79 | |||
103 | void AbstractDomain::setMaxY(qreal max) |
|
80 | void AbstractDomain::setMaxY(qreal max) | |
104 | { |
|
81 | { | |
105 | setRange(m_minX, m_maxX, m_minY, max); |
|
82 | setRange(m_minX, m_maxX, m_minY, max); | |
106 | } |
|
83 | } | |
107 |
|
84 | |||
108 | qreal AbstractDomain::spanX() const |
|
85 | qreal AbstractDomain::spanX() const | |
109 | { |
|
86 | { | |
110 | Q_ASSERT(m_maxX >= m_minX); |
|
87 | Q_ASSERT(m_maxX >= m_minX); | |
111 | return m_maxX - m_minX; |
|
88 | return m_maxX - m_minX; | |
112 | } |
|
89 | } | |
113 |
|
90 | |||
114 | qreal AbstractDomain::spanY() const |
|
91 | qreal AbstractDomain::spanY() const | |
115 | { |
|
92 | { | |
116 | Q_ASSERT(m_maxY >= m_minY); |
|
93 | Q_ASSERT(m_maxY >= m_minY); | |
117 | return m_maxY - m_minY; |
|
94 | return m_maxY - m_minY; | |
118 | } |
|
95 | } | |
119 |
|
96 | |||
120 | bool AbstractDomain::isEmpty() const |
|
97 | bool AbstractDomain::isEmpty() const | |
121 | { |
|
98 | { | |
122 | return qFuzzyIsNull(spanX()) || qFuzzyIsNull(spanY()) || m_size.isEmpty() ; |
|
99 | return qFuzzyIsNull(spanX()) || qFuzzyIsNull(spanY()) || m_size.isEmpty() ; | |
123 | } |
|
100 | } | |
124 |
|
101 | |||
125 | void AbstractDomain::zoomIn(const QRectF &rect) |
|
|||
126 | { |
|
|||
127 | qreal dx = spanX() / m_size.width(); |
|
|||
128 | qreal dy = spanY() / m_size.height(); |
|
|||
129 |
|
||||
130 | qreal maxX = m_maxX; |
|
|||
131 | qreal minX = m_minX; |
|
|||
132 | qreal minY = m_minY; |
|
|||
133 | qreal maxY = m_maxY; |
|
|||
134 |
|
||||
135 | maxX = minX + dx * rect.right(); |
|
|||
136 | minX = minX + dx * rect.left(); |
|
|||
137 | minY = maxY - dy * rect.bottom(); |
|
|||
138 | maxY = maxY - dy * rect.top(); |
|
|||
139 |
|
||||
140 | setRange(minX, maxX, minY, maxY); |
|
|||
141 | } |
|
|||
142 |
|
||||
143 | void AbstractDomain::zoomOut(const QRectF &rect) |
|
|||
144 | { |
|
|||
145 | qreal dx = spanX() / rect.width(); |
|
|||
146 | qreal dy = spanY() / rect.height(); |
|
|||
147 |
|
||||
148 | qreal maxX = m_maxX; |
|
|||
149 | qreal minX = m_minX; |
|
|||
150 | qreal minY = m_minY; |
|
|||
151 | qreal maxY = m_maxY; |
|
|||
152 |
|
||||
153 | minX = maxX - dx * rect.right(); |
|
|||
154 | maxX = minX + dx * m_size.width(); |
|
|||
155 | maxY = minY + dy * rect.bottom(); |
|
|||
156 | minY = maxY - dy * m_size.height(); |
|
|||
157 |
|
||||
158 | setRange(minX, maxX, minY, maxY); |
|
|||
159 | } |
|
|||
160 |
|
||||
161 | void AbstractDomain::move(qreal dx, qreal dy) |
|
|||
162 | { |
|
|||
163 | qreal x = spanX() / m_size.width(); |
|
|||
164 | qreal y = spanY() / m_size.height(); |
|
|||
165 |
|
||||
166 | qreal maxX = m_maxX; |
|
|||
167 | qreal minX = m_minX; |
|
|||
168 | qreal minY = m_minY; |
|
|||
169 | qreal maxY = m_maxY; |
|
|||
170 |
|
||||
171 | if (dx != 0) { |
|
|||
172 | minX = minX + x * dx; |
|
|||
173 | maxX = maxX + x * dx; |
|
|||
174 | } |
|
|||
175 | if (dy != 0) { |
|
|||
176 | minY = minY + y * dy; |
|
|||
177 | maxY = maxY + y * dy; |
|
|||
178 | } |
|
|||
179 | setRange(minX, maxX, minY, maxY); |
|
|||
180 | } |
|
|||
181 |
|
||||
182 | //QPointF AbstractDomain::calculateGeometryPoint(const QPointF &point) const |
|
|||
183 | //{ |
|
|||
184 | // const qreal deltaX = m_size.width() / (m_maxX - m_minX); |
|
|||
185 | // const qreal deltaY = m_size.height() / (m_maxY - m_minY); |
|
|||
186 | // qreal x = (point.x() - m_minX) * deltaX; |
|
|||
187 | // qreal y = (point.y() - m_minY) * -deltaY + m_size.height(); |
|
|||
188 | // return QPointF(x, y); |
|
|||
189 | //} |
|
|||
190 |
|
||||
191 | //QVector<QPointF> AbstractDomain::calculateGeometryPoints(const QList<QPointF>& vector) const |
|
|||
192 | //{ |
|
|||
193 | // const qreal deltaX = m_size.width() / (m_maxX - m_minX); |
|
|||
194 | // const qreal deltaY = m_size.height() / (m_maxY - m_minY); |
|
|||
195 |
|
||||
196 | // QVector<QPointF> result; |
|
|||
197 | // result.resize(vector.count()); |
|
|||
198 |
|
||||
199 | // for (int i = 0; i < vector.count(); ++i) { |
|
|||
200 | // qreal x = (vector[i].x() - m_minX) * deltaX; |
|
|||
201 | // qreal y = (vector[i].y() - m_minY) * -deltaY + m_size.height(); |
|
|||
202 | // result[i].setX(x); |
|
|||
203 | // result[i].setY(y); |
|
|||
204 | // } |
|
|||
205 | // return result; |
|
|||
206 | //} |
|
|||
207 |
|
||||
208 | QPointF AbstractDomain::calculateDomainPoint(const QPointF &point) const |
|
102 | QPointF AbstractDomain::calculateDomainPoint(const QPointF &point) const | |
209 | { |
|
103 | { | |
210 | const qreal deltaX = m_size.width() / (m_maxX - m_minX); |
|
104 | const qreal deltaX = m_size.width() / (m_maxX - m_minX); | |
211 | const qreal deltaY = m_size.height() / (m_maxY - m_minY); |
|
105 | const qreal deltaY = m_size.height() / (m_maxY - m_minY); | |
212 | qreal x = point.x() / deltaX + m_minX; |
|
106 | qreal x = point.x() / deltaX + m_minX; | |
213 | qreal y = (point.y() - m_size.height()) / (-deltaY) + m_minY; |
|
107 | qreal y = (point.y() - m_size.height()) / (-deltaY) + m_minY; | |
214 | return QPointF(x, y); |
|
108 | return QPointF(x, y); | |
215 | } |
|
109 | } | |
216 |
|
110 | |||
217 | // handlers |
|
111 | // handlers | |
218 |
|
112 | |||
219 | void AbstractDomain::handleVerticalAxisRangeChanged(qreal min, qreal max) |
|
113 | void AbstractDomain::handleVerticalAxisRangeChanged(qreal min, qreal max) | |
220 | { |
|
114 | { | |
221 | if(!m_axisSignalsBlocked) |
|
115 | if(!m_axisSignalsBlocked) | |
222 | setRangeY(min, max); |
|
116 | setRangeY(min, max); | |
223 | } |
|
117 | } | |
224 |
|
118 | |||
225 | void AbstractDomain::handleHorizontalAxisRangeChanged(qreal min, qreal max) |
|
119 | void AbstractDomain::handleHorizontalAxisRangeChanged(qreal min, qreal max) | |
226 | { |
|
120 | { | |
227 | if(!m_axisSignalsBlocked) |
|
121 | if(!m_axisSignalsBlocked) | |
228 | setRangeX(min, max); |
|
122 | setRangeX(min, max); | |
229 | } |
|
123 | } | |
230 |
|
124 | |||
231 | void AbstractDomain::blockAxisSignals(bool block) |
|
125 | void AbstractDomain::blockAxisSignals(bool block) | |
232 | { |
|
126 | { | |
233 | m_axisSignalsBlocked=block; |
|
127 | m_axisSignalsBlocked=block; | |
234 | } |
|
128 | } | |
235 |
|
129 | |||
236 | //algorithm defined by Paul S.Heckbert GraphicalGems I |
|
130 | //algorithm defined by Paul S.Heckbert GraphicalGems I | |
237 |
|
131 | |||
238 | void AbstractDomain::looseNiceNumbers(qreal &min, qreal &max, int &ticksCount) |
|
132 | void AbstractDomain::looseNiceNumbers(qreal &min, qreal &max, int &ticksCount) | |
239 | { |
|
133 | { | |
240 | qreal range = niceNumber(max - min, true); //range with ceiling |
|
134 | qreal range = niceNumber(max - min, true); //range with ceiling | |
241 | qreal step = niceNumber(range / (ticksCount - 1), false); |
|
135 | qreal step = niceNumber(range / (ticksCount - 1), false); | |
242 | min = qFloor(min / step); |
|
136 | min = qFloor(min / step); | |
243 | max = qCeil(max / step); |
|
137 | max = qCeil(max / step); | |
244 | ticksCount = int(max - min) + 1; |
|
138 | ticksCount = int(max - min) + 1; | |
245 | min *= step; |
|
139 | min *= step; | |
246 | max *= step; |
|
140 | max *= step; | |
247 | } |
|
141 | } | |
248 |
|
142 | |||
249 | //nice numbers can be expressed as form of 1*10^n, 2* 10^n or 5*10^n |
|
143 | //nice numbers can be expressed as form of 1*10^n, 2* 10^n or 5*10^n | |
250 |
|
144 | |||
251 | qreal AbstractDomain::niceNumber(qreal x, bool ceiling) |
|
145 | qreal AbstractDomain::niceNumber(qreal x, bool ceiling) | |
252 | { |
|
146 | { | |
253 | qreal z = qPow(10, qFloor(log10(x))); //find corresponding number of the form of 10^n than is smaller than x |
|
147 | qreal z = qPow(10, qFloor(log10(x))); //find corresponding number of the form of 10^n than is smaller than x | |
254 | qreal q = x / z; //q<10 && q>=1; |
|
148 | qreal q = x / z; //q<10 && q>=1; | |
255 |
|
149 | |||
256 | if (ceiling) { |
|
150 | if (ceiling) { | |
257 | if (q <= 1.0) q = 1; |
|
151 | if (q <= 1.0) q = 1; | |
258 | else if (q <= 2.0) q = 2; |
|
152 | else if (q <= 2.0) q = 2; | |
259 | else if (q <= 5.0) q = 5; |
|
153 | else if (q <= 5.0) q = 5; | |
260 | else q = 10; |
|
154 | else q = 10; | |
261 | } else { |
|
155 | } else { | |
262 | if (q < 1.5) q = 1; |
|
156 | if (q < 1.5) q = 1; | |
263 | else if (q < 3.0) q = 2; |
|
157 | else if (q < 3.0) q = 2; | |
264 | else if (q < 7.0) q = 5; |
|
158 | else if (q < 7.0) q = 5; | |
265 | else q = 10; |
|
159 | else q = 10; | |
266 | } |
|
160 | } | |
267 | return q * z; |
|
161 | return q * z; | |
268 | } |
|
162 | } | |
269 |
|
163 | |||
270 |
|
164 | |||
271 | // operators |
|
165 | // operators | |
272 |
|
166 | |||
273 | bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const AbstractDomain &domain1, const AbstractDomain &domain2) |
|
167 | bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const AbstractDomain &domain1, const AbstractDomain &domain2) | |
274 | { |
|
168 | { | |
275 | return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX) && |
|
169 | return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX) && | |
276 | qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY) && |
|
170 | qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY) && | |
277 | qFuzzyIsNull(domain1.m_minX - domain2.m_minX) && |
|
171 | qFuzzyIsNull(domain1.m_minX - domain2.m_minX) && | |
278 | qFuzzyIsNull(domain1.m_minY - domain2.m_minY)); |
|
172 | qFuzzyIsNull(domain1.m_minY - domain2.m_minY)); | |
279 | } |
|
173 | } | |
280 |
|
174 | |||
281 |
|
175 | |||
282 | bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const AbstractDomain &domain1, const AbstractDomain &domain2) |
|
176 | bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const AbstractDomain &domain1, const AbstractDomain &domain2) | |
283 | { |
|
177 | { | |
284 | return !(domain1 == domain2); |
|
178 | return !(domain1 == domain2); | |
285 | } |
|
179 | } | |
286 |
|
180 | |||
287 |
|
181 | |||
288 | QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const AbstractDomain &domain) |
|
182 | QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const AbstractDomain &domain) | |
289 | { |
|
183 | { | |
290 | dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size; |
|
184 | dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size; | |
291 | return dbg.maybeSpace(); |
|
185 | return dbg.maybeSpace(); | |
292 | } |
|
186 | } | |
293 |
|
187 | |||
294 | #include "moc_abstractdomain_p.cpp" |
|
188 | #include "moc_abstractdomain_p.cpp" | |
295 |
|
189 | |||
296 | QTCOMMERCIALCHART_END_NAMESPACE |
|
190 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,106 +1,106 | |||||
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 | // W A R N I N G |
|
21 | // W A R N I N G | |
22 | // ------------- |
|
22 | // ------------- | |
23 | // |
|
23 | // | |
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
25 | // implementation detail. This header file may change from version to |
|
25 | // implementation detail. This header file may change from version to | |
26 | // version without notice, or even be removed. |
|
26 | // version without notice, or even be removed. | |
27 | // |
|
27 | // | |
28 | // We mean it. |
|
28 | // We mean it. | |
29 |
|
29 | |||
30 | #ifndef ABSTRACTDOMAIN_H |
|
30 | #ifndef ABSTRACTDOMAIN_H | |
31 | #define ABSTRACTDOMAIN_H |
|
31 | #define ABSTRACTDOMAIN_H | |
32 | #include "qchartglobal.h" |
|
32 | #include "qchartglobal.h" | |
33 | #include <QRectF> |
|
33 | #include <QRectF> | |
34 | #include <QSizeF> |
|
34 | #include <QSizeF> | |
35 | #include <QDebug> |
|
35 | #include <QDebug> | |
36 |
|
36 | |||
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
38 |
|
38 | |||
39 | class QTCOMMERCIALCHART_AUTOTEST_EXPORT AbstractDomain: public QObject |
|
39 | class QTCOMMERCIALCHART_AUTOTEST_EXPORT AbstractDomain: public QObject | |
40 | { |
|
40 | { | |
41 | Q_OBJECT |
|
41 | Q_OBJECT | |
42 | public: |
|
42 | public: | |
43 | explicit AbstractDomain(QObject *object = 0); |
|
43 | explicit AbstractDomain(QObject *object = 0); | |
44 | virtual ~AbstractDomain(); |
|
44 | virtual ~AbstractDomain(); | |
45 |
|
45 | |||
46 | void setSize(const QSizeF& size); |
|
46 | void setSize(const QSizeF& size); | |
47 | QSizeF size() const; |
|
47 | QSizeF size() const; | |
48 |
|
48 | |||
49 | virtual void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) = 0; |
|
49 | virtual void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) = 0; | |
50 | void setRangeX(qreal min, qreal max); |
|
50 | void setRangeX(qreal min, qreal max); | |
51 | void setRangeY(qreal min, qreal max); |
|
51 | void setRangeY(qreal min, qreal max); | |
52 | void setMinX(qreal min); |
|
52 | void setMinX(qreal min); | |
53 | void setMaxX(qreal max); |
|
53 | void setMaxX(qreal max); | |
54 | void setMinY(qreal min); |
|
54 | void setMinY(qreal min); | |
55 | void setMaxY(qreal max); |
|
55 | void setMaxY(qreal max); | |
56 |
|
56 | |||
57 | qreal minX() const { return m_minX; } |
|
57 | qreal minX() const { return m_minX; } | |
58 | qreal maxX() const { return m_maxX; } |
|
58 | qreal maxX() const { return m_maxX; } | |
59 | qreal minY() const { return m_minY; } |
|
59 | qreal minY() const { return m_minY; } | |
60 | qreal maxY() const { return m_maxY; } |
|
60 | qreal maxY() const { return m_maxY; } | |
61 |
|
61 | |||
62 | qreal spanX() const; |
|
62 | qreal spanX() const; | |
63 | qreal spanY() const; |
|
63 | qreal spanY() const; | |
64 | bool isEmpty() const; |
|
64 | bool isEmpty() const; | |
65 |
|
65 | |||
66 |
|
66 | |||
67 | void blockAxisSignals(bool block); |
|
67 | void blockAxisSignals(bool block); | |
68 | bool axisSignalsBlocked() const { return m_axisSignalsBlocked; } |
|
68 | bool axisSignalsBlocked() const { return m_axisSignalsBlocked; } | |
69 |
|
69 | |||
70 |
|
70 | |||
71 | friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const AbstractDomain &domain1, const AbstractDomain &domain2); |
|
71 | friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const AbstractDomain &domain1, const AbstractDomain &domain2); | |
72 | friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const AbstractDomain &domain1, const AbstractDomain &domain2); |
|
72 | friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const AbstractDomain &domain1, const AbstractDomain &domain2); | |
73 | friend QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const AbstractDomain &domain); |
|
73 | friend QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const AbstractDomain &domain); | |
74 |
|
74 | |||
75 | void zoomIn(const QRectF &rect); |
|
75 | virtual void zoomIn(const QRectF &rect) = 0; | |
76 | void zoomOut(const QRectF &rect); |
|
76 | virtual void zoomOut(const QRectF &rect) = 0; | |
77 | void move(qreal dx, qreal dy); |
|
77 | virtual void move(qreal dx, qreal dy) = 0; | |
78 |
|
78 | |||
79 | virtual QPointF calculateGeometryPoint(const QPointF &point) const = 0; |
|
79 | virtual QPointF calculateGeometryPoint(const QPointF &point) const = 0; | |
80 | virtual QPointF calculateDomainPoint(const QPointF &point) const = 0; |
|
80 | virtual QPointF calculateDomainPoint(const QPointF &point) const = 0; | |
81 | virtual QVector<QPointF> calculateGeometryPoints(const QList<QPointF>& vector) const = 0; |
|
81 | virtual QVector<QPointF> calculateGeometryPoints(const QList<QPointF>& vector) const = 0; | |
82 |
|
82 | |||
83 | static void looseNiceNumbers(qreal &min, qreal &max, int &ticksCount); |
|
83 | static void looseNiceNumbers(qreal &min, qreal &max, int &ticksCount); | |
84 | static qreal niceNumber(qreal x, bool ceiling); |
|
84 | static qreal niceNumber(qreal x, bool ceiling); | |
85 |
|
85 | |||
86 | Q_SIGNALS: |
|
86 | Q_SIGNALS: | |
87 | void updated(); |
|
87 | void updated(); | |
88 | void rangeHorizontalChanged(qreal min, qreal max); |
|
88 | void rangeHorizontalChanged(qreal min, qreal max); | |
89 | void rangeVerticalChanged(qreal min, qreal max); |
|
89 | void rangeVerticalChanged(qreal min, qreal max); | |
90 |
|
90 | |||
91 | public Q_SLOTS: |
|
91 | public Q_SLOTS: | |
92 | void handleVerticalAxisRangeChanged(qreal min,qreal max); |
|
92 | void handleVerticalAxisRangeChanged(qreal min,qreal max); | |
93 | void handleHorizontalAxisRangeChanged(qreal min,qreal max); |
|
93 | void handleHorizontalAxisRangeChanged(qreal min,qreal max); | |
94 |
|
94 | |||
95 | protected: |
|
95 | protected: | |
96 | qreal m_minX; |
|
96 | qreal m_minX; | |
97 | qreal m_maxX; |
|
97 | qreal m_maxX; | |
98 | qreal m_minY; |
|
98 | qreal m_minY; | |
99 | qreal m_maxY; |
|
99 | qreal m_maxY; | |
100 | QSizeF m_size; |
|
100 | QSizeF m_size; | |
101 | bool m_axisSignalsBlocked; |
|
101 | bool m_axisSignalsBlocked; | |
102 | }; |
|
102 | }; | |
103 |
|
103 | |||
104 | QTCOMMERCIALCHART_END_NAMESPACE |
|
104 | QTCOMMERCIALCHART_END_NAMESPACE | |
105 |
|
105 | |||
106 | #endif // ABSTRACTDOMAIN_H |
|
106 | #endif // ABSTRACTDOMAIN_H |
@@ -1,190 +1,178 | |||||
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 "logxlogydomain_p.h" |
|
21 | #include "logxlogydomain_p.h" | |
22 | #include "qabstractaxis_p.h" |
|
22 | #include "qabstractaxis_p.h" | |
23 | #include <qmath.h> |
|
23 | #include <qmath.h> | |
24 |
|
24 | |||
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
26 |
|
26 | |||
27 | LogXLogYDomain::LogXLogYDomain(QObject *parent) |
|
27 | LogXLogYDomain::LogXLogYDomain(QObject *parent) | |
28 | : AbstractDomain(parent), |
|
28 | : AbstractDomain(parent), | |
29 | m_logMinX(0), |
|
29 | m_logMinX(0), | |
30 | m_logMaxX(1), |
|
30 | m_logMaxX(1), | |
31 | m_logBaseX(10), |
|
31 | m_logBaseX(10), | |
32 | m_logMinY(0), |
|
32 | m_logMinY(0), | |
33 | m_logMaxY(1), |
|
33 | m_logMaxY(1), | |
34 | m_logBaseY(10) |
|
34 | m_logBaseY(10) | |
35 | { |
|
35 | { | |
36 | } |
|
36 | } | |
37 |
|
37 | |||
38 | LogXLogYDomain::~LogXLogYDomain() |
|
38 | LogXLogYDomain::~LogXLogYDomain() | |
39 | { |
|
39 | { | |
40 | } |
|
40 | } | |
41 |
|
41 | |||
42 | void LogXLogYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) |
|
42 | void LogXLogYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) | |
43 | { |
|
43 | { | |
44 | bool axisXChanged = false; |
|
44 | bool axisXChanged = false; | |
45 | bool axisYChanged = false; |
|
45 | bool axisYChanged = false; | |
46 |
|
46 | |||
47 | if (!qFuzzyIsNull(m_minX - minX) || !qFuzzyIsNull(m_maxX - maxX)) { |
|
47 | if (!qFuzzyIsNull(m_minX - minX) || !qFuzzyIsNull(m_maxX - maxX)) { | |
48 | m_minX = minX; |
|
48 | m_minX = minX; | |
49 | m_maxX = maxX; |
|
49 | m_maxX = maxX; | |
50 | axisXChanged = true; |
|
50 | axisXChanged = true; | |
51 | m_logMinX = log10(m_minX) / log10(m_logBaseX); |
|
51 | m_logMinX = log10(m_minX) / log10(m_logBaseX); | |
52 | m_logMaxX = log10(m_maxX) / log10(m_logBaseX); |
|
52 | m_logMaxX = log10(m_maxX) / log10(m_logBaseX); | |
53 | emit rangeHorizontalChanged(m_minX, m_maxX); |
|
53 | emit rangeHorizontalChanged(m_minX, m_maxX); | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
56 | if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) { |
|
56 | if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) { | |
57 | m_minY = minY; |
|
57 | m_minY = minY; | |
58 | m_maxY = maxY; |
|
58 | m_maxY = maxY; | |
59 | axisYChanged = true; |
|
59 | axisYChanged = true; | |
60 | m_logMinY = log10(m_minY) / log10(m_logBaseY); |
|
60 | m_logMinY = log10(m_minY) / log10(m_logBaseY); | |
61 | m_logMaxY = log10(m_maxY) / log10(m_logBaseY); |
|
61 | m_logMaxY = log10(m_maxY) / log10(m_logBaseY); | |
62 | emit rangeVerticalChanged(m_minY, m_maxY); |
|
62 | emit rangeVerticalChanged(m_minY, m_maxY); | |
63 | } |
|
63 | } | |
64 |
|
64 | |||
65 | if (axisXChanged || axisYChanged) |
|
65 | if (axisXChanged || axisYChanged) | |
66 | emit updated(); |
|
66 | emit updated(); | |
67 | } |
|
67 | } | |
68 |
|
68 | |||
69 | void LogXLogYDomain::zoomIn(const QRectF &rect) |
|
69 | void LogXLogYDomain::zoomIn(const QRectF &rect) | |
70 | { |
|
70 | { | |
71 | qreal dx = spanX() / m_size.width(); |
|
71 | qreal newLogMinX = rect.left() * (m_logMaxX - m_logMinX) / m_size.width() + m_logMinX; | |
72 | qreal dy = spanY() / m_size.height(); |
|
72 | qreal newLogMaxX = rect.right() * (m_logMaxX - m_logMinX) / m_size.width() + m_logMinX; | |
|
73 | qreal minX = qPow(m_logBaseX, newLogMinX); | |||
|
74 | qreal maxX = qPow(m_logBaseX, newLogMaxX); | |||
73 |
|
75 | |||
74 | qreal maxX = m_maxX; |
|
76 | qreal newLogMinY = m_logMaxY - rect.bottom() * (m_logMaxY - m_logMinY) / m_size.height(); | |
75 | qreal minX = m_minX; |
|
77 | qreal newLogMaxY = m_logMaxY - rect.top() * (m_logMaxY - m_logMinY) / m_size.height(); | |
76 |
qreal minY = |
|
78 | qreal minY = qPow(m_logBaseY, newLogMinY); | |
77 |
qreal maxY = |
|
79 | qreal maxY = qPow(m_logBaseY, newLogMaxY); | |
78 |
|
||||
79 | maxX = minX + dx * rect.right(); |
|
|||
80 | minX = minX + dx * rect.left(); |
|
|||
81 | minY = maxY - dy * rect.bottom(); |
|
|||
82 | maxY = maxY - dy * rect.top(); |
|
|||
83 |
|
80 | |||
84 | setRange(minX, maxX, minY, maxY); |
|
81 | setRange(minX, maxX, minY, maxY); | |
85 | } |
|
82 | } | |
86 |
|
83 | |||
87 | void LogXLogYDomain::zoomOut(const QRectF &rect) |
|
84 | void LogXLogYDomain::zoomOut(const QRectF &rect) | |
88 | { |
|
85 | { | |
89 |
qreal |
|
86 | qreal ratioX = m_size.width()/rect.width(); | |
90 | qreal dy = spanY() / rect.height(); |
|
87 | qreal newLogMinX = m_logMinX - (m_logMaxX - m_logMinX) / ratioX; | |
91 |
|
88 | qreal newLogMaxX = m_logMaxX + (m_logMaxX - m_logMinX) / ratioX; | ||
92 | qreal maxX = m_maxX; |
|
89 | qreal minX = qPow(m_logBaseX, newLogMinX); | |
93 | qreal minX = m_minX; |
|
90 | qreal maxX = qPow(m_logBaseX, newLogMaxX); | |
94 | qreal minY = m_minY; |
|
91 | ||
95 | qreal maxY = m_maxY; |
|
92 | qreal ratioY = m_size.height()/rect.height(); | |
96 |
|
93 | qreal newLogMinY = m_logMaxY - (m_logMaxY - m_logMinY) / ratioY; | ||
97 | minX = maxX - dx * rect.right(); |
|
94 | qreal newLogMaxY = m_logMaxY + (m_logMaxY - m_logMinY) / ratioY; | |
98 | maxX = minX + dx * m_size.width(); |
|
95 | qreal minY = qPow(m_logBaseY, newLogMinY); | |
99 | maxY = minY + dy * rect.bottom(); |
|
96 | qreal maxY = qPow(m_logBaseY, newLogMaxY); | |
100 | minY = maxY - dy * m_size.height(); |
|
|||
101 |
|
97 | |||
102 | setRange(minX, maxX, minY, maxY); |
|
98 | setRange(minX, maxX, minY, maxY); | |
103 | } |
|
99 | } | |
104 |
|
100 | |||
105 | void LogXLogYDomain::move(qreal dx, qreal dy) |
|
101 | void LogXLogYDomain::move(qreal dx, qreal dy) | |
106 | { |
|
102 | { | |
107 |
qreal |
|
103 | qreal stepX = dx * qAbs(m_logMaxX - m_logMinX) / m_size.width(); | |
108 | qreal y = spanY() / m_size.height(); |
|
104 | qreal minX = qPow(m_logBaseX, m_logMinX + stepX); | |
|
105 | qreal maxX = qPow(m_logBaseX, m_logMaxX + stepX); | |||
109 |
|
106 | |||
110 | qreal maxX = m_maxX; |
|
107 | qreal stepY = dy * qAbs(m_logMaxY - m_logMinY) / m_size.height(); | |
111 | qreal minX = m_minX; |
|
108 | qreal minY = qPow(m_logBaseY, m_logMinY + stepY); | |
112 | qreal minY = m_minY; |
|
109 | qreal maxY = qPow(m_logBaseY, m_logMaxY + stepY); | |
113 | qreal maxY = m_maxY; |
|
|||
114 |
|
110 | |||
115 | if (dx != 0) { |
|
|||
116 | minX = minX + x * dx; |
|
|||
117 | maxX = maxX + x * dx; |
|
|||
118 | } |
|
|||
119 | if (dy != 0) { |
|
|||
120 | minY = minY + y * dy; |
|
|||
121 | maxY = maxY + y * dy; |
|
|||
122 | } |
|
|||
123 | setRange(minX, maxX, minY, maxY); |
|
111 | setRange(minX, maxX, minY, maxY); | |
124 | } |
|
112 | } | |
125 |
|
113 | |||
126 | QPointF LogXLogYDomain::calculateGeometryPoint(const QPointF &point) const |
|
114 | QPointF LogXLogYDomain::calculateGeometryPoint(const QPointF &point) const | |
127 | { |
|
115 | { | |
128 | const qreal leftEdgeX= m_logMinX < m_logMaxX ? m_logMinX : m_logMaxX; |
|
116 | const qreal leftEdgeX= m_logMinX < m_logMaxX ? m_logMinX : m_logMaxX; | |
129 | const qreal leftEdgeY = m_logMinY < m_logMaxY ? m_logMinY : m_logMaxY; |
|
117 | const qreal leftEdgeY = m_logMinY < m_logMaxY ? m_logMinY : m_logMaxY; | |
130 | const qreal deltaX = m_size.width() / qAbs(m_logMaxX - m_logMinX); |
|
118 | const qreal deltaX = m_size.width() / qAbs(m_logMaxX - m_logMinX); | |
131 | const qreal deltaY = m_size.height() / qAbs(m_logMaxY - m_logMinY); |
|
119 | const qreal deltaY = m_size.height() / qAbs(m_logMaxY - m_logMinY); | |
132 | qreal x = (log10(point.x()) / log10(m_logBaseX)) * deltaX - leftEdgeX * deltaX; |
|
120 | qreal x = (log10(point.x()) / log10(m_logBaseX)) * deltaX - leftEdgeX * deltaX; | |
133 | qreal y = (log10(point.y()) / log10(m_logBaseY)) * -deltaY - leftEdgeY * -deltaY + m_size.height(); |
|
121 | qreal y = (log10(point.y()) / log10(m_logBaseY)) * -deltaY - leftEdgeY * -deltaY + m_size.height(); | |
134 | return QPointF(x, y); |
|
122 | return QPointF(x, y); | |
135 | } |
|
123 | } | |
136 |
|
124 | |||
137 | QVector<QPointF> LogXLogYDomain::calculateGeometryPoints(const QList<QPointF>& vector) const |
|
125 | QVector<QPointF> LogXLogYDomain::calculateGeometryPoints(const QList<QPointF>& vector) const | |
138 | { |
|
126 | { | |
139 | const qreal leftEdgeX= m_logMinX < m_logMaxX ? m_logMinX : m_logMaxX; |
|
127 | const qreal leftEdgeX= m_logMinX < m_logMaxX ? m_logMinX : m_logMaxX; | |
140 | const qreal leftEdgeY = m_logMinY < m_logMaxY ? m_logMinY : m_logMaxY; |
|
128 | const qreal leftEdgeY = m_logMinY < m_logMaxY ? m_logMinY : m_logMaxY; | |
141 | const qreal deltaX = m_size.width() / qAbs(m_logMaxX - m_logMinX); |
|
129 | const qreal deltaX = m_size.width() / qAbs(m_logMaxX - m_logMinX); | |
142 | const qreal deltaY = m_size.height() / qAbs(m_logMaxY - m_logMinY); |
|
130 | const qreal deltaY = m_size.height() / qAbs(m_logMaxY - m_logMinY); | |
143 |
|
131 | |||
144 | QVector<QPointF> result; |
|
132 | QVector<QPointF> result; | |
145 | result.resize(vector.count()); |
|
133 | result.resize(vector.count()); | |
146 |
|
134 | |||
147 | for (int i = 0; i < vector.count(); ++i) { |
|
135 | for (int i = 0; i < vector.count(); ++i) { | |
148 | qreal x = (log10(vector[i].x()) / log10(m_logBaseX)) * deltaX - leftEdgeX * deltaX; |
|
136 | qreal x = (log10(vector[i].x()) / log10(m_logBaseX)) * deltaX - leftEdgeX * deltaX; | |
149 | qreal y = (log10(vector[i].y()) / log10(m_logBaseY)) * -deltaY - leftEdgeY * -deltaY + m_size.height(); |
|
137 | qreal y = (log10(vector[i].y()) / log10(m_logBaseY)) * -deltaY - leftEdgeY * -deltaY + m_size.height(); | |
150 | result[i].setX(x); |
|
138 | result[i].setX(x); | |
151 | result[i].setY(y); |
|
139 | result[i].setY(y); | |
152 | } |
|
140 | } | |
153 | return result; |
|
141 | return result; | |
154 | } |
|
142 | } | |
155 |
|
143 | |||
156 | QPointF LogXLogYDomain::calculateDomainPoint(const QPointF &point) const |
|
144 | QPointF LogXLogYDomain::calculateDomainPoint(const QPointF &point) const | |
157 | { |
|
145 | { | |
158 | const qreal deltaX = m_size.width() / (m_maxX - m_minX); |
|
146 | const qreal deltaX = m_size.width() / (m_maxX - m_minX); | |
159 | const qreal deltaY = m_size.height() / (m_maxY - m_minY); |
|
147 | const qreal deltaY = m_size.height() / (m_maxY - m_minY); | |
160 | qreal x = point.x() / deltaX + m_minX; |
|
148 | qreal x = point.x() / deltaX + m_minX; | |
161 | qreal y = (point.y() - m_size.height()) / (-deltaY) + m_minY; |
|
149 | qreal y = (point.y() - m_size.height()) / (-deltaY) + m_minY; | |
162 | return QPointF(x, y); |
|
150 | return QPointF(x, y); | |
163 | } |
|
151 | } | |
164 |
|
152 | |||
165 | // operators |
|
153 | // operators | |
166 |
|
154 | |||
167 | bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2) |
|
155 | bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2) | |
168 | { |
|
156 | { | |
169 | return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX) && |
|
157 | return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX) && | |
170 | qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY) && |
|
158 | qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY) && | |
171 | qFuzzyIsNull(domain1.m_minX - domain2.m_minX) && |
|
159 | qFuzzyIsNull(domain1.m_minX - domain2.m_minX) && | |
172 | qFuzzyIsNull(domain1.m_minY - domain2.m_minY)); |
|
160 | qFuzzyIsNull(domain1.m_minY - domain2.m_minY)); | |
173 | } |
|
161 | } | |
174 |
|
162 | |||
175 |
|
163 | |||
176 | bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2) |
|
164 | bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2) | |
177 | { |
|
165 | { | |
178 | return !(domain1 == domain2); |
|
166 | return !(domain1 == domain2); | |
179 | } |
|
167 | } | |
180 |
|
168 | |||
181 |
|
169 | |||
182 | QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXLogYDomain &domain) |
|
170 | QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXLogYDomain &domain) | |
183 | { |
|
171 | { | |
184 | dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size; |
|
172 | dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size; | |
185 | return dbg.maybeSpace(); |
|
173 | return dbg.maybeSpace(); | |
186 | } |
|
174 | } | |
187 |
|
175 | |||
188 | #include "moc_logxlogydomain_p.cpp" |
|
176 | #include "moc_logxlogydomain_p.cpp" | |
189 |
|
177 | |||
190 | QTCOMMERCIALCHART_END_NAMESPACE |
|
178 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,185 +1,180 | |||||
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 "logxydomain_p.h" |
|
21 | #include "logxydomain_p.h" | |
22 | #include "qabstractaxis_p.h" |
|
22 | #include "qabstractaxis_p.h" | |
23 | #include <qmath.h> |
|
23 | #include <qmath.h> | |
24 |
|
24 | |||
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
26 |
|
26 | |||
27 | LogXYDomain::LogXYDomain(QObject *parent) |
|
27 | LogXYDomain::LogXYDomain(QObject *parent) | |
28 | : AbstractDomain(parent), |
|
28 | : AbstractDomain(parent), | |
29 | m_logMinX(0), |
|
29 | m_logMinX(0), | |
30 | m_logMaxX(1), |
|
30 | m_logMaxX(1), | |
31 | m_logBaseX(10) |
|
31 | m_logBaseX(10) | |
32 | { |
|
32 | { | |
33 | } |
|
33 | } | |
34 |
|
34 | |||
35 | LogXYDomain::~LogXYDomain() |
|
35 | LogXYDomain::~LogXYDomain() | |
36 | { |
|
36 | { | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | void LogXYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) |
|
39 | void LogXYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) | |
40 | { |
|
40 | { | |
41 | bool axisXChanged = false; |
|
41 | bool axisXChanged = false; | |
42 | bool axisYChanged = false; |
|
42 | bool axisYChanged = false; | |
43 |
|
43 | |||
44 | if (!qFuzzyCompare(m_minX, minX) || !qFuzzyCompare(m_maxX, maxX)) { |
|
44 | if (!qFuzzyCompare(m_minX, minX) || !qFuzzyCompare(m_maxX, maxX)) { | |
45 | m_minX = minX; |
|
45 | m_minX = minX; | |
46 | m_maxX = maxX; |
|
46 | m_maxX = maxX; | |
47 | axisXChanged = true; |
|
47 | axisXChanged = true; | |
48 | m_logMinX = log10(m_minX) / log10(m_logBaseX); |
|
48 | m_logMinX = log10(m_minX) / log10(m_logBaseX); | |
49 | m_logMaxX = log10(m_maxX) / log10(m_logBaseX); |
|
49 | m_logMaxX = log10(m_maxX) / log10(m_logBaseX); | |
50 |
|
50 | |||
51 | emit rangeHorizontalChanged(m_minX, m_maxX); |
|
51 | emit rangeHorizontalChanged(m_minX, m_maxX); | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 | if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) { |
|
54 | if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) { | |
55 | m_minY = minY; |
|
55 | m_minY = minY; | |
56 | m_maxY = maxY; |
|
56 | m_maxY = maxY; | |
57 | axisYChanged = true; |
|
57 | axisYChanged = true; | |
58 | emit rangeVerticalChanged(m_minY, m_maxY); |
|
58 | emit rangeVerticalChanged(m_minY, m_maxY); | |
59 | } |
|
59 | } | |
60 |
|
60 | |||
61 | if (axisXChanged || axisYChanged) |
|
61 | if (axisXChanged || axisYChanged) | |
62 | emit updated(); |
|
62 | emit updated(); | |
63 | } |
|
63 | } | |
64 |
|
64 | |||
65 | void LogXYDomain::zoomIn(const QRectF &rect) |
|
65 | void LogXYDomain::zoomIn(const QRectF &rect) | |
66 | { |
|
66 | { | |
67 | qreal dx = spanX() / m_size.width(); |
|
67 | qreal newLogMinX = rect.left() * (m_logMaxX - m_logMinX) / m_size.width() + m_logMinX; | |
68 | qreal dy = spanY() / m_size.height(); |
|
68 | qreal newLogMaxX = rect.right() * (m_logMaxX - m_logMinX) / m_size.width() + m_logMinX; | |
|
69 | qreal minX = qPow(m_logBaseX, newLogMinX); | |||
|
70 | qreal maxX = qPow(m_logBaseX, newLogMaxX); | |||
69 |
|
71 | |||
70 | qreal maxX = m_maxX; |
|
72 | qreal dy = spanY() / m_size.height(); | |
71 | qreal minX = m_minX; |
|
|||
72 | qreal minY = m_minY; |
|
73 | qreal minY = m_minY; | |
73 | qreal maxY = m_maxY; |
|
74 | qreal maxY = m_maxY; | |
74 |
|
75 | |||
75 | maxX = minX + dx * rect.right(); |
|
|||
76 | minX = minX + dx * rect.left(); |
|
|||
77 | minY = maxY - dy * rect.bottom(); |
|
76 | minY = maxY - dy * rect.bottom(); | |
78 | maxY = maxY - dy * rect.top(); |
|
77 | maxY = maxY - dy * rect.top(); | |
79 |
|
78 | |||
80 | setRange(minX, maxX, minY, maxY); |
|
79 | setRange(minX, maxX, minY, maxY); | |
81 | } |
|
80 | } | |
82 |
|
81 | |||
83 | void LogXYDomain::zoomOut(const QRectF &rect) |
|
82 | void LogXYDomain::zoomOut(const QRectF &rect) | |
84 | { |
|
83 | { | |
85 |
qreal |
|
84 | qreal ratioX = m_size.width()/rect.width(); | |
86 | qreal dy = spanY() / rect.height(); |
|
85 | qreal newLogMinX = m_logMinX - (m_logMaxX - m_logMinX) / ratioX; | |
|
86 | qreal newLogMaxX = m_logMaxX + (m_logMaxX - m_logMinX) / ratioX; | |||
|
87 | qreal minX = qPow(m_logBaseX, newLogMinX); | |||
|
88 | qreal maxX = qPow(m_logBaseX, newLogMaxX); | |||
87 |
|
89 | |||
88 | qreal maxX = m_maxX; |
|
90 | qreal dy = spanY() / rect.height(); | |
89 | qreal minX = m_minX; |
|
|||
90 | qreal minY = m_minY; |
|
91 | qreal minY = m_minY; | |
91 | qreal maxY = m_maxY; |
|
92 | qreal maxY = m_maxY; | |
92 |
|
93 | |||
93 | minX = maxX - dx * rect.right(); |
|
|||
94 | maxX = minX + dx * m_size.width(); |
|
|||
95 | maxY = minY + dy * rect.bottom(); |
|
94 | maxY = minY + dy * rect.bottom(); | |
96 | minY = maxY - dy * m_size.height(); |
|
95 | minY = maxY - dy * m_size.height(); | |
97 |
|
96 | |||
98 | setRange(minX, maxX, minY, maxY); |
|
97 | setRange(minX, maxX, minY, maxY); | |
99 | } |
|
98 | } | |
100 |
|
99 | |||
101 | void LogXYDomain::move(qreal dx, qreal dy) |
|
100 | void LogXYDomain::move(qreal dx, qreal dy) | |
102 | { |
|
101 | { | |
103 |
qreal |
|
102 | qreal stepX = dx * qAbs(m_logMaxX - m_logMinX) / m_size.width(); | |
104 | qreal y = spanY() / m_size.height(); |
|
103 | qreal minX = qPow(m_logBaseX, m_logMinX + stepX); | |
|
104 | qreal maxX = qPow(m_logBaseX, m_logMaxX + stepX); | |||
105 |
|
105 | |||
106 | qreal maxX = m_maxX; |
|
106 | qreal y = spanY() / m_size.height(); | |
107 | qreal minX = m_minX; |
|
|||
108 | qreal minY = m_minY; |
|
107 | qreal minY = m_minY; | |
109 | qreal maxY = m_maxY; |
|
108 | qreal maxY = m_maxY; | |
110 |
|
109 | |||
111 | if (dx != 0) { |
|
|||
112 | minX = minX + x * dx; |
|
|||
113 | maxX = maxX + x * dx; |
|
|||
114 | } |
|
|||
115 | if (dy != 0) { |
|
110 | if (dy != 0) { | |
116 | minY = minY + y * dy; |
|
111 | minY = minY + y * dy; | |
117 | maxY = maxY + y * dy; |
|
112 | maxY = maxY + y * dy; | |
118 | } |
|
113 | } | |
119 | setRange(minX, maxX, minY, maxY); |
|
114 | setRange(minX, maxX, minY, maxY); | |
120 | } |
|
115 | } | |
121 |
|
116 | |||
122 | QPointF LogXYDomain::calculateGeometryPoint(const QPointF &point) const |
|
117 | QPointF LogXYDomain::calculateGeometryPoint(const QPointF &point) const | |
123 | { |
|
118 | { | |
124 | const qreal leftEdge = m_logMinX < m_logMaxX ? m_logMinX : m_logMaxX; |
|
119 | const qreal leftEdge = m_logMinX < m_logMaxX ? m_logMinX : m_logMaxX; | |
125 | const qreal deltaX = m_size.width() / qAbs(m_logMaxX - m_logMinX); |
|
120 | const qreal deltaX = m_size.width() / qAbs(m_logMaxX - m_logMinX); | |
126 | const qreal deltaY = m_size.height() / (m_maxY - m_minY); |
|
121 | const qreal deltaY = m_size.height() / (m_maxY - m_minY); | |
127 |
|
122 | |||
128 | qreal x = (log10(point.x()) / log10(m_logBaseX)) * deltaX - leftEdge * deltaX; |
|
123 | qreal x = (log10(point.x()) / log10(m_logBaseX)) * deltaX - leftEdge * deltaX; | |
129 | qreal y = (point.y() - m_minY) * -deltaY + m_size.height(); |
|
124 | qreal y = (point.y() - m_minY) * -deltaY + m_size.height(); | |
130 | return QPointF(x, y); |
|
125 | return QPointF(x, y); | |
131 | } |
|
126 | } | |
132 |
|
127 | |||
133 | QVector<QPointF> LogXYDomain::calculateGeometryPoints(const QList<QPointF>& vector) const |
|
128 | QVector<QPointF> LogXYDomain::calculateGeometryPoints(const QList<QPointF>& vector) const | |
134 | { |
|
129 | { | |
135 | const qreal leftEdge = m_logMinX < m_logMaxX ? m_logMinX : m_logMaxX; |
|
130 | const qreal leftEdge = m_logMinX < m_logMaxX ? m_logMinX : m_logMaxX; | |
136 | const qreal deltaX = m_size.width() / qAbs(m_logMaxX - m_logMinX); |
|
131 | const qreal deltaX = m_size.width() / qAbs(m_logMaxX - m_logMinX); | |
137 | const qreal deltaY = m_size.height() / (m_maxY - m_minY); |
|
132 | const qreal deltaY = m_size.height() / (m_maxY - m_minY); | |
138 |
|
133 | |||
139 | QVector<QPointF> result; |
|
134 | QVector<QPointF> result; | |
140 | result.resize(vector.count()); |
|
135 | result.resize(vector.count()); | |
141 |
|
136 | |||
142 | for (int i = 0; i < vector.count(); ++i) { |
|
137 | for (int i = 0; i < vector.count(); ++i) { | |
143 | qreal x = (log10(vector[i].x()) / log10(m_logBaseX)) * deltaX - leftEdge * deltaX; |
|
138 | qreal x = (log10(vector[i].x()) / log10(m_logBaseX)) * deltaX - leftEdge * deltaX; | |
144 | qreal y = (vector[i].y() - m_minY) * -deltaY + m_size.height(); |
|
139 | qreal y = (vector[i].y() - m_minY) * -deltaY + m_size.height(); | |
145 | result[i].setX(x); |
|
140 | result[i].setX(x); | |
146 | result[i].setY(y); |
|
141 | result[i].setY(y); | |
147 | } |
|
142 | } | |
148 | return result; |
|
143 | return result; | |
149 | } |
|
144 | } | |
150 |
|
145 | |||
151 | QPointF LogXYDomain::calculateDomainPoint(const QPointF &point) const |
|
146 | QPointF LogXYDomain::calculateDomainPoint(const QPointF &point) const | |
152 | { |
|
147 | { | |
153 | const qreal deltaX = m_size.width() / (m_maxX - m_minX); |
|
148 | const qreal deltaX = m_size.width() / (m_maxX - m_minX); | |
154 | const qreal deltaY = m_size.height() / (m_maxY - m_minY); |
|
149 | const qreal deltaY = m_size.height() / (m_maxY - m_minY); | |
155 | qreal x = point.x() / deltaX + m_minX; |
|
150 | qreal x = point.x() / deltaX + m_minX; | |
156 | qreal y = (point.y() - m_size.height()) / (-deltaY) + m_minY; |
|
151 | qreal y = (point.y() - m_size.height()) / (-deltaY) + m_minY; | |
157 | return QPointF(x, y); |
|
152 | return QPointF(x, y); | |
158 | } |
|
153 | } | |
159 |
|
154 | |||
160 | // operators |
|
155 | // operators | |
161 |
|
156 | |||
162 | bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const LogXYDomain &domain1, const LogXYDomain &domain2) |
|
157 | bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const LogXYDomain &domain1, const LogXYDomain &domain2) | |
163 | { |
|
158 | { | |
164 | return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX) && |
|
159 | return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX) && | |
165 | qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY) && |
|
160 | qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY) && | |
166 | qFuzzyIsNull(domain1.m_minX - domain2.m_minX) && |
|
161 | qFuzzyIsNull(domain1.m_minX - domain2.m_minX) && | |
167 | qFuzzyIsNull(domain1.m_minY - domain2.m_minY)); |
|
162 | qFuzzyIsNull(domain1.m_minY - domain2.m_minY)); | |
168 | } |
|
163 | } | |
169 |
|
164 | |||
170 |
|
165 | |||
171 | bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const LogXYDomain &domain1, const LogXYDomain &domain2) |
|
166 | bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const LogXYDomain &domain1, const LogXYDomain &domain2) | |
172 | { |
|
167 | { | |
173 | return !(domain1 == domain2); |
|
168 | return !(domain1 == domain2); | |
174 | } |
|
169 | } | |
175 |
|
170 | |||
176 |
|
171 | |||
177 | QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXYDomain &domain) |
|
172 | QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXYDomain &domain) | |
178 | { |
|
173 | { | |
179 | dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size; |
|
174 | dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size; | |
180 | return dbg.maybeSpace(); |
|
175 | return dbg.maybeSpace(); | |
181 | } |
|
176 | } | |
182 |
|
177 | |||
183 | #include "moc_logxydomain_p.cpp" |
|
178 | #include "moc_logxydomain_p.cpp" | |
184 |
|
179 | |||
185 | QTCOMMERCIALCHART_END_NAMESPACE |
|
180 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,184 +1,180 | |||||
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 "xlogydomain_p.h" |
|
21 | #include "xlogydomain_p.h" | |
22 | #include "qabstractaxis_p.h" |
|
22 | #include "qabstractaxis_p.h" | |
23 | #include <qmath.h> |
|
23 | #include <qmath.h> | |
24 |
|
24 | |||
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
26 |
|
26 | |||
27 | XLogYDomain::XLogYDomain(QObject *parent) |
|
27 | XLogYDomain::XLogYDomain(QObject *parent) | |
28 | : AbstractDomain(parent), |
|
28 | : AbstractDomain(parent), | |
29 | m_logMinY(0), |
|
29 | m_logMinY(0), | |
30 | m_logMaxY(1), |
|
30 | m_logMaxY(1), | |
31 | m_logBaseY(10) |
|
31 | m_logBaseY(10) | |
32 | { |
|
32 | { | |
33 | } |
|
33 | } | |
34 |
|
34 | |||
35 | XLogYDomain::~XLogYDomain() |
|
35 | XLogYDomain::~XLogYDomain() | |
36 | { |
|
36 | { | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | void XLogYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) |
|
39 | void XLogYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) | |
40 | { |
|
40 | { | |
41 | bool axisXChanged = false; |
|
41 | bool axisXChanged = false; | |
42 | bool axisYChanged = false; |
|
42 | bool axisYChanged = false; | |
43 |
|
43 | |||
44 | if (!qFuzzyIsNull(m_minX - minX) || !qFuzzyIsNull(m_maxX - maxX)) { |
|
44 | if (!qFuzzyIsNull(m_minX - minX) || !qFuzzyIsNull(m_maxX - maxX)) { | |
45 | m_minX = minX; |
|
45 | m_minX = minX; | |
46 | m_maxX = maxX; |
|
46 | m_maxX = maxX; | |
47 | axisXChanged = true; |
|
47 | axisXChanged = true; | |
48 | emit rangeHorizontalChanged(m_minX, m_maxX); |
|
48 | emit rangeHorizontalChanged(m_minX, m_maxX); | |
49 | } |
|
49 | } | |
50 |
|
50 | |||
51 | if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) { |
|
51 | if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) { | |
52 | m_minY = minY; |
|
52 | m_minY = minY; | |
53 | m_maxY = maxY; |
|
53 | m_maxY = maxY; | |
54 | axisYChanged = true; |
|
54 | axisYChanged = true; | |
55 | m_logMinY = log10(m_minY) / log10(m_logBaseY); |
|
55 | m_logMinY = log10(m_minY) / log10(m_logBaseY); | |
56 | m_logMaxY = log10(m_maxY) / log10(m_logBaseY); |
|
56 | m_logMaxY = log10(m_maxY) / log10(m_logBaseY); | |
57 | emit rangeVerticalChanged(m_minY, m_maxY); |
|
57 | emit rangeVerticalChanged(m_minY, m_maxY); | |
58 | } |
|
58 | } | |
59 |
|
59 | |||
60 | if (axisXChanged || axisYChanged) |
|
60 | if (axisXChanged || axisYChanged) | |
61 | emit updated(); |
|
61 | emit updated(); | |
62 | } |
|
62 | } | |
63 |
|
63 | |||
64 | void XLogYDomain::zoomIn(const QRectF &rect) |
|
64 | void XLogYDomain::zoomIn(const QRectF &rect) | |
65 | { |
|
65 | { | |
66 | qreal dx = spanX() / m_size.width(); |
|
66 | qreal dx = spanX() / m_size.width(); | |
67 | qreal dy = spanY() / m_size.height(); |
|
|||
68 |
|
||||
69 | qreal maxX = m_maxX; |
|
67 | qreal maxX = m_maxX; | |
70 | qreal minX = m_minX; |
|
68 | qreal minX = m_minX; | |
71 | qreal minY = m_minY; |
|
|||
72 | qreal maxY = m_maxY; |
|
|||
73 |
|
69 | |||
74 | maxX = minX + dx * rect.right(); |
|
70 | maxX = minX + dx * rect.right(); | |
75 | minX = minX + dx * rect.left(); |
|
71 | minX = minX + dx * rect.left(); | |
76 | minY = maxY - dy * rect.bottom(); |
|
72 | ||
77 | maxY = maxY - dy * rect.top(); |
|
73 | qreal newLogMinY = m_logMaxY - rect.bottom() * (m_logMaxY - m_logMinY) / m_size.height(); | |
|
74 | qreal newLogMaxY = m_logMaxY - rect.top() * (m_logMaxY - m_logMinY) / m_size.height(); | |||
|
75 | qreal minY = qPow(m_logBaseY, newLogMinY); | |||
|
76 | qreal maxY = qPow(m_logBaseY, newLogMaxY); | |||
78 |
|
77 | |||
79 | setRange(minX, maxX, minY, maxY); |
|
78 | setRange(minX, maxX, minY, maxY); | |
80 | } |
|
79 | } | |
81 |
|
80 | |||
82 | void XLogYDomain::zoomOut(const QRectF &rect) |
|
81 | void XLogYDomain::zoomOut(const QRectF &rect) | |
83 | { |
|
82 | { | |
84 | qreal dx = spanX() / rect.width(); |
|
83 | qreal dx = spanX() / rect.width(); | |
85 | qreal dy = spanY() / rect.height(); |
|
|||
86 |
|
||||
87 | qreal maxX = m_maxX; |
|
84 | qreal maxX = m_maxX; | |
88 | qreal minX = m_minX; |
|
85 | qreal minX = m_minX; | |
89 | qreal minY = m_minY; |
|
|||
90 | qreal maxY = m_maxY; |
|
|||
91 |
|
86 | |||
92 | minX = maxX - dx * rect.right(); |
|
87 | minX = maxX - dx * rect.right(); | |
93 | maxX = minX + dx * m_size.width(); |
|
88 | maxX = minX + dx * m_size.width(); | |
94 | maxY = minY + dy * rect.bottom(); |
|
89 | ||
95 | minY = maxY - dy * m_size.height(); |
|
90 | qreal ratioY = m_size.height()/rect.height(); | |
|
91 | qreal newLogMinY = m_logMaxY - (m_logMaxY - m_logMinY) / ratioY; | |||
|
92 | qreal newLogMaxY = m_logMaxY + (m_logMaxY - m_logMinY) / ratioY; | |||
|
93 | qreal minY = qPow(m_logBaseY, newLogMinY); | |||
|
94 | qreal maxY = qPow(m_logBaseY, newLogMaxY); | |||
96 |
|
95 | |||
97 | setRange(minX, maxX, minY, maxY); |
|
96 | setRange(minX, maxX, minY, maxY); | |
98 | } |
|
97 | } | |
99 |
|
98 | |||
100 | void XLogYDomain::move(qreal dx, qreal dy) |
|
99 | void XLogYDomain::move(qreal dx, qreal dy) | |
101 | { |
|
100 | { | |
102 | qreal x = spanX() / m_size.width(); |
|
101 | qreal x = spanX() / m_size.width(); | |
103 | qreal y = spanY() / m_size.height(); |
|
|||
104 |
|
||||
105 | qreal maxX = m_maxX; |
|
102 | qreal maxX = m_maxX; | |
106 | qreal minX = m_minX; |
|
103 | qreal minX = m_minX; | |
107 | qreal minY = m_minY; |
|
|||
108 | qreal maxY = m_maxY; |
|
|||
109 |
|
104 | |||
110 | if (dx != 0) { |
|
105 | if (dx != 0) { | |
111 | minX = minX + x * dx; |
|
106 | minX = minX + x * dx; | |
112 | maxX = maxX + x * dx; |
|
107 | maxX = maxX + x * dx; | |
113 | } |
|
108 | } | |
114 | if (dy != 0) { |
|
109 | ||
115 | minY = minY + y * dy; |
|
110 | qreal stepY = dy * qAbs(m_logMaxY - m_logMinY) / m_size.height(); | |
116 | maxY = maxY + y * dy; |
|
111 | qreal minY = qPow(m_logBaseY, m_logMinY + stepY); | |
117 | } |
|
112 | qreal maxY = qPow(m_logBaseY, m_logMaxY + stepY); | |
|
113 | ||||
118 | setRange(minX, maxX, minY, maxY); |
|
114 | setRange(minX, maxX, minY, maxY); | |
119 | } |
|
115 | } | |
120 |
|
116 | |||
121 | QPointF XLogYDomain::calculateGeometryPoint(const QPointF &point) const |
|
117 | QPointF XLogYDomain::calculateGeometryPoint(const QPointF &point) const | |
122 | { |
|
118 | { | |
123 | const qreal leftEdge = m_logMinY < m_logMaxY ? m_logMinY : m_logMaxY; |
|
119 | const qreal leftEdge = m_logMinY < m_logMaxY ? m_logMinY : m_logMaxY; | |
124 | const qreal deltaX = m_size.width() / (m_maxX - m_minX); |
|
120 | const qreal deltaX = m_size.width() / (m_maxX - m_minX); | |
125 | const qreal deltaY = m_size.height() / qAbs(m_logMaxY - m_logMinY); |
|
121 | const qreal deltaY = m_size.height() / qAbs(m_logMaxY - m_logMinY); | |
126 |
|
122 | |||
127 | qreal x = (point.x() - m_minX) * deltaX; |
|
123 | qreal x = (point.x() - m_minX) * deltaX; | |
128 | qreal y = (log10(point.y()) / log10(m_logBaseY)) * -deltaY - leftEdge * -deltaY + m_size.height(); |
|
124 | qreal y = (log10(point.y()) / log10(m_logBaseY)) * -deltaY - leftEdge * -deltaY + m_size.height(); | |
129 | return QPointF(x, y); |
|
125 | return QPointF(x, y); | |
130 | } |
|
126 | } | |
131 |
|
127 | |||
132 | QVector<QPointF> XLogYDomain::calculateGeometryPoints(const QList<QPointF>& vector) const |
|
128 | QVector<QPointF> XLogYDomain::calculateGeometryPoints(const QList<QPointF>& vector) const | |
133 | { |
|
129 | { | |
134 | const qreal leftEdge = m_logMinY < m_logMaxY ? m_logMinY : m_logMaxY; |
|
130 | const qreal leftEdge = m_logMinY < m_logMaxY ? m_logMinY : m_logMaxY; | |
135 | const qreal deltaX = m_size.width() / (m_maxX - m_minX); |
|
131 | const qreal deltaX = m_size.width() / (m_maxX - m_minX); | |
136 | const qreal deltaY = m_size.height() / qAbs(m_logMaxY - m_logMinY); |
|
132 | const qreal deltaY = m_size.height() / qAbs(m_logMaxY - m_logMinY); | |
137 |
|
133 | |||
138 | QVector<QPointF> result; |
|
134 | QVector<QPointF> result; | |
139 | result.resize(vector.count()); |
|
135 | result.resize(vector.count()); | |
140 |
|
136 | |||
141 | for (int i = 0; i < vector.count(); ++i) { |
|
137 | for (int i = 0; i < vector.count(); ++i) { | |
142 | qreal x = (vector[i].x() - m_minX) * deltaX; |
|
138 | qreal x = (vector[i].x() - m_minX) * deltaX; | |
143 | qreal y = (log10(vector[i].y()) / log10(m_logBaseY)) * -deltaY - leftEdge * -deltaY + m_size.height(); |
|
139 | qreal y = (log10(vector[i].y()) / log10(m_logBaseY)) * -deltaY - leftEdge * -deltaY + m_size.height(); | |
144 | result[i].setX(x); |
|
140 | result[i].setX(x); | |
145 | result[i].setY(y); |
|
141 | result[i].setY(y); | |
146 | } |
|
142 | } | |
147 | return result; |
|
143 | return result; | |
148 | } |
|
144 | } | |
149 |
|
145 | |||
150 | QPointF XLogYDomain::calculateDomainPoint(const QPointF &point) const |
|
146 | QPointF XLogYDomain::calculateDomainPoint(const QPointF &point) const | |
151 | { |
|
147 | { | |
152 | const qreal deltaX = m_size.width() / (m_maxX - m_minX); |
|
148 | const qreal deltaX = m_size.width() / (m_maxX - m_minX); | |
153 | const qreal deltaY = m_size.height() / (m_maxY - m_minY); |
|
149 | const qreal deltaY = m_size.height() / (m_maxY - m_minY); | |
154 | qreal x = point.x() / deltaX + m_minX; |
|
150 | qreal x = point.x() / deltaX + m_minX; | |
155 | qreal y = (point.y() - m_size.height()) / (-deltaY) + m_minY; |
|
151 | qreal y = (point.y() - m_size.height()) / (-deltaY) + m_minY; | |
156 | return QPointF(x, y); |
|
152 | return QPointF(x, y); | |
157 | } |
|
153 | } | |
158 |
|
154 | |||
159 | // operators |
|
155 | // operators | |
160 |
|
156 | |||
161 | bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const XLogYDomain &domain1, const XLogYDomain &domain2) |
|
157 | bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const XLogYDomain &domain1, const XLogYDomain &domain2) | |
162 | { |
|
158 | { | |
163 | return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX) && |
|
159 | return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX) && | |
164 | qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY) && |
|
160 | qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY) && | |
165 | qFuzzyIsNull(domain1.m_minX - domain2.m_minX) && |
|
161 | qFuzzyIsNull(domain1.m_minX - domain2.m_minX) && | |
166 | qFuzzyIsNull(domain1.m_minY - domain2.m_minY)); |
|
162 | qFuzzyIsNull(domain1.m_minY - domain2.m_minY)); | |
167 | } |
|
163 | } | |
168 |
|
164 | |||
169 |
|
165 | |||
170 | bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const XLogYDomain &domain1, const XLogYDomain &domain2) |
|
166 | bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const XLogYDomain &domain1, const XLogYDomain &domain2) | |
171 | { |
|
167 | { | |
172 | return !(domain1 == domain2); |
|
168 | return !(domain1 == domain2); | |
173 | } |
|
169 | } | |
174 |
|
170 | |||
175 |
|
171 | |||
176 | QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const XLogYDomain &domain) |
|
172 | QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const XLogYDomain &domain) | |
177 | { |
|
173 | { | |
178 | dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size; |
|
174 | dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size; | |
179 | return dbg.maybeSpace(); |
|
175 | return dbg.maybeSpace(); | |
180 | } |
|
176 | } | |
181 |
|
177 | |||
182 | #include "moc_xlogydomain_p.cpp" |
|
178 | #include "moc_xlogydomain_p.cpp" | |
183 |
|
179 | |||
184 | QTCOMMERCIALCHART_END_NAMESPACE |
|
180 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now