1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
@@ -27,7 +27,8 | |||||
27 |
|
27 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
29 | |||
30 |
ChartBarCategoryAxisX::ChartBarCategoryAxisX(QBarCategoryAxis *axis,ChartPresenter *presenter) |
|
30 | ChartBarCategoryAxisX::ChartBarCategoryAxisX(QBarCategoryAxis *axis, ChartPresenter *presenter) | |
|
31 | : HorizontalAxis(axis, presenter, true), | |||
31 | m_categoriesAxis(axis) |
|
32 | m_categoriesAxis(axis) | |
32 | { |
|
33 | { | |
33 |
|
34 | |||
@@ -51,14 +52,13 QVector<qreal> ChartBarCategoryAxisX::calculateLayout() const | |||||
51 | const qreal delta = gridRect.width()/(count); |
|
52 | const qreal delta = gridRect.width() / (count); | |
52 | qreal offset =-min()-0.5; |
|
53 | qreal offset = -min() - 0.5; | |
53 |
|
54 | |||
54 |
if(delta<1) |
|
55 | if (delta < 1) | |
|
56 | return points; | |||
55 |
|
57 | |||
56 |
if(offset<0) |
|
58 | if (offset < 0) | |
57 | offset = int(offset * gridRect.width()/(max() - min()))%int(delta) + delta; |
|
59 | offset = int(offset * gridRect.width() / (max() - min())) % int(delta) + delta; | |
58 |
|
|
60 | else | |
59 | else { |
|
|||
60 | offset = int(offset * gridRect.width()/(max() - min()))%int(delta); |
|
61 | offset = int(offset * gridRect.width() / (max() - min())) % int(delta); | |
61 | } |
|
|||
62 |
|
62 | |||
63 | for (int i = -1; i < count+1; ++i) { |
|
63 | for (int i = -1; i < count + 1; ++i) { | |
64 | qreal x = offset + i * delta + gridRect.left(); |
|
64 | qreal x = offset + i * delta + gridRect.left(); | |
@@ -77,8 +77,7 QStringList ChartBarCategoryAxisX::createCategoryLabels(const QVector<qreal>& la | |||||
77 | qreal x = qFloor((((layout[i] + layout[i+1])/2-gridRect.left())*d + min()+0.5)); |
|
77 | qreal x = qFloor((((layout[i] + layout[i + 1]) / 2 - gridRect.left()) * d + min() + 0.5)); | |
78 | if ((x < m_categoriesAxis->categories().count()) && (x >= 0)) { |
|
78 | if ((x < m_categoriesAxis->categories().count()) && (x >= 0)) { | |
79 | result << m_categoriesAxis->categories().at(x); |
|
79 | result << m_categoriesAxis->categories().at(x); | |
80 | } |
|
80 | } else { | |
81 | else { |
|
|||
82 | // No label for x coordinate |
|
81 | // No label for x coordinate | |
83 | result << ""; |
|
82 | result << ""; | |
84 | } |
|
83 | } | |
@@ -91,17 +90,18 QStringList ChartBarCategoryAxisX::createCategoryLabels(const QVector<qreal>& la | |||||
91 | void ChartBarCategoryAxisX::updateGeometry() |
|
90 | void ChartBarCategoryAxisX::updateGeometry() | |
92 | { |
|
91 | { | |
93 | const QVector<qreal>& layout = ChartAxis::layout(); |
|
92 | const QVector<qreal>& layout = ChartAxis::layout(); | |
94 |
if(layout.isEmpty()) |
|
93 | if (layout.isEmpty()) | |
|
94 | return; | |||
95 | setLabels(createCategoryLabels(layout)); |
|
95 | setLabels(createCategoryLabels(layout)); | |
96 | HorizontalAxis::updateGeometry(); |
|
96 | HorizontalAxis::updateGeometry(); | |
97 | } |
|
97 | } | |
98 |
|
98 | |||
99 | void ChartBarCategoryAxisX::handleAxisUpdated() |
|
99 | void ChartBarCategoryAxisX::handleAxisUpdated() | |
100 | { |
|
100 | { | |
101 | if(m_categoriesAxis->categories()!=m_categories) |
|
101 | if (m_categoriesAxis->categories() != m_categories) { | |
102 | { |
|
|||
103 | m_categories=m_categoriesAxis->categories(); |
|
102 | m_categories = m_categoriesAxis->categories(); | |
104 |
if(ChartAxis::layout().count()==m_categoriesAxis->d_ptr->count()+2) |
|
103 | if (ChartAxis::layout().count() == m_categoriesAxis->d_ptr->count() + 2) | |
|
104 | updateGeometry(); | |||
105 | } |
|
105 | } | |
106 | ChartAxis::handleAxisUpdated(); |
|
106 | ChartAxis::handleAxisUpdated(); | |
107 | } |
|
107 | } | |
@@ -127,8 +127,7 QSizeF ChartBarCategoryAxisX::sizeHint(Qt::SizeHint which, const QSizeF& constra | |||||
127 |
|
|
127 | break; | |
128 |
|
|
128 | case Qt::PreferredSize: { | |
129 |
|
129 | |||
130 |
|
|
130 | for (int i = 0; i < ticksList.size(); ++i) { | |
131 | { |
|
|||
132 |
|
|
131 | QRectF rect = fn.boundingRect(ticksList.at(i)); | |
133 |
|
|
132 | width += rect.width(); | |
134 |
|
|
133 | height = qMax(rect.height() + labelPadding(), height); |
@@ -26,7 +26,8 | |||||
26 |
|
26 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
28 | |||
29 |
ChartBarCategoryAxisY::ChartBarCategoryAxisY(QBarCategoryAxis *axis,ChartPresenter *presenter) |
|
29 | ChartBarCategoryAxisY::ChartBarCategoryAxisY(QBarCategoryAxis *axis, ChartPresenter *presenter) | |
|
30 | : VerticalAxis(axis, presenter, true), | |||
30 | m_categoriesAxis(axis) |
|
31 | m_categoriesAxis(axis) | |
31 | { |
|
32 | { | |
32 | } |
|
33 | } | |
@@ -49,14 +50,13 QVector<qreal> ChartBarCategoryAxisY::calculateLayout() const | |||||
49 | const qreal delta = gridRect.height()/(count); |
|
50 | const qreal delta = gridRect.height() / (count); | |
50 | qreal offset = - min() - 0.5; |
|
51 | qreal offset = - min() - 0.5; | |
51 |
|
52 | |||
52 |
if(delta<1) |
|
53 | if (delta < 1) | |
|
54 | return points; | |||
53 |
|
55 | |||
54 |
if(offset<0) |
|
56 | if (offset < 0) | |
55 | offset = int(offset * gridRect.height()/(max() - min()))%int(delta) + delta; |
|
57 | offset = int(offset * gridRect.height() / (max() - min())) % int(delta) + delta; | |
56 |
|
|
58 | else | |
57 | else { |
|
|||
58 | offset = int(offset * gridRect.height()/(max() - min()))%int(delta); |
|
59 | offset = int(offset * gridRect.height() / (max() - min())) % int(delta); | |
59 | } |
|
|||
60 |
|
60 | |||
61 | for (int i = -1; i < count +1; ++i) { |
|
61 | for (int i = -1; i < count + 1; ++i) { | |
62 | int y = gridRect.bottom() - i * delta - offset; |
|
62 | int y = gridRect.bottom() - i * delta - offset; | |
@@ -74,8 +74,7 QStringList ChartBarCategoryAxisY::createCategoryLabels(const QVector<qreal>& la | |||||
74 | qreal x = qFloor(((gridRect.height()- (layout[i+1] + layout[i])/2 + gridRect.top())*d + min()+0.5)); |
|
74 | qreal x = qFloor(((gridRect.height() - (layout[i + 1] + layout[i]) / 2 + gridRect.top()) * d + min() + 0.5)); | |
75 | if ((x < m_categoriesAxis->categories().count()) && (x >= 0)) { |
|
75 | if ((x < m_categoriesAxis->categories().count()) && (x >= 0)) { | |
76 | result << m_categoriesAxis->categories().at(x); |
|
76 | result << m_categoriesAxis->categories().at(x); | |
77 | } |
|
77 | } else { | |
78 | else { |
|
|||
79 | // No label for x coordinate |
|
78 | // No label for x coordinate | |
80 | result << ""; |
|
79 | result << ""; | |
81 | } |
|
80 | } | |
@@ -87,7 +86,8 QStringList ChartBarCategoryAxisY::createCategoryLabels(const QVector<qreal>& la | |||||
87 | void ChartBarCategoryAxisY::updateGeometry() |
|
86 | void ChartBarCategoryAxisY::updateGeometry() | |
88 | { |
|
87 | { | |
89 | const QVector<qreal>& layout = ChartAxis::layout(); |
|
88 | const QVector<qreal>& layout = ChartAxis::layout(); | |
90 |
if(layout.isEmpty()) |
|
89 | if (layout.isEmpty()) | |
|
90 | return; | |||
91 | setLabels(createCategoryLabels(layout)); |
|
91 | setLabels(createCategoryLabels(layout)); | |
92 | VerticalAxis::updateGeometry(); |
|
92 | VerticalAxis::updateGeometry(); | |
93 | } |
|
93 | } | |
@@ -95,13 +95,11 void ChartBarCategoryAxisY::updateGeometry() | |||||
95 | void ChartBarCategoryAxisY::handleAxisUpdated() |
|
95 | void ChartBarCategoryAxisY::handleAxisUpdated() | |
96 | { |
|
96 | { | |
97 |
|
97 | |||
98 | if(m_categoriesAxis->categories()!=m_categories) |
|
98 | if (m_categoriesAxis->categories() != m_categories) { | |
99 | { |
|
|||
100 | m_categories=m_categoriesAxis->categories(); |
|
99 | m_categories = m_categoriesAxis->categories(); | |
101 |
if(ChartAxis::layout().count()==m_categoriesAxis->d_ptr->count()+2) |
|
100 | if (ChartAxis::layout().count() == m_categoriesAxis->d_ptr->count() + 2) | |
102 | updateGeometry(); |
|
101 | updateGeometry(); | |
103 |
|
|
102 | } | |
104 | } |
|
|||
105 | ChartAxis::handleAxisUpdated(); |
|
103 | ChartAxis::handleAxisUpdated(); | |
106 | } |
|
104 | } | |
107 |
|
105 | |||
@@ -126,8 +124,7 QSizeF ChartBarCategoryAxisY::sizeHint(Qt::SizeHint which, const QSizeF& constra | |||||
126 |
|
|
124 | break; | |
127 |
|
|
125 | case Qt::PreferredSize: { | |
128 |
|
126 | |||
129 |
|
|
127 | for (int i = 0; i < ticksList.size(); ++i) { | |
130 | { |
|
|||
131 |
|
|
128 | QRectF rect = fn.boundingRect(ticksList.at(i)); | |
132 |
|
|
129 | height += rect.height(); | |
133 |
|
|
130 | width = qMax(rect.width() + labelPadding(), width); |
@@ -169,20 +169,19 void QBarCategoryAxis::append(const QStringList &categories) | |||||
169 |
|
169 | |||
170 | int count = d->m_categories.count(); |
|
170 | int count = d->m_categories.count(); | |
171 |
|
171 | |||
172 | foreach(QString category, categories) |
|
172 | foreach(QString category, categories) { | |
173 | { |
|
|||
174 | if(!d->m_categories.contains(category) && !category.isNull()) { |
|
173 | if (!d->m_categories.contains(category) && !category.isNull()) { | |
175 | d->m_categories.append(category); |
|
174 | d->m_categories.append(category); | |
176 | } |
|
175 | } | |
177 | } |
|
176 | } | |
178 |
|
177 | |||
179 |
if(d->m_categories.count() == count) |
|
178 | if (d->m_categories.count() == count) | |
|
179 | return; | |||
180 |
|
180 | |||
181 |
if (count == 0) |
|
181 | if (count == 0) | |
182 | setRange(d->m_categories.first(), d->m_categories.last()); |
|
182 | setRange(d->m_categories.first(), d->m_categories.last()); | |
183 |
|
|
183 | else | |
184 | setRange(d->m_minCategory, d->m_categories.last()); |
|
184 | setRange(d->m_minCategory, d->m_categories.last()); | |
185 | } |
|
|||
186 |
|
185 | |||
187 | emit categoriesChanged(); |
|
186 | emit categoriesChanged(); | |
188 | } |
|
187 | } | |
@@ -198,17 +197,16 void QBarCategoryAxis::append(const QString &category) | |||||
198 |
|
197 | |||
199 | int count = d->m_categories.count(); |
|
198 | int count = d->m_categories.count(); | |
200 |
|
199 | |||
201 |
if(!d->m_categories.contains(category) && !category.isNull()) |
|
200 | if (!d->m_categories.contains(category) && !category.isNull()) | |
202 | d->m_categories.append(category); |
|
201 | d->m_categories.append(category); | |
203 | } |
|
|||
204 |
|
202 | |||
205 |
if(d->m_categories.count() == count) |
|
203 | if (d->m_categories.count() == count) | |
|
204 | return; | |||
206 |
|
205 | |||
207 |
if (count == 0) |
|
206 | if (count == 0) | |
208 | setRange(d->m_categories.last(), d->m_categories.last()); |
|
207 | setRange(d->m_categories.last(), d->m_categories.last()); | |
209 |
|
|
208 | else | |
210 | setRange(d->m_minCategory, d->m_categories.last()); |
|
209 | setRange(d->m_minCategory, d->m_categories.last()); | |
211 | } |
|
|||
212 |
|
210 | |||
213 | emit categoriesChanged(); |
|
211 | emit categoriesChanged(); | |
214 | } |
|
212 | } | |
@@ -232,8 +230,9 void QBarCategoryAxis::remove(const QString &category) | |||||
232 | d->updateCategoryDomain(); |
|
230 | d->updateCategoryDomain(); | |
233 | d->emitUpdated(); |
|
231 | d->emitUpdated(); | |
234 | } |
|
232 | } | |
235 | }else |
|
233 | } else { | |
236 | setRange(QString::null, QString::null); |
|
234 | setRange(QString::null, QString::null); | |
|
235 | } | |||
237 | emit categoriesChanged(); |
|
236 | emit categoriesChanged(); | |
238 | } |
|
237 | } | |
239 | } |
|
238 | } | |
@@ -248,11 +247,11 void QBarCategoryAxis::insert(int index, const QString &category) | |||||
248 |
|
247 | |||
249 | int count = d->m_categories.count(); |
|
248 | int count = d->m_categories.count(); | |
250 |
|
249 | |||
251 |
if(!d->m_categories.contains(category) && !category.isNull()) |
|
250 | if (!d->m_categories.contains(category) && !category.isNull()) | |
252 | d->m_categories.insert(index, category); |
|
251 | d->m_categories.insert(index, category); | |
253 | } |
|
|||
254 |
|
252 | |||
255 |
if(d->m_categories.count() == count) |
|
253 | if (d->m_categories.count() == count) | |
|
254 | return; | |||
256 |
|
255 | |||
257 | if (count == 0) { |
|
256 | if (count == 0) { | |
258 | setRange(d->m_categories.first(), d->m_categories.first()); |
|
257 | setRange(d->m_categories.first(), d->m_categories.first()); | |
@@ -404,9 +403,9 void QBarCategoryAxis::setRange(const QString &minCategory, const QString &maxCa | |||||
404 | d->emitUpdated(); |
|
403 | d->emitUpdated(); | |
405 | } |
|
404 | } | |
406 |
|
405 | |||
407 |
if (d->m_categories.indexOf(maxCategory) < d->m_categories.indexOf(minCategory)) |
|
406 | if (d->m_categories.indexOf(maxCategory) < d->m_categories.indexOf(minCategory)) | |
408 | return; |
|
407 | return; | |
409 | } |
|
408 | ||
410 | if (!minCategory.isEmpty() && d->m_minCategory != minCategory && d->m_categories.contains(minCategory)) { |
|
409 | if (!minCategory.isEmpty() && d->m_minCategory != minCategory && d->m_categories.contains(minCategory)) { | |
411 | d->m_minCategory = minCategory; |
|
410 | d->m_minCategory = minCategory; | |
412 | d->m_min = d->m_categories.indexOf(d->m_minCategory) - 0.5; |
|
411 | d->m_min = d->m_categories.indexOf(d->m_minCategory) - 0.5; |
@@ -28,7 +28,8 | |||||
28 |
|
28 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
30 | |||
31 |
ChartCategoryAxisX::ChartCategoryAxisX(QCategoryAxis *axis,ChartPresenter *presenter) |
|
31 | ChartCategoryAxisX::ChartCategoryAxisX(QCategoryAxis *axis, ChartPresenter *presenter) | |
|
32 | : HorizontalAxis(axis, presenter, true), | |||
32 | m_axis(axis) |
|
33 | m_axis(axis) | |
33 | { |
|
34 | { | |
34 | } |
|
35 | } | |
@@ -50,7 +51,7 QVector<qreal> ChartCategoryAxisX::calculateLayout() const | |||||
50 | if (range > 0) { |
|
51 | if (range > 0) { | |
51 | points.resize(tickCount); |
|
52 | points.resize(tickCount); | |
52 | qreal scale = gridRect.width() / range; |
|
53 | qreal scale = gridRect.width() / range; | |
53 | for (int i = 0; i < tickCount; ++i) |
|
54 | for (int i = 0; i < tickCount; ++i) { | |
54 | if (i < tickCount - 1) { |
|
55 | if (i < tickCount - 1) { | |
55 | int x = (m_axis->startValue(m_axis->categoriesLabels().at(i)) - m_axis->min()) * scale + gridRect.left(); |
|
56 | int x = (m_axis->startValue(m_axis->categoriesLabels().at(i)) - m_axis->min()) * scale + gridRect.left(); | |
56 | points[i] = x; |
|
57 | points[i] = x; | |
@@ -59,6 +60,7 QVector<qreal> ChartCategoryAxisX::calculateLayout() const | |||||
59 | points[i] = x; |
|
60 | points[i] = x; | |
60 | } |
|
61 | } | |
61 | } |
|
62 | } | |
|
63 | } | |||
62 |
|
64 | |||
63 | return points; |
|
65 | return points; | |
64 | } |
|
66 | } | |
@@ -96,8 +98,7 QSizeF ChartCategoryAxisX::sizeHint(Qt::SizeHint which, const QSizeF& constraint | |||||
96 | break; |
|
98 | break; | |
97 |
|
|
99 | case Qt::PreferredSize: { | |
98 |
|
100 | |||
99 |
|
|
101 | for (int i = 0; i < ticksList.size(); ++i) { | |
100 | { |
|
|||
101 |
|
|
102 | QRectF rect = fn.boundingRect(ticksList.at(i)); | |
102 |
|
|
103 | width += rect.width(); | |
103 |
|
|
104 | height = qMax(rect.height() + labelPadding(), height); |
@@ -44,11 +44,14 public: | |||||
44 | ~ChartCategoryAxisX(); |
|
44 | ~ChartCategoryAxisX(); | |
45 |
|
45 | |||
46 | QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const; |
|
46 | QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const; | |
|
47 | ||||
47 | protected: |
|
48 | protected: | |
48 | QVector<qreal> calculateLayout() const; |
|
49 | QVector<qreal> calculateLayout() const; | |
49 | void updateGeometry(); |
|
50 | void updateGeometry(); | |
50 | Q_SLOTS |
|
51 | ||
|
52 | public Q_SLOTS: | |||
51 | void handleAxisUpdated(); |
|
53 | void handleAxisUpdated(); | |
|
54 | ||||
52 | private: |
|
55 | private: | |
53 | QCategoryAxis *m_axis; |
|
56 | QCategoryAxis *m_axis; | |
54 | }; |
|
57 | }; |
@@ -28,7 +28,8 | |||||
28 |
|
28 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
30 | |||
31 |
ChartCategoryAxisY::ChartCategoryAxisY(QCategoryAxis *axis,ChartPresenter *presenter) |
|
31 | ChartCategoryAxisY::ChartCategoryAxisY(QCategoryAxis *axis, ChartPresenter *presenter) | |
|
32 | : VerticalAxis(axis, presenter, true), | |||
32 | m_axis(axis) |
|
33 | m_axis(axis) | |
33 | { |
|
34 | { | |
34 | } |
|
35 | } | |
@@ -50,7 +51,7 QVector<qreal> ChartCategoryAxisY::calculateLayout() const | |||||
50 | if (range > 0) { |
|
51 | if (range > 0) { | |
51 | points.resize(tickCount); |
|
52 | points.resize(tickCount); | |
52 | qreal scale = gridRect.height() / range; |
|
53 | qreal scale = gridRect.height() / range; | |
53 | for (int i = 0; i < tickCount; ++i) |
|
54 | for (int i = 0; i < tickCount; ++i) { | |
54 | if (i < tickCount - 1) { |
|
55 | if (i < tickCount - 1) { | |
55 | int y = -(m_axis->startValue(m_axis->categoriesLabels().at(i)) - m_axis->min()) * scale + gridRect.bottom(); |
|
56 | int y = -(m_axis->startValue(m_axis->categoriesLabels().at(i)) - m_axis->min()) * scale + gridRect.bottom(); | |
56 | points[i] = y; |
|
57 | points[i] = y; | |
@@ -59,6 +60,7 QVector<qreal> ChartCategoryAxisY::calculateLayout() const | |||||
59 | points[i] = y; |
|
60 | points[i] = y; | |
60 | } |
|
61 | } | |
61 | } |
|
62 | } | |
|
63 | } | |||
62 |
|
64 | |||
63 | return points; |
|
65 | return points; | |
64 | } |
|
66 | } | |
@@ -96,8 +98,7 QSizeF ChartCategoryAxisY::sizeHint(Qt::SizeHint which, const QSizeF& constraint | |||||
96 |
|
|
98 | break; | |
97 |
|
|
99 | case Qt::PreferredSize: { | |
98 |
|
100 | |||
99 |
|
|
101 | for (int i = 0; i < ticksList.size(); ++i) { | |
100 | { |
|
|||
101 |
|
|
102 | QRectF rect = fn.boundingRect(ticksList.at(i)); | |
102 |
|
|
103 | height += rect.height(); | |
103 |
|
|
104 | width = qMax(rect.width() + labelPadding(), width); |
@@ -44,11 +44,14 public: | |||||
44 | ~ChartCategoryAxisY(); |
|
44 | ~ChartCategoryAxisY(); | |
45 |
|
45 | |||
46 | QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const; |
|
46 | QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const; | |
|
47 | ||||
47 | protected: |
|
48 | protected: | |
48 | QVector<qreal> calculateLayout() const; |
|
49 | QVector<qreal> calculateLayout() const; | |
49 | void updateGeometry(); |
|
50 | void updateGeometry(); | |
50 | Q_SLOTS |
|
51 | ||
|
52 | public Q_SLOTS: | |||
51 | void handleAxisUpdated(); |
|
53 | void handleAxisUpdated(); | |
|
54 | ||||
52 | private: |
|
55 | private: | |
53 | QCategoryAxis *m_axis; |
|
56 | QCategoryAxis *m_axis; | |
54 | }; |
|
57 | }; |
@@ -32,7 +32,8 | |||||
32 |
|
32 | |||
33 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
33 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
34 |
|
34 | |||
35 |
ChartAxis::ChartAxis(QAbstractAxis *axis,ChartPresenter *presenter, bool intervalAxis) |
|
35 | ChartAxis::ChartAxis(QAbstractAxis *axis, ChartPresenter *presenter, bool intervalAxis) | |
|
36 | : ChartElement(presenter), | |||
36 | m_chartAxis(axis), |
|
37 | m_chartAxis(axis), | |
37 | m_labelsAngle(0), |
|
38 | m_labelsAngle(0), | |
38 | m_grid(new QGraphicsItemGroup(presenter->rootItem())), |
|
39 | m_grid(new QGraphicsItemGroup(presenter->rootItem())), | |
@@ -78,10 +79,12 void ChartAxis::createItems(int count) | |||||
78 | { |
|
79 | { | |
79 | if (m_arrow->children().size() == 0) |
|
80 | if (m_arrow->children().size() == 0) | |
80 | m_arrow->addToGroup(new AxisItem(this,presenter()->rootItem())); |
|
81 | m_arrow->addToGroup(new AxisItem(this, presenter()->rootItem())); | |
|
82 | ||||
81 | if (m_intervalAxis && m_grid->children().size() == 0){ |
|
83 | if (m_intervalAxis && m_grid->children().size() == 0) { | |
82 | for(int i = 0 ; i < 2 ;i ++) |
|
84 | for (int i = 0 ; i < 2 ; i ++) | |
83 | m_grid->addToGroup(new QGraphicsLineItem(presenter()->rootItem())); |
|
85 | m_grid->addToGroup(new QGraphicsLineItem(presenter()->rootItem())); | |
84 | } |
|
86 | } | |
|
87 | ||||
85 | for (int i = 0; i < count; ++i) { |
|
88 | for (int i = 0; i < count; ++i) { | |
86 | m_grid->addToGroup(new QGraphicsLineItem(presenter()->rootItem())); |
|
89 | m_grid->addToGroup(new QGraphicsLineItem(presenter()->rootItem())); | |
87 | m_labels->addToGroup(new QGraphicsSimpleTextItem(presenter()->rootItem())); |
|
90 | m_labels->addToGroup(new QGraphicsSimpleTextItem(presenter()->rootItem())); | |
@@ -99,7 +102,8 void ChartAxis::deleteItems(int count) | |||||
99 | QList<QGraphicsItem *> axis = m_arrow->childItems(); |
|
102 | QList<QGraphicsItem *> axis = m_arrow->childItems(); | |
100 |
|
103 | |||
101 | for (int i = 0; i < count; ++i) { |
|
104 | for (int i = 0; i < count; ++i) { | |
102 |
if (lines.size()%2 && lines.size() > 1) |
|
105 | if (lines.size() % 2 && lines.size() > 1) | |
|
106 | delete(shades.takeLast()); | |||
103 | delete(lines.takeLast()); |
|
107 | delete(lines.takeLast()); | |
104 | delete(labels.takeLast()); |
|
108 | delete(labels.takeLast()); | |
105 | delete(axis.takeLast()); |
|
109 | delete(axis.takeLast()); | |
@@ -110,12 +114,10 void ChartAxis::updateLayout(QVector<qreal> &layout) | |||||
110 | { |
|
114 | { | |
111 | int diff = m_layoutVector.size() - layout.size(); |
|
115 | int diff = m_layoutVector.size() - layout.size(); | |
112 |
|
116 | |||
113 |
if (diff>0) |
|
117 | if (diff > 0) | |
114 | deleteItems(diff); |
|
118 | deleteItems(diff); | |
115 | } |
|
119 | else if (diff < 0) | |
116 | else if (diff<0) { |
|
|||
117 | createItems(-diff); |
|
120 | createItems(-diff); | |
118 | } |
|
|||
119 |
|
121 | |||
120 | if(diff<0) handleAxisUpdated(); |
|
122 | if (diff < 0) handleAxisUpdated(); | |
121 |
|
123 | |||
@@ -143,8 +145,7 void ChartAxis::updateLayout(QVector<qreal> &layout) | |||||
143 |
|
|
145 | } | |
144 |
|
|
146 | m_animation->setValues(m_layoutVector, layout); | |
145 |
|
|
147 | presenter()->startAnimation(m_animation); | |
146 | } |
|
148 | } else { | |
147 | else { |
|
|||
148 | setLayout(layout); |
|
149 | setLayout(layout); | |
149 | updateGeometry(); |
|
150 | updateGeometry(); | |
150 | } |
|
151 | } | |
@@ -212,70 +213,61 void ChartAxis::setShadesVisibility(bool visible) | |||||
212 |
|
213 | |||
213 | void ChartAxis::setLabelsAngle(int angle) |
|
214 | void ChartAxis::setLabelsAngle(int angle) | |
214 | { |
|
215 | { | |
215 |
foreach(QGraphicsItem* |
|
216 | foreach (QGraphicsItem *item, m_labels->childItems()) | |
216 |
|
|
217 | item->setRotation(angle); | |
217 | } |
|
|||
218 |
|
218 | |||
219 | m_labelsAngle=angle; |
|
219 | m_labelsAngle = angle; | |
220 | } |
|
220 | } | |
221 |
|
221 | |||
222 | void ChartAxis::setLabelsPen(const QPen &pen) |
|
222 | void ChartAxis::setLabelsPen(const QPen &pen) | |
223 | { |
|
223 | { | |
224 |
foreach(QGraphicsItem* |
|
224 | foreach (QGraphicsItem *item , m_labels->childItems()) | |
225 | static_cast<QGraphicsSimpleTextItem*>(item)->setPen(pen); |
|
225 | static_cast<QGraphicsSimpleTextItem *>(item)->setPen(pen); | |
226 | } |
|
226 | } | |
227 | } |
|
|||
228 |
|
227 | |||
229 | void ChartAxis::setLabelsBrush(const QBrush &brush) |
|
228 | void ChartAxis::setLabelsBrush(const QBrush &brush) | |
230 | { |
|
229 | { | |
231 |
foreach(QGraphicsItem* |
|
230 | foreach (QGraphicsItem *item , m_labels->childItems()) | |
232 | static_cast<QGraphicsSimpleTextItem*>(item)->setBrush(brush); |
|
231 | static_cast<QGraphicsSimpleTextItem *>(item)->setBrush(brush); | |
233 | } |
|
232 | } | |
234 | } |
|
|||
235 |
|
233 | |||
236 | void ChartAxis::setLabelsFont(const QFont &font) |
|
234 | void ChartAxis::setLabelsFont(const QFont &font) | |
237 | { |
|
235 | { | |
238 |
foreach(QGraphicsItem* |
|
236 | foreach (QGraphicsItem *item , m_labels->childItems()) | |
239 | static_cast<QGraphicsSimpleTextItem*>(item)->setFont(font); |
|
237 | static_cast<QGraphicsSimpleTextItem *>(item)->setFont(font); | |
240 | } |
|
238 | ||
241 | if(m_font!=font) { |
|
239 | if (m_font != font) { | |
242 | m_font = font; |
|
240 | m_font = font; | |
243 |
foreach(QGraphicsItem* |
|
241 | foreach (QGraphicsItem *item , m_labels->childItems()) | |
244 | static_cast<QGraphicsSimpleTextItem*>(item)->setFont(font); |
|
242 | static_cast<QGraphicsSimpleTextItem *>(item)->setFont(font); | |
245 | } |
|
|||
246 | QGraphicsLayoutItem::updateGeometry(); |
|
243 | QGraphicsLayoutItem::updateGeometry(); | |
247 | presenter()->layout()->invalidate(); |
|
244 | presenter()->layout()->invalidate(); | |
248 |
|
||||
249 | } |
|
245 | } | |
250 | } |
|
246 | } | |
251 |
|
247 | |||
252 | void ChartAxis::setShadesBrush(const QBrush &brush) |
|
248 | void ChartAxis::setShadesBrush(const QBrush &brush) | |
253 | { |
|
249 | { | |
254 |
foreach(QGraphicsItem* |
|
250 | foreach (QGraphicsItem *item , m_shades->childItems()) | |
255 | static_cast<QGraphicsRectItem*>(item)->setBrush(brush); |
|
251 | static_cast<QGraphicsRectItem *>(item)->setBrush(brush); | |
256 | } |
|
252 | } | |
257 | } |
|
|||
258 |
|
253 | |||
259 | void ChartAxis::setShadesPen(const QPen &pen) |
|
254 | void ChartAxis::setShadesPen(const QPen &pen) | |
260 | { |
|
255 | { | |
261 |
foreach(QGraphicsItem* |
|
256 | foreach (QGraphicsItem *item , m_shades->childItems()) | |
262 | static_cast<QGraphicsRectItem*>(item)->setPen(pen); |
|
257 | static_cast<QGraphicsRectItem *>(item)->setPen(pen); | |
263 | } |
|
258 | } | |
264 | } |
|
|||
265 |
|
259 | |||
266 | void ChartAxis::setArrowPen(const QPen &pen) |
|
260 | void ChartAxis::setArrowPen(const QPen &pen) | |
267 | { |
|
261 | { | |
268 |
foreach(QGraphicsItem* |
|
262 | foreach (QGraphicsItem *item , m_arrow->childItems()) | |
269 |
|
|
263 | static_cast<QGraphicsLineItem *>(item)->setPen(pen); | |
270 | } |
|
264 | } | |
271 | } |
|
|||
272 |
|
265 | |||
273 | void ChartAxis::setGridPen(const QPen &pen) |
|
266 | void ChartAxis::setGridPen(const QPen &pen) | |
274 | { |
|
267 | { | |
275 |
foreach(QGraphicsItem* |
|
268 | foreach (QGraphicsItem *item , m_grid->childItems()) | |
276 | static_cast<QGraphicsLineItem*>(item)->setPen(pen); |
|
269 | static_cast<QGraphicsLineItem *>(item)->setPen(pen); | |
277 | } |
|
270 | } | |
278 | } |
|
|||
279 |
|
271 | |||
280 | void ChartAxis::setLabelPadding(int padding) |
|
272 | void ChartAxis::setLabelPadding(int padding) | |
281 | { |
|
273 | { | |
@@ -296,15 +288,12 void ChartAxis::handleDomainUpdated() | |||||
296 | if(m_chartAxis->orientation()==Qt::Horizontal) { |
|
288 | if (m_chartAxis->orientation() == Qt::Horizontal) { | |
297 | min = domain->minX(); |
|
289 | min = domain->minX(); | |
298 | max = domain->maxX(); |
|
290 | max = domain->maxX(); | |
299 | } |
|
291 | } else if (m_chartAxis->orientation() == Qt::Vertical) { | |
300 | else if (m_chartAxis->orientation()==Qt::Vertical) |
|
|||
301 | { |
|
|||
302 | min = domain->minY(); |
|
292 | min = domain->minY(); | |
303 | max = domain->maxY(); |
|
293 | max = domain->maxY(); | |
304 | } |
|
294 | } | |
305 |
|
295 | |||
306 | if (!qFuzzyIsNull(m_min - min) || !qFuzzyIsNull(m_max - max)) |
|
296 | if (!qFuzzyIsNull(m_min - min) || !qFuzzyIsNull(m_max - max)) { | |
307 | { |
|
|||
308 | m_min = min; |
|
297 | m_min = min; | |
309 | m_max = max; |
|
298 | m_max = max; | |
310 |
|
299 | |||
@@ -329,8 +318,8 void ChartAxis::handleDomainUpdated() | |||||
329 |
|
318 | |||
330 | void ChartAxis::handleAxisUpdated() |
|
319 | void ChartAxis::handleAxisUpdated() | |
331 | { |
|
320 | { | |
332 |
if(isEmpty()) |
|
321 | if (isEmpty()) | |
333 |
|
322 | return; | ||
334 |
|
323 | |||
335 | bool visible = m_chartAxis->isVisible(); |
|
324 | bool visible = m_chartAxis->isVisible(); | |
336 |
|
325 | |||
@@ -372,7 +361,8 void ChartAxis::setGeometry(const QRectF &axis, const QRectF &grid) | |||||
372 |
|
|
361 | m_gridRect = grid; | |
373 |
|
|
362 | m_axisRect = axis; | |
374 |
|
363 | |||
375 |
|
|
364 | if (isEmpty()) | |
|
365 | return; | |||
376 |
|
366 | |||
377 |
|
|
367 | if (!m_titleText.isNull()) { | |
378 |
|
|
368 | QFontMetrics fn(m_title->font()); | |
@@ -384,21 +374,19 void ChartAxis::setGeometry(const QRectF &axis, const QRectF &grid) | |||||
384 |
|
|
374 | else if (orientation() == Qt::Vertical) | |
385 | size = grid.height(); |
|
375 | size = grid.height(); | |
386 |
|
376 | |||
387 |
|
|
377 | if (fn.boundingRect(m_titleText).width() > size) { | |
388 | { |
|
|||
389 |
|
|
378 | QString string = m_titleText + "..."; | |
390 |
|
|
379 | while (fn.boundingRect(string).width() > size && string.length() > 3) | |
391 | string.remove(string.length() - 4, 1); |
|
380 | string.remove(string.length() - 4, 1); | |
392 |
|
|
381 | m_title->setText(string); | |
393 |
|
|
382 | } else { | |
394 | else |
|
|||
395 | m_title->setText(m_titleText); |
|
383 | m_title->setText(m_titleText); | |
|
384 | } | |||
396 |
|
385 | |||
397 |
|
|
386 | QPointF center = grid.center() - m_title->boundingRect().center(); | |
398 |
|
|
387 | if (orientation() == Qt::Horizontal) { | |
399 |
|
|
388 | m_title->setPos(center.x(), m_axisRect.bottom() - m_title->boundingRect().height()); | |
400 | } |
|
389 | } else if (orientation() == Qt::Vertical) { | |
401 | else if(orientation()==Qt::Vertical) { |
|
|||
402 |
|
|
390 | m_title->setTransformOriginPoint(m_title->boundingRect().center()); | |
403 |
|
|
391 | m_title->setRotation(270); | |
404 |
|
|
392 | m_title->setPos(m_axisRect.left() - m_title->boundingRect().width() / 2 + m_title->boundingRect().height() / 2, center.y()); | |
@@ -442,27 +430,22 QSizeF ChartAxis::sizeHint(Qt::SizeHint which, const QSizeF& constraint) const | |||||
442 | QFontMetrics fn(m_title->font()); |
|
430 | QFontMetrics fn(m_title->font()); | |
443 | QSizeF sh; |
|
431 | QSizeF sh; | |
444 |
|
432 | |||
445 |
if(m_titleText.isNull()) |
|
433 | if (m_titleText.isNull()) | |
|
434 | return sh; | |||
446 |
|
435 | |||
447 | switch(which) { |
|
436 | switch (which) { | |
448 |
|
|
437 | case Qt::MinimumSize: | |
449 |
if(orientation()==Qt::Horizontal) |
|
438 | if (orientation() == Qt::Horizontal) | |
450 |
sh = QSizeF(fn.boundingRect |
|
439 | sh = QSizeF(fn.boundingRect("...").width(), fn.height()); | |
451 | } |
|
440 | else if (orientation() == Qt::Vertical) | |
452 | else if(orientation()==Qt::Vertical) { |
|
|||
453 |
sh = QSizeF(fn.height(),fn.boundingRect |
|
441 | sh = QSizeF(fn.height(), fn.boundingRect("...").width()); | |
454 | } |
|
|||
455 |
|
||||
456 | break; |
|
442 | break; | |
457 |
|
|
443 | case Qt::MaximumSize: | |
458 |
|
|
444 | case Qt::PreferredSize: | |
459 |
if(orientation()==Qt::Horizontal) |
|
445 | if (orientation() == Qt::Horizontal) | |
460 | sh = QSizeF(fn.boundingRect(m_chartAxis->title()).width(),fn.height()); |
|
446 | sh = QSizeF(fn.boundingRect(m_chartAxis->title()).width(), fn.height()); | |
461 | } |
|
447 | else if (orientation() == Qt::Vertical) | |
462 | else if(orientation()==Qt::Vertical) { |
|
|||
463 | sh = QSizeF(fn.height(),fn.boundingRect(m_chartAxis->title()).width()); |
|
448 | sh = QSizeF(fn.height(), fn.boundingRect(m_chartAxis->title()).width()); | |
464 | } |
|
|||
465 |
|
||||
466 | break; |
|
449 | break; | |
467 |
|
|
450 | default: | |
468 | break; |
|
451 | break; | |
@@ -490,8 +473,7 QStringList ChartAxis::createValueLabels(int ticks) const | |||||
490 | qreal value = m_min + (i * (m_max - m_min)/ (ticks-1)); |
|
473 | qreal value = m_min + (i * (m_max - m_min) / (ticks - 1)); | |
491 | labels << QString::number(value,'f',n); |
|
474 | labels << QString::number(value, 'f', n); | |
492 | } |
|
475 | } | |
493 | } |
|
476 | } else { | |
494 | else { |
|
|||
495 | QByteArray array = format.toAscii(); |
|
477 | QByteArray array = format.toAscii(); | |
496 | for (int i=0; i< ticks; i++) { |
|
478 | for (int i = 0; i < ticks; i++) { | |
497 | qreal value = m_min + (i * (m_max - m_min)/ (ticks-1)); |
|
479 | qreal value = m_min + (i * (m_max - m_min) / (ticks - 1)); | |
@@ -513,7 +495,6 QStringList ChartAxis::createDateTimeLabels(const QString& format,int ticks) con | |||||
513 | qreal value = m_min + (i * (m_max - m_min)/ (ticks-1)); |
|
495 | qreal value = m_min + (i * (m_max - m_min) / (ticks - 1)); | |
514 | labels << QDateTime::fromMSecsSinceEpoch(value).toString(format); |
|
496 | labels << QDateTime::fromMSecsSinceEpoch(value).toString(format); | |
515 | } |
|
497 | } | |
516 |
|
||||
517 | return labels; |
|
498 | return labels; | |
518 | } |
|
499 | } | |
519 |
|
500 |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
@@ -28,8 +28,10 | |||||
28 |
|
28 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
30 | |||
31 |
ChartDateTimeAxisX::ChartDateTimeAxisX(QDateTimeAxis *axis,ChartPresenter *presenter) |
|
31 | ChartDateTimeAxisX::ChartDateTimeAxisX(QDateTimeAxis *axis, ChartPresenter *presenter) | |
32 | m_tickCount(0),m_axis(axis) |
|
32 | : HorizontalAxis(axis, presenter), | |
|
33 | m_tickCount(0), | |||
|
34 | m_axis(axis) | |||
33 | { |
|
35 | { | |
34 | } |
|
36 | } | |
35 |
|
37 | |||
@@ -55,7 +57,8 QVector<qreal> ChartDateTimeAxisX::calculateLayout() const | |||||
55 | void ChartDateTimeAxisX::updateGeometry() |
|
57 | void ChartDateTimeAxisX::updateGeometry() | |
56 | { |
|
58 | { | |
57 | const QVector<qreal>& layout = ChartAxis::layout(); |
|
59 | const QVector<qreal>& layout = ChartAxis::layout(); | |
58 |
if(layout.isEmpty()) |
|
60 | if (layout.isEmpty()) | |
|
61 | return; | |||
59 | setLabels(createDateTimeLabels(m_axis->format(),layout.size())); |
|
62 | setLabels(createDateTimeLabels(m_axis->format(), layout.size())); | |
60 | HorizontalAxis::updateGeometry(); |
|
63 | HorizontalAxis::updateGeometry(); | |
61 | } |
|
64 | } | |
@@ -80,15 +83,14 QSizeF ChartDateTimeAxisX::sizeHint(Qt::SizeHint which, const QSizeF& constraint | |||||
80 |
|
|
83 | case Qt::PreferredSize: { | |
81 |
|
84 | |||
82 |
|
|
85 | const QVector<qreal>& layout = ChartAxis::layout(); | |
83 |
|
|
86 | if (layout.isEmpty()) | |
|
87 | break; | |||
84 |
|
|
88 | QStringList ticksList; | |
85 |
|
89 | |||
86 |
|
||||
87 |
|
|
90 | qreal width = 0; | |
88 |
|
|
91 | qreal height = 0; | |
89 |
|
92 | |||
90 |
|
|
93 | for (int i = 0; i < ticksList.size(); ++i) { | |
91 | { |
|
|||
92 |
|
|
94 | QRectF rect = fn.boundingRect(ticksList.at(i)); | |
93 |
|
|
95 | width += rect.width(); | |
94 |
|
|
96 | height += qMax(rect.height() + labelPadding(), height); |
@@ -28,8 +28,10 | |||||
28 |
|
28 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
30 | |||
31 |
ChartDateTimeAxisY::ChartDateTimeAxisY(QDateTimeAxis *axis,ChartPresenter *presenter) |
|
31 | ChartDateTimeAxisY::ChartDateTimeAxisY(QDateTimeAxis *axis, ChartPresenter *presenter) | |
32 | m_tickCount(0),m_axis(axis) |
|
32 | : VerticalAxis(axis, presenter), | |
|
33 | m_tickCount(0), | |||
|
34 | m_axis(axis) | |||
33 | { |
|
35 | { | |
34 | } |
|
36 | } | |
35 |
|
37 | |||
@@ -56,7 +58,8 QVector<qreal> ChartDateTimeAxisY::calculateLayout() const | |||||
56 | void ChartDateTimeAxisY::updateGeometry() |
|
58 | void ChartDateTimeAxisY::updateGeometry() | |
57 | { |
|
59 | { | |
58 | const QVector<qreal> &layout = ChartAxis::layout(); |
|
60 | const QVector<qreal> &layout = ChartAxis::layout(); | |
59 |
if(layout.isEmpty()) |
|
61 | if (layout.isEmpty()) | |
|
62 | return; | |||
60 | setLabels(createDateTimeLabels(m_axis->format(),layout.size())); |
|
63 | setLabels(createDateTimeLabels(m_axis->format(), layout.size())); | |
61 | VerticalAxis::updateGeometry(); |
|
64 | VerticalAxis::updateGeometry(); | |
62 | } |
|
65 | } | |
@@ -84,12 +87,10 QSizeF ChartDateTimeAxisY::sizeHint(Qt::SizeHint which, const QSizeF& constraint | |||||
84 |
|
|
87 | if (layout.isEmpty()) break; | |
85 |
|
|
88 | QStringList ticksList; | |
86 |
|
89 | |||
87 |
|
||||
88 |
|
|
90 | qreal width = 0; | |
89 |
|
|
91 | qreal height = 0; | |
90 |
|
92 | |||
91 |
|
|
93 | for (int i = 0; i < ticksList.size(); ++i) { | |
92 | { |
|
|||
93 |
|
|
94 | QRectF rect = fn.boundingRect(ticksList.at(i)); | |
94 |
|
|
95 | width += rect.width(); | |
95 |
|
|
96 | height += qMax(rect.height() + labelPadding(), height); |
@@ -25,7 +25,8 | |||||
25 |
|
25 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
27 | |||
28 |
HorizontalAxis::HorizontalAxis(QAbstractAxis *axis, ChartPresenter *presenter,bool intervalAxis) |
|
28 | HorizontalAxis::HorizontalAxis(QAbstractAxis *axis, ChartPresenter *presenter, bool intervalAxis) | |
|
29 | : ChartAxis(axis, presenter, intervalAxis) | |||
29 | { |
|
30 | { | |
30 | } |
|
31 | } | |
31 |
|
32 | |||
@@ -37,7 +38,8 void HorizontalAxis::updateGeometry() | |||||
37 | { |
|
38 | { | |
38 | const QVector<qreal>& layout = ChartAxis::layout(); |
|
39 | const QVector<qreal>& layout = ChartAxis::layout(); | |
39 |
|
40 | |||
40 |
if(layout.isEmpty()) |
|
41 | if (layout.isEmpty()) | |
|
42 | return; | |||
41 |
|
43 | |||
42 | QStringList ticksList = labels(); |
|
44 | QStringList ticksList = labels(); | |
43 |
|
45 | |||
@@ -98,8 +100,7 void HorizontalAxis::updateGeometry() | |||||
98 | labelItem->setVisible(false); |
|
100 | labelItem->setVisible(false); | |
99 | gridItem->setVisible(false); |
|
101 | gridItem->setVisible(false); | |
100 | tickItem->setVisible(false); |
|
102 | tickItem->setVisible(false); | |
101 | } |
|
103 | } else { | |
102 | else { |
|
|||
103 | labelItem->setVisible(true); |
|
104 | labelItem->setVisible(true); | |
104 | gridItem->setVisible(true); |
|
105 | gridItem->setVisible(true); | |
105 | tickItem->setVisible(true); |
|
106 | tickItem->setVisible(true); |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
@@ -260,8 +260,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
260 | QChart when axis added. |
|
260 | QChart when axis added. | |
261 | */ |
|
261 | */ | |
262 |
|
262 | |||
263 |
QAbstractAxis::QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent) |
|
263 | QAbstractAxis::QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent) | |
264 | QObject(parent), |
|
264 | : QObject(parent), | |
265 | d_ptr(&d) |
|
265 | d_ptr(&d) | |
266 | { |
|
266 | { | |
267 | } |
|
267 | } | |
@@ -272,7 +272,8 d_ptr(&d) | |||||
272 |
|
272 | |||
273 | QAbstractAxis::~QAbstractAxis() |
|
273 | QAbstractAxis::~QAbstractAxis() | |
274 | { |
|
274 | { | |
275 | if(d_ptr->m_dataset) qFatal("Still binded axis detected !"); |
|
275 | if (d_ptr->m_dataset) | |
|
276 | qFatal("Still binded axis detected !"); | |||
276 | } |
|
277 | } | |
277 |
|
278 | |||
278 | /*! |
|
279 | /*! | |
@@ -705,8 +706,8 void QAbstractAxis::setAlignment(Qt::Alignment alignment) | |||||
705 |
|
706 | |||
706 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
707 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
707 |
|
708 | |||
708 |
QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis* |
|
709 | QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis *q) | |
709 | q_ptr(q), |
|
710 | : q_ptr(q), | |
710 | m_orientation(Qt::Orientation(0)), |
|
711 | m_orientation(Qt::Orientation(0)), | |
711 | m_alignment(0), |
|
712 | m_alignment(0), | |
712 | m_dataset(0), |
|
713 | m_dataset(0), |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
@@ -30,7 +30,8 | |||||
30 |
|
30 | |||
31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
32 |
|
32 | |||
33 |
ChartValueAxisX::ChartValueAxisX(QValueAxis *axis,ChartPresenter *presenter) |
|
33 | ChartValueAxisX::ChartValueAxisX(QValueAxis *axis, ChartPresenter *presenter) | |
|
34 | : HorizontalAxis(axis, presenter), | |||
34 | m_tickCount(0),m_axis(axis) |
|
35 | m_tickCount(0), m_axis(axis) | |
35 | { |
|
36 | { | |
36 | } |
|
37 | } | |
@@ -58,7 +59,8 QVector<qreal> ChartValueAxisX::calculateLayout() const | |||||
58 | void ChartValueAxisX::updateGeometry() |
|
59 | void ChartValueAxisX::updateGeometry() | |
59 | { |
|
60 | { | |
60 | const QVector<qreal>& layout = ChartAxis::layout(); |
|
61 | const QVector<qreal>& layout = ChartAxis::layout(); | |
61 |
if(layout.isEmpty()) |
|
62 | if (layout.isEmpty()) | |
|
63 | return; | |||
62 | setLabels(createValueLabels(layout.size())); |
|
64 | setLabels(createValueLabels(layout.size())); | |
63 | HorizontalAxis::updateGeometry(); |
|
65 | HorizontalAxis::updateGeometry(); | |
64 | } |
|
66 | } | |
@@ -96,8 +98,7 QSizeF ChartValueAxisX::sizeHint(Qt::SizeHint which, const QSizeF& constraint) c | |||||
96 | break; |
|
98 | break; | |
97 | } |
|
99 | } | |
98 | case Qt::PreferredSize:{ |
|
100 | case Qt::PreferredSize: { | |
99 | for (int i = 0; i < ticksList.size(); ++i) |
|
101 | for (int i = 0; i < ticksList.size(); ++i) { | |
100 | { |
|
|||
101 | width+=fn.averageCharWidth()*ticksList.at(i).count(); |
|
102 | width += fn.averageCharWidth() * ticksList.at(i).count(); | |
102 | } |
|
103 | } | |
103 | height=fn.height()+labelPadding(); |
|
104 | height = fn.height() + labelPadding(); |
@@ -29,8 +29,10 | |||||
29 |
|
29 | |||
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
31 |
|
31 | |||
32 |
ChartValueAxisY::ChartValueAxisY(QValueAxis *axis,ChartPresenter *presenter) |
|
32 | ChartValueAxisY::ChartValueAxisY(QValueAxis *axis, ChartPresenter *presenter) | |
33 | m_tickCount(0),m_axis(axis) |
|
33 | : VerticalAxis(axis, presenter), | |
|
34 | m_tickCount(0), | |||
|
35 | m_axis(axis) | |||
34 | { |
|
36 | { | |
35 | } |
|
37 | } | |
36 |
|
38 | |||
@@ -59,7 +61,8 QVector<qreal> ChartValueAxisY::calculateLayout() const | |||||
59 | void ChartValueAxisY::updateGeometry() |
|
61 | void ChartValueAxisY::updateGeometry() | |
60 | { |
|
62 | { | |
61 | const QVector<qreal> &layout = ChartAxis::layout(); |
|
63 | const QVector<qreal> &layout = ChartAxis::layout(); | |
62 |
if(layout.isEmpty()) |
|
64 | if (layout.isEmpty()) | |
|
65 | return; | |||
63 | setLabels(createValueLabels(layout.size())); |
|
66 | setLabels(createValueLabels(layout.size())); | |
64 | VerticalAxis::updateGeometry(); |
|
67 | VerticalAxis::updateGeometry(); | |
65 | } |
|
68 | } | |
@@ -95,10 +98,8 QSizeF ChartValueAxisY::sizeHint(Qt::SizeHint which, const QSizeF& constraint) c | |||||
95 | sh = QSizeF(width,height); |
|
98 | sh = QSizeF(width, height); | |
96 | break; |
|
99 | break; | |
97 | } |
|
100 | } | |
98 | case Qt::PreferredSize: |
|
101 | case Qt::PreferredSize: { | |
99 | { |
|
102 | for (int i = 0; i < ticksList.size(); ++i) { | |
100 | for (int i = 0; i < ticksList.size(); ++i) |
|
|||
101 | { |
|
|||
102 | width=qMax(qreal(fn.averageCharWidth()*ticksList.at(i).count())+labelPadding(),width); |
|
103 | width = qMax(qreal(fn.averageCharWidth() * ticksList.at(i).count()) + labelPadding(), width); | |
103 | height+=fn.height(); |
|
104 | height += fn.height(); | |
104 | } |
|
105 | } |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
@@ -24,7 +24,8 | |||||
24 |
|
24 | |||
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
26 |
|
26 | |||
27 |
VerticalAxis::VerticalAxis(QAbstractAxis *axis, ChartPresenter *presenter, bool intervalAxis) |
|
27 | VerticalAxis::VerticalAxis(QAbstractAxis *axis, ChartPresenter *presenter, bool intervalAxis) | |
|
28 | : ChartAxis(axis, presenter, intervalAxis) | |||
28 | { |
|
29 | { | |
29 |
|
30 | |||
30 | } |
|
31 | } | |
@@ -38,7 +39,8 void VerticalAxis::updateGeometry() | |||||
38 | { |
|
39 | { | |
39 | const QVector<qreal> &layout = ChartAxis::layout(); |
|
40 | const QVector<qreal> &layout = ChartAxis::layout(); | |
40 |
|
41 | |||
41 |
if(layout.isEmpty()) |
|
42 | if (layout.isEmpty()) | |
|
43 | return; | |||
42 |
|
44 | |||
43 | QStringList labelList = labels(); |
|
45 | QStringList labelList = labels(); | |
44 |
|
46 | |||
@@ -75,14 +77,12 void VerticalAxis::updateGeometry() | |||||
75 |
|
77 | |||
76 | //label text |
|
78 | //label text | |
77 | QString text = labelList.at(i); |
|
79 | QString text = labelList.at(i); | |
78 |
if (fn.boundingRect(text).width() > axisRect.right() - axisRect.left() - labelPadding() |
|
80 | if (fn.boundingRect(text).width() > axisRect.right() - axisRect.left() - labelPadding()) { | |
79 | { |
|
|||
80 | QString label = text + "..."; |
|
81 | QString label = text + "..."; | |
81 | while (fn.boundingRect(label).width() > axisRect.right() - axisRect.left() - labelPadding() && label.length() > 3) |
|
82 | while (fn.boundingRect(label).width() > axisRect.right() - axisRect.left() - labelPadding() && label.length() > 3) | |
82 | label.remove(label.length() - 4, 1); |
|
83 | label.remove(label.length() - 4, 1); | |
83 | labelItem->setText(label); |
|
84 | labelItem->setText(label); | |
84 | } |
|
85 | } else { | |
85 | else { |
|
|||
86 | labelItem->setText(text); |
|
86 | labelItem->setText(text); | |
87 | } |
|
87 | } | |
88 |
const QRectF& |
|
88 | const QRectF &rect = labelItem->boundingRect(); | |
@@ -93,8 +93,7 void VerticalAxis::updateGeometry() | |||||
93 | if (alignment()==Qt::AlignLeft) { |
|
93 | if (alignment() == Qt::AlignLeft) { | |
94 |
labelItem->setPos( |
|
94 | labelItem->setPos(axisRect.right() - rect.width() - labelPadding() , layout[i] - center.y()); | |
95 |
tickItem->setLine( |
|
95 | tickItem->setLine(axisRect.right() - labelPadding(), layout[i], axisRect.right(), layout[i]); | |
96 | } |
|
96 | } else if (alignment() == Qt::AlignRight) { | |
97 | else if(alignment()==Qt::AlignRight) { |
|
|||
98 |
labelItem->setPos( |
|
97 | labelItem->setPos(axisRect.left() + labelPadding() , layout[i] - center.y()); | |
99 |
tickItem->setLine( |
|
98 | tickItem->setLine(axisRect.left(), layout[i], axisRect.left() + labelPadding(), layout[i]); | |
100 | } |
|
99 | } | |
@@ -110,8 +109,7 void VerticalAxis::updateGeometry() | |||||
110 | labelItem->setVisible(false); |
|
109 | labelItem->setVisible(false); | |
111 | gridItem->setVisible(false); |
|
110 | gridItem->setVisible(false); | |
112 | tickItem->setVisible(false); |
|
111 | tickItem->setVisible(false); | |
113 | } |
|
112 | } else { | |
114 | else { |
|
|||
115 | labelItem->setVisible(true); |
|
113 | labelItem->setVisible(true); | |
116 | gridItem->setVisible(true); |
|
114 | gridItem->setVisible(true); | |
117 | height=labelItem->pos().y(); |
|
115 | height = labelItem->pos().y(); |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
@@ -31,8 +31,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
31 |
|
31 | |||
32 | static const qreal golden_ratio = 0.25; |
|
32 | static const qreal golden_ratio = 0.25; | |
33 |
|
33 | |||
34 |
ChartLayout::ChartLayout(ChartPresenter* |
|
34 | ChartLayout::ChartLayout(ChartPresenter *presenter) | |
35 | m_presenter(presenter), |
|
35 | : m_presenter(presenter), | |
36 | m_margins(20,20,20,20), |
|
36 | m_margins(20, 20, 20, 20), | |
37 | m_minChartRect(0,0,200,200) |
|
37 | m_minChartRect(0, 0, 200, 200) | |
38 | { |
|
38 | { | |
@@ -59,13 +59,11 void ChartLayout::setGeometry(const QRectF& rect) | |||||
59 |
|
59 | |||
60 | contentGeometry = calculateContentGeometry(contentGeometry); |
|
60 | contentGeometry = calculateContentGeometry(contentGeometry); | |
61 |
|
61 | |||
62 |
if (title && title->isVisible()) |
|
62 | if (title && title->isVisible()) | |
63 | contentGeometry = calculateTitleGeometry(contentGeometry,title); |
|
63 | contentGeometry = calculateTitleGeometry(contentGeometry, title); | |
64 | } |
|
|||
65 |
|
64 | |||
66 |
if (legend->isAttachedToChart() && legend->isVisible()) |
|
65 | if (legend->isAttachedToChart() && legend->isVisible()) | |
67 | contentGeometry = calculateLegendGeometry(contentGeometry,legend); |
|
66 | contentGeometry = calculateLegendGeometry(contentGeometry, legend); | |
68 | } |
|
|||
69 |
|
67 | |||
70 | contentGeometry = calculateAxisGeometry(contentGeometry,axes); |
|
68 | contentGeometry = calculateAxisGeometry(contentGeometry, axes); | |
71 |
|
69 | |||
@@ -90,7 +88,8 QRectF ChartLayout::calculateBackgroundGeometry(const QRectF& geometry,ChartBack | |||||
90 | qreal left, top, right, bottom; |
|
88 | qreal left, top, right, bottom; | |
91 | getContentsMargins(&left, &top, &right, &bottom); |
|
89 | getContentsMargins(&left, &top, &right, &bottom); | |
92 | QRectF backgroundGeometry = geometry.adjusted(left,top,-right,-bottom); |
|
90 | QRectF backgroundGeometry = geometry.adjusted(left, top, -right, -bottom); | |
93 | if(background) background->setRect(backgroundGeometry); |
|
91 | if (background) | |
|
92 | background->setRect(backgroundGeometry); | |||
94 | return backgroundGeometry; |
|
93 | return backgroundGeometry; | |
95 | } |
|
94 | } | |
96 |
|
95 | |||
@@ -104,7 +103,6 QRectF ChartLayout::calculateBackgroundMinimum(const QRectF& minimum) const | |||||
104 |
|
103 | |||
105 |
QRectF ChartLayout::calculateAxisGeometry(const QRectF& |
|
104 | QRectF ChartLayout::calculateAxisGeometry(const QRectF &geometry, const QList<ChartAxis *>& axes) const | |
106 | { |
|
105 | { | |
107 |
|
||||
108 | QSizeF left; |
|
106 | QSizeF left; | |
109 | QSizeF right; |
|
107 | QSizeF right; | |
110 | QSizeF bottom; |
|
108 | QSizeF bottom; | |
@@ -116,7 +114,8 QRectF ChartLayout::calculateAxisGeometry(const QRectF& geometry, const QList<Ch | |||||
116 |
|
114 | |||
117 |
foreach(ChartAxis* |
|
115 | foreach (ChartAxis *axis , axes) { | |
118 |
|
116 | |||
119 |
if(!axis->isVisible()) |
|
117 | if (!axis->isVisible()) | |
|
118 | continue; | |||
120 |
|
119 | |||
121 | QSizeF size = axis->effectiveSizeHint(Qt::MinimumSize); |
|
120 | QSizeF size = axis->effectiveSizeHint(Qt::MinimumSize); | |
122 |
|
121 | |||
@@ -141,7 +140,6 QRectF ChartLayout::calculateAxisGeometry(const QRectF& geometry, const QList<Ch | |||||
141 | bottom.setHeight(bottom.height() + size.height()); |
|
140 | bottom.setHeight(bottom.height() + size.height()); | |
142 | bottomCount++; |
|
141 | bottomCount++; | |
143 | break; |
|
142 | break; | |
144 |
|
||||
145 | } |
|
143 | } | |
146 | } |
|
144 | } | |
147 |
|
145 | |||
@@ -161,7 +159,8 QRectF ChartLayout::calculateAxisGeometry(const QRectF& geometry, const QList<Ch | |||||
161 |
|
159 | |||
162 | foreach(ChartAxis* axis , axes) { |
|
160 | foreach(ChartAxis * axis , axes) { | |
163 |
|
161 | |||
164 |
if(!axis->isVisible()) |
|
162 | if (!axis->isVisible()) | |
|
163 | continue; | |||
165 |
|
164 | |||
166 | QSizeF size = axis->effectiveSizeHint(Qt::MinimumSize); |
|
165 | QSizeF size = axis->effectiveSizeHint(Qt::MinimumSize); | |
167 |
|
166 | |||
@@ -203,7 +202,8 QRectF ChartLayout::calculateAxisMinimum(const QRectF& minimum, const QList<Char | |||||
203 |
|
202 | |||
204 | QSizeF size = axis->effectiveSizeHint(Qt::MinimumSize); |
|
203 | QSizeF size = axis->effectiveSizeHint(Qt::MinimumSize); | |
205 |
|
204 | |||
206 |
if(!axis->isVisible()) |
|
205 | if (!axis->isVisible()) | |
|
206 | continue; | |||
207 |
|
207 | |||
208 | switch(axis->alignment()) { |
|
208 | switch (axis->alignment()) { | |
209 |
|
|
209 | case Qt::AlignLeft: | |
@@ -272,12 +272,8 QRectF ChartLayout::calculateLegendGeometry(const QRectF& geometry,QLegend* lege | |||||
272 |
QRectF ChartLayout::calculateChartsGeometry(const QRectF& |
|
272 | QRectF ChartLayout::calculateChartsGeometry(const QRectF &geometry, const QList<ChartElement *>& charts) const | |
273 | { |
|
273 | { | |
274 | Q_ASSERT(geometry.isValid()); |
|
274 | Q_ASSERT(geometry.isValid()); | |
275 |
|
||||
276 |
foreach(ChartElement* |
|
275 | foreach (ChartElement *chart, charts) | |
277 | { |
|
|||
278 | chart->handleGeometryChanged(geometry); |
|
276 | chart->handleGeometryChanged(geometry); | |
279 | } |
|
|||
280 |
|
||||
281 | return geometry; |
|
277 | return geometry; | |
282 | } |
|
278 | } | |
283 |
|
279 | |||
@@ -315,7 +311,7 QSizeF ChartLayout::sizeHint ( Qt::SizeHint which, const QSizeF & constraint) co | |||||
315 | minimumRect = calculateLegendMinimum(minimumRect,legend); |
|
311 | minimumRect = calculateLegendMinimum(minimumRect, legend); | |
316 | minimumRect = calculateAxisMinimum(minimumRect,axes); |
|
312 | minimumRect = calculateAxisMinimum(minimumRect, axes); | |
317 | return minimumRect.united(m_minChartRect).size().toSize(); |
|
313 | return minimumRect.united(m_minChartRect).size().toSize(); | |
318 |
} |
|
314 | } | |
319 |
|
|
315 | return QSize(-1, -1); | |
320 | } |
|
316 | } | |
321 |
|
317 |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
@@ -35,7 +35,8 | |||||
35 |
|
35 | |||
36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
37 |
|
37 | |||
38 |
ChartPresenter::ChartPresenter(QChart* |
|
38 | ChartPresenter::ChartPresenter(QChart *chart, ChartDataSet *dataset) | |
|
39 | : QObject(chart), | |||
39 | m_chart(chart), |
|
40 | m_chart(chart), | |
40 | m_dataset(dataset), |
|
41 | m_dataset(dataset), | |
41 | m_chartTheme(0), |
|
42 | m_chartTheme(0), | |
@@ -58,9 +59,8 void ChartPresenter::handleAxisAdded(QAbstractAxis* axis,Domain* domain) | |||||
58 |
ChartAxis* |
|
59 | ChartAxis *item = axis->d_ptr->createGraphics(this); | |
59 | item->setDomain(domain); |
|
60 | item->setDomain(domain); | |
60 |
|
61 | |||
61 |
if(m_options.testFlag(QChart::GridAxisAnimations)) |
|
62 | if (m_options.testFlag(QChart::GridAxisAnimations)) | |
62 | item->setAnimation(new AxisAnimation(item)); |
|
63 | item->setAnimation(new AxisAnimation(item)); | |
63 | } |
|
|||
64 |
|
64 | |||
65 | QObject::connect(domain,SIGNAL(updated()),item,SLOT(handleDomainUpdated())); |
|
65 | QObject::connect(domain, SIGNAL(updated()), item, SLOT(handleDomainUpdated())); | |
66 | QObject::connect(axis,SIGNAL(visibleChanged(bool)),this,SLOT(handleAxisVisibleChanged(bool))); |
|
66 | QObject::connect(axis, SIGNAL(visibleChanged(bool)), this, SLOT(handleAxisVisibleChanged(bool))); | |
@@ -149,19 +149,18 void ChartPresenter::handleAxisVisibleChanged(bool visible) | |||||
149 |
|
149 | |||
150 | while (i.hasNext()) { |
|
150 | while (i.hasNext()) { | |
151 | i.next(); |
|
151 | i.next(); | |
152 |
if(i.key()==axis) |
|
152 | if (i.key() == axis) | |
153 | continue; |
|
153 | continue; | |
154 | } |
|
154 | if (i.key()->orientation() == axis->orientation()) | |
155 | if(i.key()->orientation()==axis->orientation()) { |
|
|||
156 | i.key()->setVisible(false); |
|
155 | i.key()->setVisible(false); | |
157 | } |
|
156 | } | |
158 |
|
|
157 | } | |
159 | } |
|
158 | } | |
160 | } |
|
|||
161 |
|
159 | |||
162 | void ChartPresenter::setTheme(QChart::ChartTheme theme,bool force) |
|
160 | void ChartPresenter::setTheme(QChart::ChartTheme theme, bool force) | |
163 | { |
|
161 | { | |
164 |
if(m_chartTheme && m_chartTheme->id() == theme) |
|
162 | if (m_chartTheme && m_chartTheme->id() == theme) | |
|
163 | return; | |||
165 | delete m_chartTheme; |
|
164 | delete m_chartTheme; | |
166 | m_chartTheme = ChartTheme::createTheme(theme); |
|
165 | m_chartTheme = ChartTheme::createTheme(theme); | |
167 | m_chartTheme->setForced(force); |
|
166 | m_chartTheme->setForced(force); | |
@@ -288,16 +287,16 void ChartPresenter::createTitleItem() | |||||
288 | void ChartPresenter::handleAnimationFinished() |
|
287 | void ChartPresenter::handleAnimationFinished() | |
289 | { |
|
288 | { | |
290 | m_animations.removeAll(qobject_cast<ChartAnimation*>(sender())); |
|
289 | m_animations.removeAll(qobject_cast<ChartAnimation *>(sender())); | |
291 |
if(m_animations.empty()) |
|
290 | if (m_animations.empty()) | |
|
291 | emit animationsFinished(); | |||
292 | } |
|
292 | } | |
293 |
|
293 | |||
294 |
void ChartPresenter::startAnimation(ChartAnimation* |
|
294 | void ChartPresenter::startAnimation(ChartAnimation *animation) | |
295 | { |
|
295 | { | |
296 | if (animation->state() != QAbstractAnimation::Stopped) animation->stop(); |
|
296 | if (animation->state() != QAbstractAnimation::Stopped) animation->stop(); | |
297 | QObject::connect(animation, SIGNAL(finished()),this,SLOT(handleAnimationFinished()),Qt::UniqueConnection); |
|
297 | QObject::connect(animation, SIGNAL(finished()), this, SLOT(handleAnimationFinished()), Qt::UniqueConnection); | |
298 |
if(!m_animations.isEmpty()) |
|
298 | if (!m_animations.isEmpty()) | |
299 | m_animations.append(animation); |
|
299 | m_animations.append(animation); | |
300 | } |
|
|||
301 | QTimer::singleShot(0, animation, SLOT(start())); |
|
300 | QTimer::singleShot(0, animation, SLOT(start())); | |
302 | } |
|
301 | } | |
303 |
|
302 | |||
@@ -310,7 +309,8 void ChartPresenter::setBackgroundBrush(const QBrush& brush) | |||||
310 |
|
309 | |||
311 | QBrush ChartPresenter::backgroundBrush() const |
|
310 | QBrush ChartPresenter::backgroundBrush() const | |
312 | { |
|
311 | { | |
313 |
if (!m_background) |
|
312 | if (!m_background) | |
|
313 | return QBrush(); | |||
314 | return m_background->brush(); |
|
314 | return m_background->brush(); | |
315 | } |
|
315 | } | |
316 |
|
316 | |||
@@ -323,7 +323,8 void ChartPresenter::setBackgroundPen(const QPen& pen) | |||||
323 |
|
323 | |||
324 | QPen ChartPresenter::backgroundPen() const |
|
324 | QPen ChartPresenter::backgroundPen() const | |
325 | { |
|
325 | { | |
326 |
if (!m_background) |
|
326 | if (!m_background) | |
|
327 | return QPen(); | |||
327 | return m_background->pen(); |
|
328 | return m_background->pen(); | |
328 | } |
|
329 | } | |
329 |
|
330 | |||
@@ -336,7 +337,8 void ChartPresenter::setTitle(const QString& title) | |||||
336 |
|
337 | |||
337 | QString ChartPresenter::title() const |
|
338 | QString ChartPresenter::title() const | |
338 | { |
|
339 | { | |
339 |
if (!m_title) |
|
340 | if (!m_title) | |
|
341 | return QString(); | |||
340 | return m_title->text(); |
|
342 | return m_title->text(); | |
341 | } |
|
343 | } | |
342 |
|
344 | |||
@@ -349,7 +351,8 void ChartPresenter::setTitleFont(const QFont& font) | |||||
349 |
|
351 | |||
350 | QFont ChartPresenter::titleFont() const |
|
352 | QFont ChartPresenter::titleFont() const | |
351 | { |
|
353 | { | |
352 |
if (!m_title) |
|
354 | if (!m_title) | |
|
355 | return QFont(); | |||
353 | return m_title->font(); |
|
356 | return m_title->font(); | |
354 | } |
|
357 | } | |
355 |
|
358 | |||
@@ -362,7 +365,8 void ChartPresenter::setTitleBrush(const QBrush &brush) | |||||
362 |
|
365 | |||
363 | QBrush ChartPresenter::titleBrush() const |
|
366 | QBrush ChartPresenter::titleBrush() const | |
364 | { |
|
367 | { | |
365 |
if (!m_title) |
|
368 | if (!m_title) | |
|
369 | return QBrush(); | |||
366 | return m_title->brush(); |
|
370 | return m_title->brush(); | |
367 | } |
|
371 | } | |
368 |
|
372 | |||
@@ -375,7 +379,8 void ChartPresenter::setBackgroundVisible(bool visible) | |||||
375 |
|
379 | |||
376 | bool ChartPresenter::isBackgroundVisible() const |
|
380 | bool ChartPresenter::isBackgroundVisible() const | |
377 | { |
|
381 | { | |
378 |
if (!m_background) |
|
382 | if (!m_background) | |
|
383 | return false; | |||
379 | return m_background->isVisible(); |
|
384 | return m_background->isVisible(); | |
380 | } |
|
385 | } | |
381 |
|
386 | |||
@@ -387,7 +392,8 void ChartPresenter::setBackgroundDropShadowEnabled(bool enabled) | |||||
387 |
|
392 | |||
388 | bool ChartPresenter::isBackgroundDropShadowEnabled() const |
|
393 | bool ChartPresenter::isBackgroundDropShadowEnabled() const | |
389 | { |
|
394 | { | |
390 |
if (!m_background) |
|
395 | if (!m_background) | |
|
396 | return false; | |||
391 | return m_background->isDropShadowEnabled(); |
|
397 | return m_background->isDropShadowEnabled(); | |
392 | } |
|
398 | } | |
393 |
|
399 |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
@@ -26,8 +26,8 | |||||
26 |
|
26 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
28 | |||
29 |
QPieModelMapper::QPieModelMapper(QObject *parent) |
|
29 | QPieModelMapper::QPieModelMapper(QObject *parent) | |
30 | QObject(parent), |
|
30 | : QObject(parent), | |
31 | d_ptr(new QPieModelMapperPrivate(this)) |
|
31 | d_ptr(new QPieModelMapperPrivate(this)) | |
32 | { |
|
32 | { | |
33 | } |
|
33 | } |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
@@ -104,7 +104,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
104 | /*! |
|
104 | /*! | |
105 | Constructs a chart object which is a child of a\a parent. Parameter \a wFlags is passed to the QGraphicsWidget constructor. |
|
105 | Constructs a chart object which is a child of a\a parent. Parameter \a wFlags is passed to the QGraphicsWidget constructor. | |
106 | */ |
|
106 | */ | |
107 |
QChart::QChart(QGraphicsItem *parent, Qt::WindowFlags wFlags) |
|
107 | QChart::QChart(QGraphicsItem *parent, Qt::WindowFlags wFlags) | |
|
108 | : QGraphicsWidget(parent, wFlags), | |||
108 | d_ptr(new QChartPrivate()) |
|
109 | d_ptr(new QChartPrivate()) | |
109 | { |
|
110 | { | |
110 | d_ptr->m_dataset = new ChartDataSet(this); |
|
111 | d_ptr->m_dataset = new ChartDataSet(this); | |
@@ -265,7 +266,8 void QChart::zoomIn() | |||||
265 | */ |
|
266 | */ | |
266 |
void QChart::zoomIn(const QRectF& |
|
267 | void QChart::zoomIn(const QRectF &rect) | |
267 | { |
|
268 | { | |
268 |
if (!rect.isValid()) |
|
269 | if (!rect.isValid()) | |
|
270 | return; | |||
269 | d_ptr->m_presenter->zoomIn(rect); |
|
271 | d_ptr->m_presenter->zoomIn(rect); | |
270 | } |
|
272 | } | |
271 |
|
273 | |||
@@ -457,7 +459,8 QList<QAbstractSeries*> QChart::series() const | |||||
457 | */ |
|
459 | */ | |
458 |
void QChart::setAxisX(QAbstractAxis* |
|
460 | void QChart::setAxisX(QAbstractAxis *axis , QAbstractSeries *series) | |
459 | { |
|
461 | { | |
460 |
if(axis->alignment()==Qt::AlignLeft || axis->alignment()==Qt::AlignRight) |
|
462 | if (axis->alignment() == Qt::AlignLeft || axis->alignment() == Qt::AlignRight) | |
|
463 | return; | |||
461 | d_ptr->m_dataset->setAxis(series,axis,Qt::Horizontal); |
|
464 | d_ptr->m_dataset->setAxis(series, axis, Qt::Horizontal); | |
462 | } |
|
465 | } | |
463 |
|
466 | |||
@@ -468,7 +471,8 void QChart::setAxisX(QAbstractAxis* axis , QAbstractSeries *series) | |||||
468 | */ |
|
471 | */ | |
469 |
void QChart::setAxisY( |
|
472 | void QChart::setAxisY(QAbstractAxis *axis , QAbstractSeries *series) | |
470 | { |
|
473 | { | |
471 |
if(axis->alignment()==Qt::AlignTop || axis->alignment()==Qt::AlignBottom) |
|
474 | if (axis->alignment() == Qt::AlignTop || axis->alignment() == Qt::AlignBottom) | |
|
475 | return; | |||
472 | d_ptr->m_dataset->setAxis(series,axis,Qt::Vertical); |
|
476 | d_ptr->m_dataset->setAxis(series, axis, Qt::Vertical); | |
473 | } |
|
477 | } | |
474 |
|
478 |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
@@ -29,8 +29,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
29 | /*! |
|
29 | /*! | |
30 | Constructs a mapper object which is a child of \a parent. |
|
30 | Constructs a mapper object which is a child of \a parent. | |
31 | */ |
|
31 | */ | |
32 |
QXYModelMapper::QXYModelMapper(QObject *parent) |
|
32 | QXYModelMapper::QXYModelMapper(QObject *parent) | |
33 | QObject(parent), |
|
33 | : QObject(parent), | |
34 | d_ptr(new QXYModelMapperPrivate(this)) |
|
34 | d_ptr(new QXYModelMapperPrivate(this)) | |
35 | { |
|
35 | { | |
36 | } |
|
36 | } |
General Comments 0
You need to be logged in to leave comments.
Login now