@@ -19,7 +19,7 | |||||
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "chart.h" |
|
21 | #include "chart.h" | |
22 |
#include <Q |
|
22 | #include <QAxis> | |
23 | #include <QSplineSeries> |
|
23 | #include <QSplineSeries> | |
24 | #include <QTime> |
|
24 | #include <QTime> | |
25 |
|
25 |
@@ -60,8 +60,8 int main(int argc, char *argv[]) | |||||
60 | //![2] |
|
60 | //![2] | |
61 |
|
61 | |||
62 | //![3] |
|
62 | //![3] | |
63 |
Q |
|
63 | QAxis* axisX = chart->axisX(); | |
64 |
Q |
|
64 | QAxis* axisY = chart->axisY(); | |
65 |
|
65 | |||
66 | // Customize axis label font |
|
66 | // Customize axis label font | |
67 | QFont labelsFont; |
|
67 | QFont labelsFont; |
@@ -19,7 +19,7 | |||||
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "drilldownchart.h" |
|
21 | #include "drilldownchart.h" | |
22 |
#include <Q |
|
22 | #include <QAxis> | |
23 |
|
23 | |||
24 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
24 | QTCOMMERCIALCHART_USE_NAMESPACE | |
25 |
|
25 |
@@ -26,7 +26,7 Q_DECLARE_METATYPE(QVector<qreal>) | |||||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
27 | |||
28 |
|
28 | |||
29 | AxisAnimation::AxisAnimation(Axis *axis): ChartAnimation(axis), |
|
29 | AxisAnimation::AxisAnimation(ChartAxis *axis): ChartAnimation(axis), | |
30 | m_axis(axis) |
|
30 | m_axis(axis) | |
31 | { |
|
31 | { | |
32 | } |
|
32 | } |
@@ -21,7 +21,7 | |||||
21 | #ifndef AXISANIMATION_H |
|
21 | #ifndef AXISANIMATION_H | |
22 | #define AXISANIMATION_H |
|
22 | #define AXISANIMATION_H | |
23 |
|
23 | |||
24 | #include "axis_p.h" |
|
24 | #include "chartaxis_p.h" | |
25 | #include "chartanimation_p.h" |
|
25 | #include "chartanimation_p.h" | |
26 |
|
26 | |||
27 |
|
27 | |||
@@ -30,13 +30,13 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
30 | class AxisAnimation: public ChartAnimation |
|
30 | class AxisAnimation: public ChartAnimation | |
31 | { |
|
31 | { | |
32 | public: |
|
32 | public: | |
33 | AxisAnimation(Axis *axis); |
|
33 | AxisAnimation(ChartAxis *axis); | |
34 | ~AxisAnimation(); |
|
34 | ~AxisAnimation(); | |
35 | protected: |
|
35 | protected: | |
36 | QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress ) const; |
|
36 | QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress ) const; | |
37 | void updateCurrentValue(const QVariant &value ); |
|
37 | void updateCurrentValue(const QVariant &value ); | |
38 | private: |
|
38 | private: | |
39 | Axis *m_axis; |
|
39 | ChartAxis *m_axis; | |
40 | }; |
|
40 | }; | |
41 |
|
41 | |||
42 | QTCOMMERCIALCHART_END_NAMESPACE |
|
42 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -48,7 +48,7 ChartAnimator::~ChartAnimator() | |||||
48 | { |
|
48 | { | |
49 | } |
|
49 | } | |
50 |
|
50 | |||
51 | void ChartAnimator::addAnimation(Axis *item) |
|
51 | void ChartAnimator::addAnimation(ChartAxis *item) | |
52 | { |
|
52 | { | |
53 | ChartAnimation *animation = m_animations.value(item); |
|
53 | ChartAnimation *animation = m_animations.value(item); | |
54 |
|
54 | |||
@@ -127,7 +127,7 void ChartAnimator::removeAnimation(Chart *item) | |||||
127 | m_animations.remove(item); |
|
127 | m_animations.remove(item); | |
128 | } |
|
128 | } | |
129 |
|
129 | |||
130 | void ChartAnimator::updateLayout(Axis *item , QVector<qreal> &newLayout) |
|
130 | void ChartAnimator::updateLayout(ChartAxis *item , QVector<qreal> &newLayout) | |
131 | { |
|
131 | { | |
132 | AxisAnimation *animation = static_cast<AxisAnimation*>(m_animations.value(item)); |
|
132 | AxisAnimation *animation = static_cast<AxisAnimation*>(m_animations.value(item)); | |
133 |
|
133 | |||
@@ -144,13 +144,13 void ChartAnimator::updateLayout(Axis *item , QVector<qreal> &newLayout) | |||||
144 | oldLayout.resize(newLayout.count()); |
|
144 | oldLayout.resize(newLayout.count()); | |
145 |
|
145 | |||
146 | for(int i = 0, j = oldLayout.count() - 1; i < (oldLayout.count() + 1) / 2; ++i, --j) { |
|
146 | for(int i = 0, j = oldLayout.count() - 1; i < (oldLayout.count() + 1) / 2; ++i, --j) { | |
147 | oldLayout[i] = item->axisType() == Axis::X_AXIS ? rect.left() : rect.bottom(); |
|
147 | oldLayout[i] = item->axisType() == ChartAxis::X_AXIS ? rect.left() : rect.bottom(); | |
148 | oldLayout[j] = item->axisType() == Axis::X_AXIS ? rect.right() : rect.top(); |
|
148 | oldLayout[j] = item->axisType() == ChartAxis::X_AXIS ? rect.right() : rect.top(); | |
149 | } |
|
149 | } | |
150 | } |
|
150 | } | |
151 | break; |
|
151 | break; | |
152 | case ZoomInState: { |
|
152 | case ZoomInState: { | |
153 | int index = qMin(oldLayout.count() * (item->axisType() == Axis::X_AXIS ? m_point.x() : (1 - m_point.y())), newLayout.count() - 1.0); |
|
153 | int index = qMin(oldLayout.count() * (item->axisType() == ChartAxis::X_AXIS ? m_point.x() : (1 - m_point.y())), newLayout.count() - 1.0); | |
154 | oldLayout.resize(newLayout.count()); |
|
154 | oldLayout.resize(newLayout.count()); | |
155 |
|
155 | |||
156 | for(int i = 0; i < oldLayout.count(); i++) |
|
156 | for(int i = 0; i < oldLayout.count(); i++) | |
@@ -177,7 +177,7 void ChartAnimator::updateLayout(Axis *item , QVector<qreal> &newLayout) | |||||
177 | oldLayout.resize(newLayout.count()); |
|
177 | oldLayout.resize(newLayout.count()); | |
178 | QRectF rect = item->geometry(); |
|
178 | QRectF rect = item->geometry(); | |
179 | for(int i = 0, j = oldLayout.count() - 1; i < oldLayout.count(); ++i, --j) |
|
179 | for(int i = 0, j = oldLayout.count() - 1; i < oldLayout.count(); ++i, --j) | |
180 | oldLayout[i] = item->axisType() == Axis::X_AXIS ? rect.left() : rect.top(); |
|
180 | oldLayout[i] = item->axisType() == ChartAxis::X_AXIS ? rect.left() : rect.top(); | |
181 | } |
|
181 | } | |
182 | break; |
|
182 | break; | |
183 | } |
|
183 | } |
@@ -30,7 +30,7 | |||||
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
31 |
|
31 | |||
32 | class ChartItem; |
|
32 | class ChartItem; | |
33 | class Axis; |
|
33 | class ChartAxis; | |
34 | class AreaChartItem; |
|
34 | class AreaChartItem; | |
35 | class SplineChartItem; |
|
35 | class SplineChartItem; | |
36 | class ScatterChartItem; |
|
36 | class ScatterChartItem; | |
@@ -46,7 +46,7 public: | |||||
46 | ChartAnimator(QObject *parent = 0); |
|
46 | ChartAnimator(QObject *parent = 0); | |
47 | virtual ~ChartAnimator(); |
|
47 | virtual ~ChartAnimator(); | |
48 |
|
48 | |||
49 | void addAnimation(Axis *item); |
|
49 | void addAnimation(ChartAxis *item); | |
50 | void addAnimation(PieChartItem *item); |
|
50 | void addAnimation(PieChartItem *item); | |
51 | void addAnimation(ScatterChartItem *item); |
|
51 | void addAnimation(ScatterChartItem *item); | |
52 | void addAnimation(LineChartItem *item); |
|
52 | void addAnimation(LineChartItem *item); | |
@@ -57,7 +57,7 public: | |||||
57 | void animationStarted(); |
|
57 | void animationStarted(); | |
58 | void updateLayout(XYChartItem *item, QVector<QPointF> &oldLayout, QVector<QPointF> &newLayout, int index); |
|
58 | void updateLayout(XYChartItem *item, QVector<QPointF> &oldLayout, QVector<QPointF> &newLayout, int index); | |
59 | void updateLayout(SplineChartItem *item, QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, QVector<QPointF> &oldControlPoints, QVector<QPointF> &newContorlPoints, int index); |
|
59 | void updateLayout(SplineChartItem *item, QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, QVector<QPointF> &oldControlPoints, QVector<QPointF> &newContorlPoints, int index); | |
60 | void updateLayout(Axis *item, QVector<qreal> &layout); |
|
60 | void updateLayout(ChartAxis *item, QVector<qreal> &layout); | |
61 |
|
61 | |||
62 | void addAnimation(PieChartItem *item, QPieSlice *slice, const PieSliceData &sliceData, bool isEmpty); |
|
62 | void addAnimation(PieChartItem *item, QPieSlice *slice, const PieSliceData &sliceData, bool isEmpty); | |
63 | void removeAnimation(PieChartItem *item, QPieSlice *slice); |
|
63 | void removeAnimation(PieChartItem *item, QPieSlice *slice); |
@@ -2,15 +2,15 INCLUDEPATH += $$PWD | |||||
2 | DEPENDPATH += $$PWD |
|
2 | DEPENDPATH += $$PWD | |
3 |
|
3 | |||
4 | SOURCES += \ |
|
4 | SOURCES += \ | |
5 | $$PWD/axis.cpp \ |
|
5 | $$PWD/chartaxis.cpp \ | |
6 |
$$PWD/q |
|
6 | $$PWD/qaxis.cpp \ | |
7 | $$PWD/qchartaxiscategories.cpp |
|
7 | $$PWD/qchartaxiscategories.cpp | |
8 |
|
8 | |||
9 | PRIVATE_HEADERS += \ |
|
9 | PRIVATE_HEADERS += \ | |
10 | $$PWD/axis_p.h \ |
|
10 | $$PWD/chartaxis_p.h \ | |
11 |
$$PWD/q |
|
11 | $$PWD/qaxis_p.h \ | |
12 | $$PWD/qchartaxiscategories_p.h |
|
12 | $$PWD/qchartaxiscategories_p.h | |
13 |
|
13 | |||
14 | PUBLIC_HEADERS += \ |
|
14 | PUBLIC_HEADERS += \ | |
15 |
$$PWD/q |
|
15 | $$PWD/qaxis.h \ | |
16 | $$PWD/qchartaxiscategories.h No newline at end of file |
|
16 | $$PWD/qchartaxiscategories.h |
@@ -18,9 +18,9 | |||||
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "axis_p.h" |
|
21 | #include "chartaxis_p.h" | |
22 |
#include "q |
|
22 | #include "qaxis.h" | |
23 |
#include "q |
|
23 | #include "qaxis_p.h" | |
24 | #include "qchartaxiscategories_p.h" |
|
24 | #include "qchartaxiscategories_p.h" | |
25 | #include "chartpresenter_p.h" |
|
25 | #include "chartpresenter_p.h" | |
26 | #include "chartanimator_p.h" |
|
26 | #include "chartanimator_p.h" | |
@@ -32,7 +32,7 static int label_padding = 5; | |||||
32 |
|
32 | |||
33 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
33 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
34 |
|
34 | |||
35 |
Axis::Axis(Q |
|
35 | ChartAxis::ChartAxis(QAxis *axis,ChartPresenter *presenter,AxisType type) : Chart(presenter), | |
36 | m_chartAxis(axis), |
|
36 | m_chartAxis(axis), | |
37 | m_type(type), |
|
37 | m_type(type), | |
38 | m_labelsAngle(0), |
|
38 | m_labelsAngle(0), | |
@@ -57,11 +57,11 Axis::Axis(QChartAxis *axis,ChartPresenter *presenter,AxisType type) : Chart(pre | |||||
57 | handleAxisUpdated(); |
|
57 | handleAxisUpdated(); | |
58 | } |
|
58 | } | |
59 |
|
59 | |||
60 | Axis::~Axis() |
|
60 | ChartAxis::~ChartAxis() | |
61 | { |
|
61 | { | |
62 | } |
|
62 | } | |
63 |
|
63 | |||
64 | void Axis::createItems(int count) |
|
64 | void ChartAxis::createItems(int count) | |
65 | { |
|
65 | { | |
66 |
|
66 | |||
67 | if (m_axis->children().size() == 0) |
|
67 | if (m_axis->children().size() == 0) | |
@@ -74,7 +74,7 void Axis::createItems(int count) | |||||
74 | } |
|
74 | } | |
75 | } |
|
75 | } | |
76 |
|
76 | |||
77 | void Axis::deleteItems(int count) |
|
77 | void ChartAxis::deleteItems(int count) | |
78 | { |
|
78 | { | |
79 | QList<QGraphicsItem *> lines = m_grid->childItems(); |
|
79 | QList<QGraphicsItem *> lines = m_grid->childItems(); | |
80 | QList<QGraphicsItem *> labels = m_labels->childItems(); |
|
80 | QList<QGraphicsItem *> labels = m_labels->childItems(); | |
@@ -89,7 +89,7 void Axis::deleteItems(int count) | |||||
89 | } |
|
89 | } | |
90 | } |
|
90 | } | |
91 |
|
91 | |||
92 | void Axis::updateLayout(QVector<qreal> &layout) |
|
92 | void ChartAxis::updateLayout(QVector<qreal> &layout) | |
93 | { |
|
93 | { | |
94 | if (animator()) { |
|
94 | if (animator()) { | |
95 | animator()->updateLayout(this,layout); |
|
95 | animator()->updateLayout(this,layout); | |
@@ -98,7 +98,7 void Axis::updateLayout(QVector<qreal> &layout) | |||||
98 | } |
|
98 | } | |
99 | } |
|
99 | } | |
100 |
|
100 | |||
101 | bool Axis::createLabels(QStringList &labels,qreal min, qreal max,int ticks) const |
|
101 | bool ChartAxis::createLabels(QStringList &labels,qreal min, qreal max,int ticks) const | |
102 | { |
|
102 | { | |
103 | Q_ASSERT(max>=min); |
|
103 | Q_ASSERT(max>=min); | |
104 | Q_ASSERT(ticks>1); |
|
104 | Q_ASSERT(ticks>1); | |
@@ -132,47 +132,47 bool Axis::createLabels(QStringList &labels,qreal min, qreal max,int ticks) cons | |||||
132 | return category; |
|
132 | return category; | |
133 | } |
|
133 | } | |
134 |
|
134 | |||
135 | void Axis::setAxisOpacity(qreal opacity) |
|
135 | void ChartAxis::setAxisOpacity(qreal opacity) | |
136 | { |
|
136 | { | |
137 | m_axis->setOpacity(opacity); |
|
137 | m_axis->setOpacity(opacity); | |
138 | } |
|
138 | } | |
139 |
|
139 | |||
140 | qreal Axis::axisOpacity() const |
|
140 | qreal ChartAxis::axisOpacity() const | |
141 | { |
|
141 | { | |
142 | return m_axis->opacity(); |
|
142 | return m_axis->opacity(); | |
143 | } |
|
143 | } | |
144 |
|
144 | |||
145 | void Axis::setGridOpacity(qreal opacity) |
|
145 | void ChartAxis::setGridOpacity(qreal opacity) | |
146 | { |
|
146 | { | |
147 | m_grid->setOpacity(opacity); |
|
147 | m_grid->setOpacity(opacity); | |
148 | } |
|
148 | } | |
149 |
|
149 | |||
150 | qreal Axis::gridOpacity() const |
|
150 | qreal ChartAxis::gridOpacity() const | |
151 | { |
|
151 | { | |
152 | return m_grid->opacity(); |
|
152 | return m_grid->opacity(); | |
153 | } |
|
153 | } | |
154 |
|
154 | |||
155 | void Axis::setLabelsOpacity(qreal opacity) |
|
155 | void ChartAxis::setLabelsOpacity(qreal opacity) | |
156 | { |
|
156 | { | |
157 | m_labels->setOpacity(opacity); |
|
157 | m_labels->setOpacity(opacity); | |
158 | } |
|
158 | } | |
159 |
|
159 | |||
160 | qreal Axis::labelsOpacity() const |
|
160 | qreal ChartAxis::labelsOpacity() const | |
161 | { |
|
161 | { | |
162 | return m_labels->opacity(); |
|
162 | return m_labels->opacity(); | |
163 | } |
|
163 | } | |
164 |
|
164 | |||
165 | void Axis::setShadesOpacity(qreal opacity) |
|
165 | void ChartAxis::setShadesOpacity(qreal opacity) | |
166 | { |
|
166 | { | |
167 | m_shades->setOpacity(opacity); |
|
167 | m_shades->setOpacity(opacity); | |
168 | } |
|
168 | } | |
169 |
|
169 | |||
170 | qreal Axis::shadesOpacity() const |
|
170 | qreal ChartAxis::shadesOpacity() const | |
171 | { |
|
171 | { | |
172 | return m_shades->opacity(); |
|
172 | return m_shades->opacity(); | |
173 | } |
|
173 | } | |
174 |
|
174 | |||
175 | void Axis::setLabelsAngle(int angle) |
|
175 | void ChartAxis::setLabelsAngle(int angle) | |
176 | { |
|
176 | { | |
177 | foreach(QGraphicsItem* item , m_labels->childItems()) { |
|
177 | foreach(QGraphicsItem* item , m_labels->childItems()) { | |
178 | item->setRotation(angle); |
|
178 | item->setRotation(angle); | |
@@ -181,56 +181,56 void Axis::setLabelsAngle(int angle) | |||||
181 | m_labelsAngle=angle; |
|
181 | m_labelsAngle=angle; | |
182 | } |
|
182 | } | |
183 |
|
183 | |||
184 | void Axis::setLabelsPen(const QPen &pen) |
|
184 | void ChartAxis::setLabelsPen(const QPen &pen) | |
185 | { |
|
185 | { | |
186 | foreach(QGraphicsItem* item , m_labels->childItems()) { |
|
186 | foreach(QGraphicsItem* item , m_labels->childItems()) { | |
187 | static_cast<QGraphicsSimpleTextItem*>(item)->setPen(pen); |
|
187 | static_cast<QGraphicsSimpleTextItem*>(item)->setPen(pen); | |
188 | } |
|
188 | } | |
189 | } |
|
189 | } | |
190 |
|
190 | |||
191 | void Axis::setLabelsBrush(const QBrush &brush) |
|
191 | void ChartAxis::setLabelsBrush(const QBrush &brush) | |
192 | { |
|
192 | { | |
193 | foreach(QGraphicsItem* item , m_labels->childItems()) { |
|
193 | foreach(QGraphicsItem* item , m_labels->childItems()) { | |
194 | static_cast<QGraphicsSimpleTextItem*>(item)->setBrush(brush); |
|
194 | static_cast<QGraphicsSimpleTextItem*>(item)->setBrush(brush); | |
195 | } |
|
195 | } | |
196 | } |
|
196 | } | |
197 |
|
197 | |||
198 | void Axis::setLabelsFont(const QFont &font) |
|
198 | void ChartAxis::setLabelsFont(const QFont &font) | |
199 | { |
|
199 | { | |
200 | foreach(QGraphicsItem* item , m_labels->childItems()) { |
|
200 | foreach(QGraphicsItem* item , m_labels->childItems()) { | |
201 | static_cast<QGraphicsSimpleTextItem*>(item)->setFont(font); |
|
201 | static_cast<QGraphicsSimpleTextItem*>(item)->setFont(font); | |
202 | } |
|
202 | } | |
203 | } |
|
203 | } | |
204 |
|
204 | |||
205 | void Axis::setShadesBrush(const QBrush &brush) |
|
205 | void ChartAxis::setShadesBrush(const QBrush &brush) | |
206 | { |
|
206 | { | |
207 | foreach(QGraphicsItem* item , m_shades->childItems()) { |
|
207 | foreach(QGraphicsItem* item , m_shades->childItems()) { | |
208 | static_cast<QGraphicsRectItem*>(item)->setBrush(brush); |
|
208 | static_cast<QGraphicsRectItem*>(item)->setBrush(brush); | |
209 | } |
|
209 | } | |
210 | } |
|
210 | } | |
211 |
|
211 | |||
212 | void Axis::setShadesPen(const QPen &pen) |
|
212 | void ChartAxis::setShadesPen(const QPen &pen) | |
213 | { |
|
213 | { | |
214 | foreach(QGraphicsItem* item , m_shades->childItems()) { |
|
214 | foreach(QGraphicsItem* item , m_shades->childItems()) { | |
215 | static_cast<QGraphicsRectItem*>(item)->setPen(pen); |
|
215 | static_cast<QGraphicsRectItem*>(item)->setPen(pen); | |
216 | } |
|
216 | } | |
217 | } |
|
217 | } | |
218 |
|
218 | |||
219 | void Axis::setAxisPen(const QPen &pen) |
|
219 | void ChartAxis::setAxisPen(const QPen &pen) | |
220 | { |
|
220 | { | |
221 | foreach(QGraphicsItem* item , m_axis->childItems()) { |
|
221 | foreach(QGraphicsItem* item , m_axis->childItems()) { | |
222 | static_cast<QGraphicsLineItem*>(item)->setPen(pen); |
|
222 | static_cast<QGraphicsLineItem*>(item)->setPen(pen); | |
223 | } |
|
223 | } | |
224 | } |
|
224 | } | |
225 |
|
225 | |||
226 | void Axis::setGridPen(const QPen &pen) |
|
226 | void ChartAxis::setGridPen(const QPen &pen) | |
227 | { |
|
227 | { | |
228 | foreach(QGraphicsItem* item , m_grid->childItems()) { |
|
228 | foreach(QGraphicsItem* item , m_grid->childItems()) { | |
229 | static_cast<QGraphicsLineItem*>(item)->setPen(pen); |
|
229 | static_cast<QGraphicsLineItem*>(item)->setPen(pen); | |
230 | } |
|
230 | } | |
231 | } |
|
231 | } | |
232 |
|
232 | |||
233 | QVector<qreal> Axis::calculateLayout() const |
|
233 | QVector<qreal> ChartAxis::calculateLayout() const | |
234 | { |
|
234 | { | |
235 | Q_ASSERT(m_ticksCount>=2); |
|
235 | Q_ASSERT(m_ticksCount>=2); | |
236 |
|
236 | |||
@@ -261,7 +261,7 QVector<qreal> Axis::calculateLayout() const | |||||
261 | return points; |
|
261 | return points; | |
262 | } |
|
262 | } | |
263 |
|
263 | |||
264 | void Axis::setLayout(QVector<qreal> &layout) |
|
264 | void ChartAxis::setLayout(QVector<qreal> &layout) | |
265 | { |
|
265 | { | |
266 | int diff = m_layoutVector.size() - layout.size(); |
|
266 | int diff = m_layoutVector.size() - layout.size(); | |
267 |
|
267 | |||
@@ -377,20 +377,20 void Axis::setLayout(QVector<qreal> &layout) | |||||
377 |
|
377 | |||
378 | } |
|
378 | } | |
379 |
|
379 | |||
380 | bool Axis::isEmpty() |
|
380 | bool ChartAxis::isEmpty() | |
381 | { |
|
381 | { | |
382 | return m_rect.isEmpty() || qFuzzyIsNull(m_min - m_max) || m_ticksCount==0; |
|
382 | return m_rect.isEmpty() || qFuzzyIsNull(m_min - m_max) || m_ticksCount==0; | |
383 | } |
|
383 | } | |
384 |
|
384 | |||
385 | //handlers |
|
385 | //handlers | |
386 |
|
386 | |||
387 | void Axis::handleAxisCategoriesUpdated() |
|
387 | void ChartAxis::handleAxisCategoriesUpdated() | |
388 | { |
|
388 | { | |
389 | if (isEmpty()) return; |
|
389 | if (isEmpty()) return; | |
390 | updateLayout(m_layoutVector); |
|
390 | updateLayout(m_layoutVector); | |
391 | } |
|
391 | } | |
392 |
|
392 | |||
393 | void Axis::handleAxisUpdated() |
|
393 | void ChartAxis::handleAxisUpdated() | |
394 | { |
|
394 | { | |
395 |
|
395 | |||
396 | if (isEmpty()) return; |
|
396 | if (isEmpty()) return; | |
@@ -430,7 +430,7 void Axis::handleAxisUpdated() | |||||
430 |
|
430 | |||
431 | } |
|
431 | } | |
432 |
|
432 | |||
433 | void Axis::handleRangeChanged(qreal min, qreal max,int tickCount) |
|
433 | void ChartAxis::handleRangeChanged(qreal min, qreal max,int tickCount) | |
434 | { |
|
434 | { | |
435 | if (qFuzzyIsNull(min - max) || tickCount < 2) |
|
435 | if (qFuzzyIsNull(min - max) || tickCount < 2) | |
436 | return; |
|
436 | return; | |
@@ -445,7 +445,7 void Axis::handleRangeChanged(qreal min, qreal max,int tickCount) | |||||
445 |
|
445 | |||
446 | } |
|
446 | } | |
447 |
|
447 | |||
448 | void Axis::handleGeometryChanged(const QRectF &rect) |
|
448 | void ChartAxis::handleGeometryChanged(const QRectF &rect) | |
449 | { |
|
449 | { | |
450 | if(m_rect != rect) |
|
450 | if(m_rect != rect) | |
451 | { |
|
451 | { | |
@@ -456,11 +456,11 void Axis::handleGeometryChanged(const QRectF &rect) | |||||
456 | } |
|
456 | } | |
457 | } |
|
457 | } | |
458 |
|
458 | |||
459 | void Axis::axisSelected() |
|
459 | void ChartAxis::axisSelected() | |
460 | { |
|
460 | { | |
461 | qDebug()<<"TODO: axis clicked"; |
|
461 | qDebug()<<"TODO: axis clicked"; | |
462 | } |
|
462 | } | |
463 |
|
463 | |||
464 | #include "moc_axis_p.cpp" |
|
464 | #include "moc_chartaxis_p.cpp" | |
465 |
|
465 | |||
466 | QTCOMMERCIALCHART_END_NAMESPACE |
|
466 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -27,17 +27,17 | |||||
27 |
|
27 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
29 | |||
30 |
class Q |
|
30 | class QAxis; | |
31 | class ChartPresenter; |
|
31 | class ChartPresenter; | |
32 |
|
32 | |||
33 | class Axis : public Chart |
|
33 | class ChartAxis : public Chart | |
34 | { |
|
34 | { | |
35 | Q_OBJECT |
|
35 | Q_OBJECT | |
36 | public: |
|
36 | public: | |
37 | enum AxisType{X_AXIS,Y_AXIS}; |
|
37 | enum AxisType{X_AXIS,Y_AXIS}; | |
38 |
|
38 | |||
39 |
Axis(Q |
|
39 | ChartAxis(QAxis *axis, ChartPresenter *presenter, AxisType type = X_AXIS); | |
40 | ~Axis(); |
|
40 | ~ChartAxis(); | |
41 |
|
41 | |||
42 | AxisType axisType() const { return m_type; } |
|
42 | AxisType axisType() const { return m_type; } | |
43 |
|
43 | |||
@@ -89,7 +89,7 private: | |||||
89 | void axisSelected(); |
|
89 | void axisSelected(); | |
90 |
|
90 | |||
91 | private: |
|
91 | private: | |
92 |
Q |
|
92 | QAxis* m_chartAxis; | |
93 | AxisType m_type; |
|
93 | AxisType m_type; | |
94 | QRectF m_rect; |
|
94 | QRectF m_rect; | |
95 | int m_labelsAngle; |
|
95 | int m_labelsAngle; | |
@@ -111,7 +111,7 class AxisItem: public QGraphicsLineItem | |||||
111 | { |
|
111 | { | |
112 |
|
112 | |||
113 | public: |
|
113 | public: | |
114 | explicit AxisItem(Axis *axis, QGraphicsItem *parent = 0) : QGraphicsLineItem(parent), m_axis(axis) {} |
|
114 | explicit AxisItem(ChartAxis *axis, QGraphicsItem *parent = 0) : QGraphicsLineItem(parent), m_axis(axis) {} | |
115 |
|
115 | |||
116 | protected: |
|
116 | protected: | |
117 | void mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
117 | void mousePressEvent(QGraphicsSceneMouseEvent *event) | |
@@ -129,12 +129,12 protected: | |||||
129 | { |
|
129 | { | |
130 | QPainterPath path = QGraphicsLineItem::shape(); |
|
130 | QPainterPath path = QGraphicsLineItem::shape(); | |
131 | QRectF rect = path.boundingRect(); |
|
131 | QRectF rect = path.boundingRect(); | |
132 | path.addRect(rect.adjusted(0,0,m_axis->axisType()!=Axis::X_AXIS?8:0,m_axis->axisType()!=Axis::Y_AXIS?8:0)); |
|
132 | path.addRect(rect.adjusted(0,0,m_axis->axisType()!=ChartAxis::X_AXIS?8:0,m_axis->axisType()!=ChartAxis::Y_AXIS?8:0)); | |
133 | return path; |
|
133 | return path; | |
134 | } |
|
134 | } | |
135 |
|
135 | |||
136 | private: |
|
136 | private: | |
137 | Axis* m_axis; |
|
137 | ChartAxis* m_axis; | |
138 |
|
138 | |||
139 | }; |
|
139 | }; | |
140 |
|
140 |
@@ -18,8 +18,8 | |||||
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 |
#include "q |
|
21 | #include "qaxis.h" | |
22 |
#include "q |
|
22 | #include "qaxis_p.h" | |
23 |
|
23 | |||
24 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
24 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
25 |
|
25 | |||
@@ -36,123 +36,123 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
36 | */ |
|
36 | */ | |
37 |
|
37 | |||
38 | /*! |
|
38 | /*! | |
39 |
\fn bool Q |
|
39 | \fn bool QAxis::isAxisVisible() const | |
40 | \brief Returns if axis is visible |
|
40 | \brief Returns if axis is visible | |
41 | \sa setAxisVisible() |
|
41 | \sa setAxisVisible() | |
42 | */ |
|
42 | */ | |
43 |
|
43 | |||
44 | /*! |
|
44 | /*! | |
45 |
\fn QPen Q |
|
45 | \fn QPen QAxis::axisPen() const | |
46 | \brief Returns pen used to draw axis and ticks. |
|
46 | \brief Returns pen used to draw axis and ticks. | |
47 | \sa setAxisPen() |
|
47 | \sa setAxisPen() | |
48 | */ |
|
48 | */ | |
49 |
|
49 | |||
50 |
|
50 | |||
51 | /*! |
|
51 | /*! | |
52 |
\fn bool Q |
|
52 | \fn bool QAxis::isGridLineVisible() const | |
53 | \brief Returns if grid is visible |
|
53 | \brief Returns if grid is visible | |
54 | \sa setGridLineVisible() |
|
54 | \sa setGridLineVisible() | |
55 | */ |
|
55 | */ | |
56 |
|
56 | |||
57 | /*! |
|
57 | /*! | |
58 |
\fn QPen Q |
|
58 | \fn QPen QAxis::gridLinePen() const | |
59 | \brief Returns pen used to draw grid. |
|
59 | \brief Returns pen used to draw grid. | |
60 | \sa setGridLinePen() |
|
60 | \sa setGridLinePen() | |
61 | */ |
|
61 | */ | |
62 |
|
62 | |||
63 | /*! |
|
63 | /*! | |
64 |
\fn bool Q |
|
64 | \fn bool QAxis::labelsVisible() const | |
65 | \brief Returns if grid is visible |
|
65 | \brief Returns if grid is visible | |
66 | \sa setLabelsVisible() |
|
66 | \sa setLabelsVisible() | |
67 | */ |
|
67 | */ | |
68 |
|
68 | |||
69 | /*! |
|
69 | /*! | |
70 |
\fn QPen Q |
|
70 | \fn QPen QAxis::labelsPen() const | |
71 | \brief Returns the pen used to labels. |
|
71 | \brief Returns the pen used to labels. | |
72 | \sa setLabelsPen() |
|
72 | \sa setLabelsPen() | |
73 | */ |
|
73 | */ | |
74 |
|
74 | |||
75 | /*! |
|
75 | /*! | |
76 |
\fn QBrush Q |
|
76 | \fn QBrush QAxis::labelsBrush() const | |
77 | \brief Returns brush used to draw labels. |
|
77 | \brief Returns brush used to draw labels. | |
78 | \sa setLabelsBrush() |
|
78 | \sa setLabelsBrush() | |
79 | */ |
|
79 | */ | |
80 |
|
80 | |||
81 | /*! |
|
81 | /*! | |
82 |
\fn QFont Q |
|
82 | \fn QFont QAxis::labelsFont() const | |
83 | \brief Returns font used to draw labels. |
|
83 | \brief Returns font used to draw labels. | |
84 | \sa setLabelsFont() |
|
84 | \sa setLabelsFont() | |
85 | */ |
|
85 | */ | |
86 |
|
86 | |||
87 | /*! |
|
87 | /*! | |
88 |
\fn QFont Q |
|
88 | \fn QFont QAxis::labelsAngle() const | |
89 | \brief Returns angle used to draw labels. |
|
89 | \brief Returns angle used to draw labels. | |
90 | \sa setLabelsAngle() |
|
90 | \sa setLabelsAngle() | |
91 | */ |
|
91 | */ | |
92 |
|
92 | |||
93 | /*! |
|
93 | /*! | |
94 |
\fn bool Q |
|
94 | \fn bool QAxis::shadesVisible() const | |
95 | \brief Returns if shades are visible. |
|
95 | \brief Returns if shades are visible. | |
96 | \sa setShadesVisible() |
|
96 | \sa setShadesVisible() | |
97 | */ |
|
97 | */ | |
98 |
|
98 | |||
99 | /*! |
|
99 | /*! | |
100 |
\fn qreal Q |
|
100 | \fn qreal QAxis::shadesOpacity() const | |
101 | \brief Returns opacity of shades. |
|
101 | \brief Returns opacity of shades. | |
102 | */ |
|
102 | */ | |
103 |
|
103 | |||
104 | /*! |
|
104 | /*! | |
105 |
\fn QPen Q |
|
105 | \fn QPen QAxis::shadesPen() const | |
106 | \brief Returns pen used to draw shades. |
|
106 | \brief Returns pen used to draw shades. | |
107 | \sa setShadesPen() |
|
107 | \sa setShadesPen() | |
108 | */ |
|
108 | */ | |
109 |
|
109 | |||
110 | /*! |
|
110 | /*! | |
111 |
\fn QBrush Q |
|
111 | \fn QBrush QAxis::shadesBrush() const | |
112 | \brief Returns brush used to draw shades. |
|
112 | \brief Returns brush used to draw shades. | |
113 | \sa setShadesBrush() |
|
113 | \sa setShadesBrush() | |
114 | */ |
|
114 | */ | |
115 |
|
115 | |||
116 | /*! |
|
116 | /*! | |
117 |
\fn qreal Q |
|
117 | \fn qreal QAxis::min() const | |
118 | \brief Returns minimum value on the axis. |
|
118 | \brief Returns minimum value on the axis. | |
119 | \sa setMin() |
|
119 | \sa setMin() | |
120 | */ |
|
120 | */ | |
121 |
|
121 | |||
122 | /*! |
|
122 | /*! | |
123 |
\fn qreal Q |
|
123 | \fn qreal QAxis::max() const | |
124 | \brief Returns maximim value on the axis. |
|
124 | \brief Returns maximim value on the axis. | |
125 | \sa setMax() |
|
125 | \sa setMax() | |
126 | */ |
|
126 | */ | |
127 |
|
127 | |||
128 | /*! |
|
128 | /*! | |
129 |
\fn void Q |
|
129 | \fn void QAxis::minChanged(qreal min) | |
130 | \brief Axis emits signal when \a min of axis has changed. |
|
130 | \brief Axis emits signal when \a min of axis has changed. | |
131 | */ |
|
131 | */ | |
132 |
|
132 | |||
133 | /*! |
|
133 | /*! | |
134 |
\fn void Q |
|
134 | \fn void QAxis::maxChanged(qreal max) | |
135 | \brief Axis emits signal when \a max of axis has changed. |
|
135 | \brief Axis emits signal when \a max of axis has changed. | |
136 | */ |
|
136 | */ | |
137 |
|
137 | |||
138 | /*! |
|
138 | /*! | |
139 |
\fn void Q |
|
139 | \fn void QAxis::rangeChanged(qreal min, qreal max) | |
140 | \brief Axis emits signal when \a min or \a max of axis has changed. |
|
140 | \brief Axis emits signal when \a min or \a max of axis has changed. | |
141 | */ |
|
141 | */ | |
142 |
|
142 | |||
143 | /*! |
|
143 | /*! | |
144 |
\fn int Q |
|
144 | \fn int QAxis::ticksCount() const | |
145 | \brief Return number of ticks on the axis |
|
145 | \brief Return number of ticks on the axis | |
146 | \sa setTicksCount() |
|
146 | \sa setTicksCount() | |
147 | */ |
|
147 | */ | |
148 |
|
148 | |||
149 | /*! |
|
149 | /*! | |
150 |
\fn QChartAxisCategories* Q |
|
150 | \fn QChartAxisCategories* QAxis::categories() | |
151 | \brief Returns pointer to the list of categories which correspond to the values on the axis. |
|
151 | \brief Returns pointer to the list of categories which correspond to the values on the axis. | |
152 | */ |
|
152 | */ | |
153 |
|
153 | |||
154 | /*! |
|
154 | /*! | |
155 |
\fn void Q |
|
155 | \fn void QAxis::ticksCountChanged(int count) | |
156 | \brief Emits the new \a count of ticks on the axis |
|
156 | \brief Emits the new \a count of ticks on the axis | |
157 | Signal is emitted when the number of the ticks on the axis has been changed to a different value. |
|
157 | Signal is emitted when the number of the ticks on the axis has been changed to a different value. | |
158 | Parementer count\a count is the new number of ticks on the axis. |
|
158 | Parementer count\a count is the new number of ticks on the axis. | |
@@ -163,8 +163,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
163 | QChatView or QChart when axis added. |
|
163 | QChatView or QChart when axis added. | |
164 | */ |
|
164 | */ | |
165 |
|
165 | |||
166 |
Q |
|
166 | QAxis::QAxis(QObject *parent) : QObject(parent), | |
167 |
d_ptr(new Q |
|
167 | d_ptr(new QAxisPrivate(this)) | |
168 | { |
|
168 | { | |
169 |
|
169 | |||
170 | } |
|
170 | } | |
@@ -173,14 +173,14 d_ptr(new QChartAxisPrivate(this)) | |||||
173 | Destructor of the axis object. When axis is added to chart, chart object takes ownership. |
|
173 | Destructor of the axis object. When axis is added to chart, chart object takes ownership. | |
174 | */ |
|
174 | */ | |
175 |
|
175 | |||
176 |
Q |
|
176 | QAxis::~QAxis() | |
177 | { |
|
177 | { | |
178 | } |
|
178 | } | |
179 |
|
179 | |||
180 | /*! |
|
180 | /*! | |
181 | Sets \a pen used to draw axis line and ticks. |
|
181 | Sets \a pen used to draw axis line and ticks. | |
182 | */ |
|
182 | */ | |
183 |
void Q |
|
183 | void QAxis::setAxisPen(const QPen &pen) | |
184 | { |
|
184 | { | |
185 | if (d_ptr->m_axisPen!=pen) { |
|
185 | if (d_ptr->m_axisPen!=pen) { | |
186 | d_ptr->m_axisPen = pen; |
|
186 | d_ptr->m_axisPen = pen; | |
@@ -188,7 +188,7 void QChartAxis::setAxisPen(const QPen &pen) | |||||
188 | } |
|
188 | } | |
189 | } |
|
189 | } | |
190 |
|
190 | |||
191 |
QPen Q |
|
191 | QPen QAxis::axisPen() const | |
192 | { |
|
192 | { | |
193 | return d_ptr->m_axisPen; |
|
193 | return d_ptr->m_axisPen; | |
194 | } |
|
194 | } | |
@@ -196,7 +196,7 QPen QChartAxis::axisPen() const | |||||
196 | /*! |
|
196 | /*! | |
197 | Sets if axis and ticks are \a visible. |
|
197 | Sets if axis and ticks are \a visible. | |
198 | */ |
|
198 | */ | |
199 |
void Q |
|
199 | void QAxis::setAxisVisible(bool visible) | |
200 | { |
|
200 | { | |
201 | if (d_ptr->m_axisVisible != visible) { |
|
201 | if (d_ptr->m_axisVisible != visible) { | |
202 | d_ptr->m_axisVisible = visible; |
|
202 | d_ptr->m_axisVisible = visible; | |
@@ -204,7 +204,7 void QChartAxis::setAxisVisible(bool visible) | |||||
204 | } |
|
204 | } | |
205 | } |
|
205 | } | |
206 |
|
206 | |||
207 |
bool Q |
|
207 | bool QAxis::isAxisVisible() const | |
208 | { |
|
208 | { | |
209 | return d_ptr->m_axisVisible; |
|
209 | return d_ptr->m_axisVisible; | |
210 | } |
|
210 | } | |
@@ -212,7 +212,7 bool QChartAxis::isAxisVisible() const | |||||
212 | /*! |
|
212 | /*! | |
213 | Sets if grid line is \a visible. |
|
213 | Sets if grid line is \a visible. | |
214 | */ |
|
214 | */ | |
215 |
void Q |
|
215 | void QAxis::setGridLineVisible(bool visible) | |
216 | { |
|
216 | { | |
217 | if (d_ptr->m_gridLineVisible != visible) { |
|
217 | if (d_ptr->m_gridLineVisible != visible) { | |
218 | d_ptr->m_gridLineVisible = visible; |
|
218 | d_ptr->m_gridLineVisible = visible; | |
@@ -220,14 +220,14 void QChartAxis::setGridLineVisible(bool visible) | |||||
220 | } |
|
220 | } | |
221 | } |
|
221 | } | |
222 |
|
222 | |||
223 |
bool Q |
|
223 | bool QAxis::isGridLineVisible() const | |
224 | { |
|
224 | { | |
225 | return d_ptr->m_gridLineVisible; |
|
225 | return d_ptr->m_gridLineVisible; | |
226 | } |
|
226 | } | |
227 | /*! |
|
227 | /*! | |
228 | Sets \a pen used to draw grid line. |
|
228 | Sets \a pen used to draw grid line. | |
229 | */ |
|
229 | */ | |
230 |
void Q |
|
230 | void QAxis::setGridLinePen(const QPen &pen) | |
231 | { |
|
231 | { | |
232 | if (d_ptr->m_gridLinePen != pen) { |
|
232 | if (d_ptr->m_gridLinePen != pen) { | |
233 | d_ptr->m_gridLinePen = pen; |
|
233 | d_ptr->m_gridLinePen = pen; | |
@@ -235,7 +235,7 void QChartAxis::setGridLinePen(const QPen &pen) | |||||
235 | } |
|
235 | } | |
236 | } |
|
236 | } | |
237 |
|
237 | |||
238 |
QPen Q |
|
238 | QPen QAxis::gridLinePen() const | |
239 | { |
|
239 | { | |
240 | return d_ptr->m_gridLinePen; |
|
240 | return d_ptr->m_gridLinePen; | |
241 | } |
|
241 | } | |
@@ -243,7 +243,7 QPen QChartAxis::gridLinePen() const | |||||
243 | /*! |
|
243 | /*! | |
244 | Sets if axis' labels are \a visible. |
|
244 | Sets if axis' labels are \a visible. | |
245 | */ |
|
245 | */ | |
246 |
void Q |
|
246 | void QAxis::setLabelsVisible(bool visible) | |
247 | { |
|
247 | { | |
248 | if (d_ptr->m_labelsVisible != visible) { |
|
248 | if (d_ptr->m_labelsVisible != visible) { | |
249 | d_ptr->m_labelsVisible = visible; |
|
249 | d_ptr->m_labelsVisible = visible; | |
@@ -251,14 +251,14 void QChartAxis::setLabelsVisible(bool visible) | |||||
251 | } |
|
251 | } | |
252 | } |
|
252 | } | |
253 |
|
253 | |||
254 |
bool Q |
|
254 | bool QAxis::labelsVisible() const | |
255 | { |
|
255 | { | |
256 | return d_ptr->m_labelsVisible; |
|
256 | return d_ptr->m_labelsVisible; | |
257 | } |
|
257 | } | |
258 | /*! |
|
258 | /*! | |
259 | Sets \a pen used to draw labels. |
|
259 | Sets \a pen used to draw labels. | |
260 | */ |
|
260 | */ | |
261 |
void Q |
|
261 | void QAxis::setLabelsPen(const QPen &pen) | |
262 | { |
|
262 | { | |
263 | if (d_ptr->m_labelsPen != pen) { |
|
263 | if (d_ptr->m_labelsPen != pen) { | |
264 | d_ptr->m_labelsPen = pen; |
|
264 | d_ptr->m_labelsPen = pen; | |
@@ -266,7 +266,7 void QChartAxis::setLabelsPen(const QPen &pen) | |||||
266 | } |
|
266 | } | |
267 | } |
|
267 | } | |
268 |
|
268 | |||
269 |
QPen Q |
|
269 | QPen QAxis::labelsPen() const | |
270 | { |
|
270 | { | |
271 | return d_ptr->m_labelsPen; |
|
271 | return d_ptr->m_labelsPen; | |
272 | } |
|
272 | } | |
@@ -274,7 +274,7 QPen QChartAxis::labelsPen() const | |||||
274 | /*! |
|
274 | /*! | |
275 | Sets \a brush used to draw labels. |
|
275 | Sets \a brush used to draw labels. | |
276 | */ |
|
276 | */ | |
277 |
void Q |
|
277 | void QAxis::setLabelsBrush(const QBrush &brush) | |
278 | { |
|
278 | { | |
279 | if (d_ptr->m_labelsBrush != brush) { |
|
279 | if (d_ptr->m_labelsBrush != brush) { | |
280 | d_ptr->m_labelsBrush = brush; |
|
280 | d_ptr->m_labelsBrush = brush; | |
@@ -282,7 +282,7 void QChartAxis::setLabelsBrush(const QBrush &brush) | |||||
282 | } |
|
282 | } | |
283 | } |
|
283 | } | |
284 |
|
284 | |||
285 |
QBrush Q |
|
285 | QBrush QAxis::labelsBrush() const | |
286 | { |
|
286 | { | |
287 | return d_ptr->m_labelsBrush; |
|
287 | return d_ptr->m_labelsBrush; | |
288 | } |
|
288 | } | |
@@ -290,7 +290,7 QBrush QChartAxis::labelsBrush() const | |||||
290 | /*! |
|
290 | /*! | |
291 | Sets \a font used to draw labels. |
|
291 | Sets \a font used to draw labels. | |
292 | */ |
|
292 | */ | |
293 |
void Q |
|
293 | void QAxis::setLabelsFont(const QFont &font) | |
294 | { |
|
294 | { | |
295 | if (d_ptr->m_labelsFont != font) { |
|
295 | if (d_ptr->m_labelsFont != font) { | |
296 | d_ptr->m_labelsFont = font; |
|
296 | d_ptr->m_labelsFont = font; | |
@@ -298,7 +298,7 void QChartAxis::setLabelsFont(const QFont &font) | |||||
298 | } |
|
298 | } | |
299 | } |
|
299 | } | |
300 |
|
300 | |||
301 |
QFont Q |
|
301 | QFont QAxis::labelsFont() const | |
302 | { |
|
302 | { | |
303 | return d_ptr->m_labelsFont; |
|
303 | return d_ptr->m_labelsFont; | |
304 | } |
|
304 | } | |
@@ -306,7 +306,7 QFont QChartAxis::labelsFont() const | |||||
306 | /*! |
|
306 | /*! | |
307 | Sets \a angle for all the labels on given axis. |
|
307 | Sets \a angle for all the labels on given axis. | |
308 | */ |
|
308 | */ | |
309 |
void Q |
|
309 | void QAxis::setLabelsAngle(int angle) | |
310 | { |
|
310 | { | |
311 | if (d_ptr->m_labelsAngle != angle) { |
|
311 | if (d_ptr->m_labelsAngle != angle) { | |
312 | d_ptr->m_labelsAngle = angle; |
|
312 | d_ptr->m_labelsAngle = angle; | |
@@ -314,7 +314,7 void QChartAxis::setLabelsAngle(int angle) | |||||
314 | } |
|
314 | } | |
315 | } |
|
315 | } | |
316 |
|
316 | |||
317 |
int Q |
|
317 | int QAxis::labelsAngle() const | |
318 | { |
|
318 | { | |
319 | return d_ptr->m_labelsAngle; |
|
319 | return d_ptr->m_labelsAngle; | |
320 | } |
|
320 | } | |
@@ -322,7 +322,7 int QChartAxis::labelsAngle() const | |||||
322 | /*! |
|
322 | /*! | |
323 | Sets if shades are \a visible. |
|
323 | Sets if shades are \a visible. | |
324 | */ |
|
324 | */ | |
325 |
void Q |
|
325 | void QAxis::setShadesVisible(bool visible) | |
326 | { |
|
326 | { | |
327 | if (d_ptr->m_shadesVisible != visible) { |
|
327 | if (d_ptr->m_shadesVisible != visible) { | |
328 | d_ptr->m_shadesVisible = visible; |
|
328 | d_ptr->m_shadesVisible = visible; | |
@@ -330,7 +330,7 void QChartAxis::setShadesVisible(bool visible) | |||||
330 | } |
|
330 | } | |
331 | } |
|
331 | } | |
332 |
|
332 | |||
333 |
bool Q |
|
333 | bool QAxis::shadesVisible() const | |
334 | { |
|
334 | { | |
335 | return d_ptr->m_shadesVisible; |
|
335 | return d_ptr->m_shadesVisible; | |
336 | } |
|
336 | } | |
@@ -338,7 +338,7 bool QChartAxis::shadesVisible() const | |||||
338 | /*! |
|
338 | /*! | |
339 | Sets \a pen used to draw shades. |
|
339 | Sets \a pen used to draw shades. | |
340 | */ |
|
340 | */ | |
341 |
void Q |
|
341 | void QAxis::setShadesPen(const QPen &pen) | |
342 | { |
|
342 | { | |
343 | if (d_ptr->m_shadesPen != pen) { |
|
343 | if (d_ptr->m_shadesPen != pen) { | |
344 | d_ptr->m_shadesPen = pen; |
|
344 | d_ptr->m_shadesPen = pen; | |
@@ -346,7 +346,7 void QChartAxis::setShadesPen(const QPen &pen) | |||||
346 | } |
|
346 | } | |
347 | } |
|
347 | } | |
348 |
|
348 | |||
349 |
QPen Q |
|
349 | QPen QAxis::shadesPen() const | |
350 | { |
|
350 | { | |
351 | return d_ptr->m_shadesPen; |
|
351 | return d_ptr->m_shadesPen; | |
352 | } |
|
352 | } | |
@@ -354,7 +354,7 QPen QChartAxis::shadesPen() const | |||||
354 | /*! |
|
354 | /*! | |
355 | Sets \a brush used to draw shades. |
|
355 | Sets \a brush used to draw shades. | |
356 | */ |
|
356 | */ | |
357 |
void Q |
|
357 | void QAxis::setShadesBrush(const QBrush &brush) | |
358 | { |
|
358 | { | |
359 | if (d_ptr->m_shadesBrush != brush) { |
|
359 | if (d_ptr->m_shadesBrush != brush) { | |
360 | d_ptr->m_shadesBrush = brush; |
|
360 | d_ptr->m_shadesBrush = brush; | |
@@ -362,7 +362,7 void QChartAxis::setShadesBrush(const QBrush &brush) | |||||
362 | } |
|
362 | } | |
363 | } |
|
363 | } | |
364 |
|
364 | |||
365 |
QBrush Q |
|
365 | QBrush QAxis::shadesBrush() const | |
366 | { |
|
366 | { | |
367 | return d_ptr->m_shadesBrush; |
|
367 | return d_ptr->m_shadesBrush; | |
368 | } |
|
368 | } | |
@@ -370,7 +370,7 QBrush QChartAxis::shadesBrush() const | |||||
370 | /*! |
|
370 | /*! | |
371 | Sets \a opacity of the shades. |
|
371 | Sets \a opacity of the shades. | |
372 | */ |
|
372 | */ | |
373 |
void Q |
|
373 | void QAxis::setShadesOpacity(qreal opacity) | |
374 | { |
|
374 | { | |
375 | if (d_ptr->m_shadesOpacity != opacity) { |
|
375 | if (d_ptr->m_shadesOpacity != opacity) { | |
376 | d_ptr->m_shadesOpacity=opacity; |
|
376 | d_ptr->m_shadesOpacity=opacity; | |
@@ -378,7 +378,7 void QChartAxis::setShadesOpacity(qreal opacity) | |||||
378 | } |
|
378 | } | |
379 | } |
|
379 | } | |
380 |
|
380 | |||
381 |
qreal Q |
|
381 | qreal QAxis::shadesOpacity() const | |
382 | { |
|
382 | { | |
383 | return d_ptr->m_shadesOpacity; |
|
383 | return d_ptr->m_shadesOpacity; | |
384 | } |
|
384 | } | |
@@ -386,12 +386,12 qreal QChartAxis::shadesOpacity() const | |||||
386 | /*! |
|
386 | /*! | |
387 | Sets \a min value on the axis. |
|
387 | Sets \a min value on the axis. | |
388 | */ |
|
388 | */ | |
389 |
void Q |
|
389 | void QAxis::setMin(qreal min) | |
390 | { |
|
390 | { | |
391 | setRange(min,d_ptr->m_max); |
|
391 | setRange(min,d_ptr->m_max); | |
392 | } |
|
392 | } | |
393 |
|
393 | |||
394 |
qreal Q |
|
394 | qreal QAxis::min() const | |
395 | { |
|
395 | { | |
396 | return d_ptr->m_min; |
|
396 | return d_ptr->m_min; | |
397 | } |
|
397 | } | |
@@ -399,12 +399,12 qreal QChartAxis::min() const | |||||
399 | /*! |
|
399 | /*! | |
400 | Sets \a max value on the axis. |
|
400 | Sets \a max value on the axis. | |
401 | */ |
|
401 | */ | |
402 |
void Q |
|
402 | void QAxis::setMax(qreal max) | |
403 | { |
|
403 | { | |
404 | setRange(d_ptr->m_min,max); |
|
404 | setRange(d_ptr->m_min,max); | |
405 | } |
|
405 | } | |
406 |
|
406 | |||
407 |
qreal Q |
|
407 | qreal QAxis::max() const | |
408 | { |
|
408 | { | |
409 | return d_ptr->m_max; |
|
409 | return d_ptr->m_max; | |
410 | } |
|
410 | } | |
@@ -412,7 +412,7 qreal QChartAxis::max() const | |||||
412 | /*! |
|
412 | /*! | |
413 | Sets range from \a min to \a max on the axis. |
|
413 | Sets range from \a min to \a max on the axis. | |
414 | */ |
|
414 | */ | |
415 |
void Q |
|
415 | void QAxis::setRange(qreal min, qreal max) | |
416 | { |
|
416 | { | |
417 | bool changed = false; |
|
417 | bool changed = false; | |
418 | if (!qFuzzyIsNull(d_ptr->m_min - min)) { |
|
418 | if (!qFuzzyIsNull(d_ptr->m_min - min)) { | |
@@ -436,7 +436,7 void QChartAxis::setRange(qreal min, qreal max) | |||||
436 | /*! |
|
436 | /*! | |
437 | Sets \a count for ticks on the axis. |
|
437 | Sets \a count for ticks on the axis. | |
438 | */ |
|
438 | */ | |
439 |
void Q |
|
439 | void QAxis::setTicksCount(int count) | |
440 | { |
|
440 | { | |
441 | if (d_ptr->m_ticksCount != count) { |
|
441 | if (d_ptr->m_ticksCount != count) { | |
442 | d_ptr->m_ticksCount = count; |
|
442 | d_ptr->m_ticksCount = count; | |
@@ -445,7 +445,7 void QChartAxis::setTicksCount(int count) | |||||
445 | } |
|
445 | } | |
446 | } |
|
446 | } | |
447 |
|
447 | |||
448 |
int Q |
|
448 | int QAxis::ticksCount() const | |
449 | { |
|
449 | { | |
450 | return d_ptr->m_ticksCount; |
|
450 | return d_ptr->m_ticksCount; | |
451 | } |
|
451 | } | |
@@ -453,7 +453,7 int QChartAxis::ticksCount() const | |||||
453 | /*! |
|
453 | /*! | |
454 | Sets axis, shades, labels and grid lines to be visible. |
|
454 | Sets axis, shades, labels and grid lines to be visible. | |
455 | */ |
|
455 | */ | |
456 |
void Q |
|
456 | void QAxis::show() | |
457 | { |
|
457 | { | |
458 | d_ptr->m_axisVisible=true; |
|
458 | d_ptr->m_axisVisible=true; | |
459 | d_ptr->m_gridLineVisible=true; |
|
459 | d_ptr->m_gridLineVisible=true; | |
@@ -465,7 +465,7 void QChartAxis::show() | |||||
465 | /*! |
|
465 | /*! | |
466 | Sets axis, shades, labels and grid lines to not be visible. |
|
466 | Sets axis, shades, labels and grid lines to not be visible. | |
467 | */ |
|
467 | */ | |
468 |
void Q |
|
468 | void QAxis::hide() | |
469 | { |
|
469 | { | |
470 | d_ptr->m_axisVisible = false; |
|
470 | d_ptr->m_axisVisible = false; | |
471 | d_ptr->m_gridLineVisible = false; |
|
471 | d_ptr->m_gridLineVisible = false; | |
@@ -477,7 +477,7 void QChartAxis::hide() | |||||
477 | /*! |
|
477 | /*! | |
478 | Sets the nice numbers state to \a enable |
|
478 | Sets the nice numbers state to \a enable | |
479 | */ |
|
479 | */ | |
480 |
void Q |
|
480 | void QAxis::setNiceNumbersEnabled(bool enable) | |
481 | { |
|
481 | { | |
482 | if (d_ptr->m_niceNumbers != enable){ |
|
482 | if (d_ptr->m_niceNumbers != enable){ | |
483 | d_ptr->m_niceNumbers = enable; |
|
483 | d_ptr->m_niceNumbers = enable; | |
@@ -488,19 +488,19 void QChartAxis::setNiceNumbersEnabled(bool enable) | |||||
488 | /*! |
|
488 | /*! | |
489 | Returns whether nice numbers are enabled or not. |
|
489 | Returns whether nice numbers are enabled or not. | |
490 | */ |
|
490 | */ | |
491 |
bool Q |
|
491 | bool QAxis::niceNumbersEnabled() const | |
492 | { |
|
492 | { | |
493 | return d_ptr->m_niceNumbers; |
|
493 | return d_ptr->m_niceNumbers; | |
494 | } |
|
494 | } | |
495 |
|
495 | |||
496 |
QChartAxisCategories* Q |
|
496 | QChartAxisCategories* QAxis::categories() | |
497 | { |
|
497 | { | |
498 | return &d_ptr->m_category; |
|
498 | return &d_ptr->m_category; | |
499 | } |
|
499 | } | |
500 |
|
500 | |||
501 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
501 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
502 |
|
502 | |||
503 |
Q |
|
503 | QAxisPrivate::QAxisPrivate(QAxis* q): | |
504 | q_ptr(q), |
|
504 | q_ptr(q), | |
505 | m_axisVisible(true), |
|
505 | m_axisVisible(true), | |
506 | m_gridLineVisible(true), |
|
506 | m_gridLineVisible(true), | |
@@ -516,18 +516,18 m_niceNumbers(false) | |||||
516 |
|
516 | |||
517 | } |
|
517 | } | |
518 |
|
518 | |||
519 |
Q |
|
519 | QAxisPrivate::~QAxisPrivate() | |
520 | { |
|
520 | { | |
521 |
|
521 | |||
522 | } |
|
522 | } | |
523 |
|
523 | |||
524 |
void Q |
|
524 | void QAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count) | |
525 | { |
|
525 | { | |
526 | q_ptr->setRange(min,max); |
|
526 | q_ptr->setRange(min,max); | |
527 | q_ptr->setTicksCount(count); |
|
527 | q_ptr->setTicksCount(count); | |
528 | } |
|
528 | } | |
529 |
|
529 | |||
530 |
#include "moc_q |
|
530 | #include "moc_qaxis.cpp" | |
531 |
#include "moc_q |
|
531 | #include "moc_qaxis_p.cpp" | |
532 |
|
532 | |||
533 | QTCOMMERCIALCHART_END_NAMESPACE |
|
533 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -18,8 +18,8 | |||||
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 |
#ifndef Q |
|
21 | #ifndef QAXIS_H | |
22 |
#define Q |
|
22 | #define QAXIS_H | |
23 |
|
23 | |||
24 | #include <qchartglobal.h> |
|
24 | #include <qchartglobal.h> | |
25 | #include <qchartaxiscategories.h> |
|
25 | #include <qchartaxiscategories.h> | |
@@ -28,15 +28,15 | |||||
28 |
|
28 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
30 | |||
31 |
class Q |
|
31 | class QAxisPrivate; | |
32 |
|
32 | |||
33 |
class QTCOMMERCIALCHART_EXPORT Q |
|
33 | class QTCOMMERCIALCHART_EXPORT QAxis : public QObject | |
34 | { |
|
34 | { | |
35 | Q_OBJECT |
|
35 | Q_OBJECT | |
36 | public: |
|
36 | public: | |
37 |
|
37 | |||
38 |
Q |
|
38 | QAxis(QObject *parent =0); | |
39 |
~Q |
|
39 | ~QAxis(); | |
40 |
|
40 | |||
41 | //axis handling |
|
41 | //axis handling | |
42 | bool isAxisVisible() const; |
|
42 | bool isAxisVisible() const; | |
@@ -98,10 +98,10 Q_SIGNALS: | |||||
98 | void ticksCountChanged(int count); |
|
98 | void ticksCountChanged(int count); | |
99 |
|
99 | |||
100 | private: |
|
100 | private: | |
101 |
QScopedPointer<Q |
|
101 | QScopedPointer<QAxisPrivate> d_ptr; | |
102 |
Q_DISABLE_COPY(Q |
|
102 | Q_DISABLE_COPY(QAxis); | |
103 | friend class ChartDataSet; |
|
103 | friend class ChartDataSet; | |
104 | friend class Axis; |
|
104 | friend class ChartAxis; | |
105 | }; |
|
105 | }; | |
106 |
|
106 | |||
107 | QTCOMMERCIALCHART_END_NAMESPACE |
|
107 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -27,19 +27,19 | |||||
27 | // |
|
27 | // | |
28 | // We mean it. |
|
28 | // We mean it. | |
29 |
|
29 | |||
30 |
#ifndef Q |
|
30 | #ifndef QAXIS_P_H | |
31 |
#define Q |
|
31 | #define QAXIS_P_H | |
32 |
|
32 | |||
33 |
#include "q |
|
33 | #include "qaxis.h" | |
34 |
|
34 | |||
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
36 |
|
36 | |||
37 |
class Q |
|
37 | class QAxisPrivate : public QObject | |
38 | { |
|
38 | { | |
39 | Q_OBJECT |
|
39 | Q_OBJECT | |
40 | public: |
|
40 | public: | |
41 |
Q |
|
41 | QAxisPrivate(QAxis *q); | |
42 |
~Q |
|
42 | ~QAxisPrivate(); | |
43 |
|
43 | |||
44 | Q_SIGNALS: |
|
44 | Q_SIGNALS: | |
45 | void updated(); |
|
45 | void updated(); | |
@@ -49,7 +49,7 public Q_SLOTS: | |||||
49 | void handleAxisRangeChanged(qreal min, qreal max,int count); |
|
49 | void handleAxisRangeChanged(qreal min, qreal max,int count); | |
50 |
|
50 | |||
51 | private: |
|
51 | private: | |
52 |
Q |
|
52 | QAxis *q_ptr; | |
53 |
|
53 | |||
54 | bool m_axisVisible; |
|
54 | bool m_axisVisible; | |
55 | QPen m_axisPen; |
|
55 | QPen m_axisPen; | |
@@ -77,7 +77,7 private: | |||||
77 |
|
77 | |||
78 | bool m_niceNumbers; |
|
78 | bool m_niceNumbers; | |
79 |
|
79 | |||
80 |
friend class Q |
|
80 | friend class QAxis; | |
81 | }; |
|
81 | }; | |
82 |
|
82 | |||
83 | QTCOMMERCIALCHART_END_NAMESPACE |
|
83 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -46,8 +46,8 public: | |||||
46 |
|
46 | |||
47 | private: |
|
47 | private: | |
48 | QScopedPointer<QChartAxisCategoriesPrivate> d_ptr; |
|
48 | QScopedPointer<QChartAxisCategoriesPrivate> d_ptr; | |
49 |
friend class Q |
|
49 | friend class QAxisPrivate; | |
50 | friend class Axis; |
|
50 | friend class ChartAxis; | |
51 | }; |
|
51 | }; | |
52 |
|
52 | |||
53 |
|
53 |
@@ -26,7 +26,7 | |||||
26 | #include "qbarseries.h" |
|
26 | #include "qbarseries.h" | |
27 | #include "qbarseries_p.h" |
|
27 | #include "qbarseries_p.h" | |
28 | #include "qchart.h" |
|
28 | #include "qchart.h" | |
29 | #include "qchartaxis.h" |
|
29 | //#include "qchartaxis.h" | |
30 | #include "qchartaxiscategories.h" |
|
30 | #include "qchartaxiscategories.h" | |
31 | #include "chartpresenter_p.h" |
|
31 | #include "chartpresenter_p.h" | |
32 | #include "chartanimator_p.h" |
|
32 | #include "chartanimator_p.h" |
@@ -19,8 +19,8 | |||||
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "chartdataset_p.h" |
|
21 | #include "chartdataset_p.h" | |
22 |
#include "q |
|
22 | #include "qaxis.h" | |
23 |
#include "q |
|
23 | #include "qaxis_p.h" | |
24 | #include "qabstractseries_p.h" |
|
24 | #include "qabstractseries_p.h" | |
25 | #include "qbarseries.h" |
|
25 | #include "qbarseries.h" | |
26 | #include "qstackedbarseries.h" |
|
26 | #include "qstackedbarseries.h" | |
@@ -30,8 +30,8 | |||||
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
31 |
|
31 | |||
32 | ChartDataSet::ChartDataSet(QObject *parent):QObject(parent), |
|
32 | ChartDataSet::ChartDataSet(QObject *parent):QObject(parent), | |
33 |
m_axisX(new Q |
|
33 | m_axisX(new QAxis(this)), | |
34 |
m_axisY(new Q |
|
34 | m_axisY(new QAxis(this)), | |
35 | m_domainIndex(0), |
|
35 | m_domainIndex(0), | |
36 | m_axisXInitialized(false) |
|
36 | m_axisXInitialized(false) | |
37 | { |
|
37 | { | |
@@ -41,11 +41,11 ChartDataSet::~ChartDataSet() | |||||
41 | { |
|
41 | { | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 |
void ChartDataSet::addSeries(QAbstractSeries* series, Q |
|
44 | void ChartDataSet::addSeries(QAbstractSeries* series, QAxis *axisY) | |
45 | { |
|
45 | { | |
46 | if(axisY==0) axisY = m_axisY; |
|
46 | if(axisY==0) axisY = m_axisY; | |
47 |
|
47 | |||
48 |
Q |
|
48 | QAxis* axis = m_seriesAxisMap.value(series); | |
49 |
|
49 | |||
50 | if(axis) { |
|
50 | if(axis) { | |
51 | qWarning() << "Can not add series. Series already on the chart"; |
|
51 | qWarning() << "Can not add series. Series already on the chart"; | |
@@ -106,9 +106,9 void ChartDataSet::addSeries(QAbstractSeries* series, QChartAxis *axisY) | |||||
106 |
|
106 | |||
107 | } |
|
107 | } | |
108 |
|
108 | |||
109 |
Q |
|
109 | QAxis* ChartDataSet::removeSeries(QAbstractSeries* series) | |
110 | { |
|
110 | { | |
111 |
Q |
|
111 | QAxis* axis = m_seriesAxisMap.value(series); | |
112 |
|
112 | |||
113 | if(!axis){ |
|
113 | if(!axis){ | |
114 | qWarning()<<"Can not remove series. Series not found on the chart."; |
|
114 | qWarning()<<"Can not remove series. Series not found on the chart."; | |
@@ -124,7 +124,7 QChartAxis* ChartDataSet::removeSeries(QAbstractSeries* series) | |||||
124 | m_indexSeriesMap.remove(key); |
|
124 | m_indexSeriesMap.remove(key); | |
125 | series->setParent(0); |
|
125 | series->setParent(0); | |
126 |
|
126 | |||
127 |
QList<Q |
|
127 | QList<QAxis*> axes = m_seriesAxisMap.values(); | |
128 |
|
128 | |||
129 | int i = axes.indexOf(axis); |
|
129 | int i = axes.indexOf(axis); | |
130 |
|
130 | |||
@@ -149,9 +149,9 QChartAxis* ChartDataSet::removeSeries(QAbstractSeries* series) | |||||
149 | void ChartDataSet::removeAllSeries() |
|
149 | void ChartDataSet::removeAllSeries() | |
150 | { |
|
150 | { | |
151 | QList<QAbstractSeries*> series = m_seriesAxisMap.keys(); |
|
151 | QList<QAbstractSeries*> series = m_seriesAxisMap.keys(); | |
152 |
QList<Q |
|
152 | QList<QAxis*> axes; | |
153 | foreach(QAbstractSeries *s , series) { |
|
153 | foreach(QAbstractSeries *s , series) { | |
154 |
Q |
|
154 | QAxis* axis = removeSeries(s); | |
155 | if(axis==axisY()) continue; |
|
155 | if(axis==axisY()) continue; | |
156 | int i = axes.indexOf(axis); |
|
156 | int i = axes.indexOf(axis); | |
157 | if(i==-1){ |
|
157 | if(i==-1){ | |
@@ -175,7 +175,7 void ChartDataSet::setupCategories(QBarSeries* series) | |||||
175 |
|
175 | |||
176 | void ChartDataSet::zoomInDomain(const QRectF& rect, const QSizeF& size) |
|
176 | void ChartDataSet::zoomInDomain(const QRectF& rect, const QSizeF& size) | |
177 | { |
|
177 | { | |
178 |
QMapIterator<Q |
|
178 | QMapIterator<QAxis*, Domain*> i(m_axisDomainMap); | |
179 | while (i.hasNext()) { |
|
179 | while (i.hasNext()) { | |
180 | i.next(); |
|
180 | i.next(); | |
181 | i.value()->zoomIn(rect,size); |
|
181 | i.value()->zoomIn(rect,size); | |
@@ -184,7 +184,7 void ChartDataSet::zoomInDomain(const QRectF& rect, const QSizeF& size) | |||||
184 |
|
184 | |||
185 | void ChartDataSet::zoomOutDomain(const QRectF& rect, const QSizeF& size) |
|
185 | void ChartDataSet::zoomOutDomain(const QRectF& rect, const QSizeF& size) | |
186 | { |
|
186 | { | |
187 |
QMapIterator<Q |
|
187 | QMapIterator<QAxis*, Domain*> i(m_axisDomainMap); | |
188 | while (i.hasNext()) { |
|
188 | while (i.hasNext()) { | |
189 | i.next(); |
|
189 | i.next(); | |
190 | i.value()->zoomOut(rect,size); |
|
190 | i.value()->zoomOut(rect,size); | |
@@ -194,7 +194,7 void ChartDataSet::zoomOutDomain(const QRectF& rect, const QSizeF& size) | |||||
194 | int ChartDataSet::seriesCount(QAbstractSeries::QSeriesType type) |
|
194 | int ChartDataSet::seriesCount(QAbstractSeries::QSeriesType type) | |
195 | { |
|
195 | { | |
196 | int count=0; |
|
196 | int count=0; | |
197 |
QMapIterator<QAbstractSeries*, Q |
|
197 | QMapIterator<QAbstractSeries*, QAxis*> i(m_seriesAxisMap); | |
198 | while (i.hasNext()) { |
|
198 | while (i.hasNext()) { | |
199 | i.next(); |
|
199 | i.next(); | |
200 | if(i.key()->type()==type) count++; |
|
200 | if(i.key()->type()==type) count++; | |
@@ -213,7 +213,7 int ChartDataSet::seriesIndex(QAbstractSeries *series) | |||||
213 | return -1; |
|
213 | return -1; | |
214 | } |
|
214 | } | |
215 |
|
215 | |||
216 |
Q |
|
216 | QAxis* ChartDataSet::axisY(QAbstractSeries *series) const | |
217 | { |
|
217 | { | |
218 | if(series == 0) return m_axisY; |
|
218 | if(series == 0) return m_axisY; | |
219 | return m_seriesAxisMap.value(series); |
|
219 | return m_seriesAxisMap.value(series); | |
@@ -221,14 +221,14 QChartAxis* ChartDataSet::axisY(QAbstractSeries *series) const | |||||
221 |
|
221 | |||
222 | Domain* ChartDataSet::domain(QAbstractSeries *series) const |
|
222 | Domain* ChartDataSet::domain(QAbstractSeries *series) const | |
223 | { |
|
223 | { | |
224 |
Q |
|
224 | QAxis* axis = m_seriesAxisMap.value(series); | |
225 | if(axis){ |
|
225 | if(axis){ | |
226 | return m_axisDomainMap.value(axis); |
|
226 | return m_axisDomainMap.value(axis); | |
227 | }else |
|
227 | }else | |
228 | return 0; |
|
228 | return 0; | |
229 | } |
|
229 | } | |
230 |
|
230 | |||
231 |
Domain* ChartDataSet::domain(Q |
|
231 | Domain* ChartDataSet::domain(QAxis* axis) const | |
232 | { |
|
232 | { | |
233 | if(!axis || axis==axisX()) { |
|
233 | if(!axis || axis==axisX()) { | |
234 | return m_axisDomainMap.value(axisY()); |
|
234 | return m_axisDomainMap.value(axisY()); | |
@@ -240,7 +240,7 Domain* ChartDataSet::domain(QChartAxis* axis) const | |||||
240 |
|
240 | |||
241 | void ChartDataSet::scrollDomain(int dx,int dy,const QSizeF& size) |
|
241 | void ChartDataSet::scrollDomain(int dx,int dy,const QSizeF& size) | |
242 | { |
|
242 | { | |
243 |
QMapIterator<Q |
|
243 | QMapIterator<QAxis*, Domain*> i( m_axisDomainMap); | |
244 | while (i.hasNext()) { |
|
244 | while (i.hasNext()) { | |
245 | i.next(); |
|
245 | i.next(); | |
246 | i.value()->move(dx,dy,size); |
|
246 | i.value()->move(dx,dy,size); |
@@ -36,7 +36,7 | |||||
36 |
|
36 | |||
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
38 |
|
38 | |||
39 |
class Q |
|
39 | class QAxis; | |
40 | class QBarSeries; |
|
40 | class QBarSeries; | |
41 |
|
41 | |||
42 | class ChartDataSet : public QObject |
|
42 | class ChartDataSet : public QObject | |
@@ -46,8 +46,8 public: | |||||
46 | ChartDataSet(QObject* parent=0); |
|
46 | ChartDataSet(QObject* parent=0); | |
47 | virtual ~ChartDataSet(); |
|
47 | virtual ~ChartDataSet(); | |
48 |
|
48 | |||
49 |
void addSeries(QAbstractSeries* series,Q |
|
49 | void addSeries(QAbstractSeries* series,QAxis *axisY = 0); | |
50 |
Q |
|
50 | QAxis* removeSeries(QAbstractSeries* series); | |
51 | void removeAllSeries(); |
|
51 | void removeAllSeries(); | |
52 |
|
52 | |||
53 | void zoomInDomain(const QRectF& rect, const QSizeF& size); |
|
53 | void zoomInDomain(const QRectF& rect, const QSizeF& size); | |
@@ -58,28 +58,28 public: | |||||
58 | int seriesIndex(QAbstractSeries *series); |
|
58 | int seriesIndex(QAbstractSeries *series); | |
59 |
|
59 | |||
60 | Domain* domain(QAbstractSeries* series) const; |
|
60 | Domain* domain(QAbstractSeries* series) const; | |
61 |
Domain* domain(Q |
|
61 | Domain* domain(QAxis* axis) const; | |
62 |
|
62 | |||
63 |
Q |
|
63 | QAxis* axisX() const { return m_axisX; } | |
64 |
Q |
|
64 | QAxis* axisY(QAbstractSeries *series = 0) const; | |
65 |
|
65 | |||
66 | Q_SIGNALS: |
|
66 | Q_SIGNALS: | |
67 | void seriesAdded(QAbstractSeries* series, Domain* domain); |
|
67 | void seriesAdded(QAbstractSeries* series, Domain* domain); | |
68 | void seriesRemoved(QAbstractSeries* series); |
|
68 | void seriesRemoved(QAbstractSeries* series); | |
69 |
void axisAdded(Q |
|
69 | void axisAdded(QAxis* axis,Domain* domain); | |
70 |
void axisRemoved(Q |
|
70 | void axisRemoved(QAxis* axis); | |
71 |
|
71 | |||
72 | private: |
|
72 | private: | |
73 |
QStringList createLabels(Q |
|
73 | QStringList createLabels(QAxis* axis,qreal min, qreal max); | |
74 | void calculateDomain(QAbstractSeries* series,Domain* domain); |
|
74 | void calculateDomain(QAbstractSeries* series,Domain* domain); | |
75 | void setupCategories(QBarSeries* series); |
|
75 | void setupCategories(QBarSeries* series); | |
76 |
|
76 | |||
77 | private: |
|
77 | private: | |
78 |
QMap<QAbstractSeries *, Q |
|
78 | QMap<QAbstractSeries *, QAxis *> m_seriesAxisMap; | |
79 |
QMap<Q |
|
79 | QMap<QAxis*, Domain *> m_axisDomainMap; | |
80 | QMap<int, QAbstractSeries *> m_indexSeriesMap; |
|
80 | QMap<int, QAbstractSeries *> m_indexSeriesMap; | |
81 |
Q |
|
81 | QAxis* m_axisX; | |
82 |
Q |
|
82 | QAxis* m_axisY; | |
83 |
|
83 | |||
84 | int m_domainIndex; |
|
84 | int m_domainIndex; | |
85 | bool m_axisXInitialized; |
|
85 | bool m_axisXInitialized; |
@@ -20,14 +20,15 | |||||
20 | #include "chartpresenter_p.h" |
|
20 | #include "chartpresenter_p.h" | |
21 | #include "qchart.h" |
|
21 | #include "qchart.h" | |
22 | #include "qchart_p.h" |
|
22 | #include "qchart_p.h" | |
23 |
#include "q |
|
23 | #include "qaxis.h" | |
24 | #include "chartdataset_p.h" |
|
24 | #include "chartdataset_p.h" | |
25 | #include "charttheme_p.h" |
|
25 | #include "charttheme_p.h" | |
26 | #include "chartanimator_p.h" |
|
26 | #include "chartanimator_p.h" | |
27 | #include "qabstractseries_p.h" |
|
27 | #include "qabstractseries_p.h" | |
28 | #include "qareaseries.h" |
|
28 | #include "qareaseries.h" | |
29 | #include "axis_p.h" |
|
29 | #include "chartaxis_p.h" | |
30 | #include "areachartitem_p.h" |
|
30 | #include "areachartitem_p.h" | |
|
31 | #include "chartbackground_p.h" | |||
31 |
|
32 | |||
32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
33 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
33 |
|
34 | |||
@@ -61,10 +62,10 void ChartPresenter::setGeometry(const QRectF& rect) | |||||
61 | updateLayout(); |
|
62 | updateLayout(); | |
62 | } |
|
63 | } | |
63 |
|
64 | |||
64 | void ChartPresenter::setMinimumMarginWidth(Axis* axis, qreal width) |
|
65 | void ChartPresenter::setMinimumMarginWidth(ChartAxis* axis, qreal width) | |
65 | { |
|
66 | { | |
66 | switch(axis->axisType()){ |
|
67 | switch(axis->axisType()){ | |
67 | case Axis::X_AXIS: |
|
68 | case ChartAxis::X_AXIS: | |
68 | { |
|
69 | { | |
69 | if(width>m_chartRect.width()+ m_chartMargins.left()) { |
|
70 | if(width>m_chartRect.width()+ m_chartMargins.left()) { | |
70 | m_minLeftMargin= width - m_chartRect.width(); |
|
71 | m_minLeftMargin= width - m_chartRect.width(); | |
@@ -72,7 +73,7 void ChartPresenter::setMinimumMarginWidth(Axis* axis, qreal width) | |||||
72 | } |
|
73 | } | |
73 | break; |
|
74 | break; | |
74 | } |
|
75 | } | |
75 | case Axis::Y_AXIS: |
|
76 | case ChartAxis::Y_AXIS: | |
76 | { |
|
77 | { | |
77 |
|
78 | |||
78 | if(m_minLeftMargin!=width){ |
|
79 | if(m_minLeftMargin!=width){ | |
@@ -85,10 +86,10 void ChartPresenter::setMinimumMarginWidth(Axis* axis, qreal width) | |||||
85 | } |
|
86 | } | |
86 | } |
|
87 | } | |
87 |
|
88 | |||
88 | void ChartPresenter::setMinimumMarginHeight(Axis* axis, qreal height) |
|
89 | void ChartPresenter::setMinimumMarginHeight(ChartAxis* axis, qreal height) | |
89 | { |
|
90 | { | |
90 | switch(axis->axisType()){ |
|
91 | switch(axis->axisType()){ | |
91 | case Axis::X_AXIS: |
|
92 | case ChartAxis::X_AXIS: | |
92 | { |
|
93 | { | |
93 | if(m_minBottomMargin!=height) { |
|
94 | if(m_minBottomMargin!=height) { | |
94 | m_minBottomMargin= height; |
|
95 | m_minBottomMargin= height; | |
@@ -96,7 +97,7 void ChartPresenter::setMinimumMarginHeight(Axis* axis, qreal height) | |||||
96 | } |
|
97 | } | |
97 | break; |
|
98 | break; | |
98 | } |
|
99 | } | |
99 | case Axis::Y_AXIS: |
|
100 | case ChartAxis::Y_AXIS: | |
100 | { |
|
101 | { | |
101 |
|
102 | |||
102 | if(height>m_chartMargins.bottom()+m_chartRect.height()){ |
|
103 | if(height>m_chartMargins.bottom()+m_chartRect.height()){ | |
@@ -109,9 +110,9 void ChartPresenter::setMinimumMarginHeight(Axis* axis, qreal height) | |||||
109 | } |
|
110 | } | |
110 | } |
|
111 | } | |
111 |
|
112 | |||
112 |
void ChartPresenter::handleAxisAdded(Q |
|
113 | void ChartPresenter::handleAxisAdded(QAxis* axis,Domain* domain) | |
113 | { |
|
114 | { | |
114 | Axis* item = new Axis(axis,this,axis==m_dataset->axisX()?Axis::X_AXIS : Axis::Y_AXIS); |
|
115 | ChartAxis* item = new ChartAxis(axis,this,axis==m_dataset->axisX()?ChartAxis::X_AXIS : ChartAxis::Y_AXIS); | |
115 |
|
116 | |||
116 | if(m_options.testFlag(QChart::GridAxisAnimations)){ |
|
117 | if(m_options.testFlag(QChart::GridAxisAnimations)){ | |
117 | m_animator->addAnimation(item); |
|
118 | m_animator->addAnimation(item); | |
@@ -137,9 +138,9 void ChartPresenter::handleAxisAdded(QChartAxis* axis,Domain* domain) | |||||
137 | m_axisItems.insert(axis, item); |
|
138 | m_axisItems.insert(axis, item); | |
138 | } |
|
139 | } | |
139 |
|
140 | |||
140 |
void ChartPresenter::handleAxisRemoved(Q |
|
141 | void ChartPresenter::handleAxisRemoved(QAxis* axis) | |
141 | { |
|
142 | { | |
142 | Axis* item = m_axisItems.take(axis); |
|
143 | ChartAxis* item = m_axisItems.take(axis); | |
143 | Q_ASSERT(item); |
|
144 | Q_ASSERT(item); | |
144 | if(m_animator) m_animator->removeAnimation(item); |
|
145 | if(m_animator) m_animator->removeAnimation(item); | |
145 | delete item; |
|
146 | delete item; | |
@@ -207,10 +208,10 void ChartPresenter::setAnimationOptions(QChart::AnimationOptions options) | |||||
207 |
|
208 | |||
208 | void ChartPresenter::resetAllElements() |
|
209 | void ChartPresenter::resetAllElements() | |
209 | { |
|
210 | { | |
210 |
QList<Q |
|
211 | QList<QAxis *> axisList = m_axisItems.uniqueKeys(); | |
211 | QList<QAbstractSeries *> seriesList = m_chartItems.uniqueKeys(); |
|
212 | QList<QAbstractSeries *> seriesList = m_chartItems.uniqueKeys(); | |
212 |
|
213 | |||
213 |
foreach(Q |
|
214 | foreach(QAxis *axis, axisList) { | |
214 | handleAxisRemoved(axis); |
|
215 | handleAxisRemoved(axis); | |
215 | handleAxisAdded(axis,m_dataset->domain(axis)); |
|
216 | handleAxisAdded(axis,m_dataset->domain(axis)); | |
216 | } |
|
217 | } |
@@ -22,9 +22,7 | |||||
22 | #define CHARTPRESENTER_H |
|
22 | #define CHARTPRESENTER_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
24 | #include "qchartglobal.h" | |
25 | #include "chartbackground_p.h" //TODO fix me |
|
|||
26 | #include "qchart.h" //becouse of QChart::ChartThemeId //TODO |
|
25 | #include "qchart.h" //becouse of QChart::ChartThemeId //TODO | |
27 | #include "qchartaxis.h" |
|
|||
28 | #include <QRectF> |
|
26 | #include <QRectF> | |
29 |
|
27 | |||
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
@@ -33,9 +31,10 class Chart; | |||||
33 | class QAbstractSeries; |
|
31 | class QAbstractSeries; | |
34 | class ChartDataSet; |
|
32 | class ChartDataSet; | |
35 | class Domain; |
|
33 | class Domain; | |
36 | class Axis; |
|
34 | class ChartAxis; | |
37 | class ChartTheme; |
|
35 | class ChartTheme; | |
38 | class ChartAnimator; |
|
36 | class ChartAnimator; | |
|
37 | class ChartBackground; | |||
39 |
|
38 | |||
40 | class ChartPresenter: public QObject |
|
39 | class ChartPresenter: public QObject | |
41 | { |
|
40 | { | |
@@ -75,8 +74,8 public: | |||||
75 | void setGeometry(const QRectF& rect); |
|
74 | void setGeometry(const QRectF& rect); | |
76 | QRectF chartGeometry() const { return m_chartRect; } |
|
75 | QRectF chartGeometry() const { return m_chartRect; } | |
77 |
|
76 | |||
78 | void setMinimumMarginHeight(Axis* axis, qreal height); |
|
77 | void setMinimumMarginHeight(ChartAxis* axis, qreal height); | |
79 | void setMinimumMarginWidth(Axis* axis, qreal width); |
|
78 | void setMinimumMarginWidth(ChartAxis* axis, qreal width); | |
80 | qreal minimumLeftMargin() const { return m_minLeftMargin; } |
|
79 | qreal minimumLeftMargin() const { return m_minLeftMargin; } | |
81 | qreal minimumBottomMargin() const { return m_minBottomMargin; } |
|
80 | qreal minimumBottomMargin() const { return m_minBottomMargin; } | |
82 |
|
81 | |||
@@ -89,8 +88,8 public: //TODO: fix me | |||||
89 | public Q_SLOTS: |
|
88 | public Q_SLOTS: | |
90 | void handleSeriesAdded(QAbstractSeries* series,Domain* domain); |
|
89 | void handleSeriesAdded(QAbstractSeries* series,Domain* domain); | |
91 | void handleSeriesRemoved(QAbstractSeries* series); |
|
90 | void handleSeriesRemoved(QAbstractSeries* series); | |
92 |
void handleAxisAdded(Q |
|
91 | void handleAxisAdded(QAxis* axis,Domain* domain); | |
93 |
void handleAxisRemoved(Q |
|
92 | void handleAxisRemoved(QAxis* axis); | |
94 | void updateLayout(); |
|
93 | void updateLayout(); | |
95 |
|
94 | |||
96 | Q_SIGNALS: |
|
95 | Q_SIGNALS: | |
@@ -103,7 +102,7 private: | |||||
103 | ChartDataSet* m_dataset; |
|
102 | ChartDataSet* m_dataset; | |
104 | ChartTheme *m_chartTheme; |
|
103 | ChartTheme *m_chartTheme; | |
105 | QMap<QAbstractSeries *, Chart *> m_chartItems; |
|
104 | QMap<QAbstractSeries *, Chart *> m_chartItems; | |
106 |
QMap<Q |
|
105 | QMap<QAxis *, ChartAxis *> m_axisItems; | |
107 | QRectF m_rect; |
|
106 | QRectF m_rect; | |
108 | QRectF m_chartRect; |
|
107 | QRectF m_chartRect; | |
109 | QChart::AnimationOptions m_options; |
|
108 | QChart::AnimationOptions m_options; |
@@ -23,7 +23,7 | |||||
23 | #include "qchart_p.h" |
|
23 | #include "qchart_p.h" | |
24 | #include "qchartview.h" |
|
24 | #include "qchartview.h" | |
25 | #include "qlegend.h" |
|
25 | #include "qlegend.h" | |
26 |
#include "q |
|
26 | #include "qaxis.h" | |
27 | #include <QTime> |
|
27 | #include <QTime> | |
28 |
|
28 | |||
29 | //series |
|
29 | //series | |
@@ -39,7 +39,7 | |||||
39 | #include "qsplineseries.h" |
|
39 | #include "qsplineseries.h" | |
40 |
|
40 | |||
41 | //items |
|
41 | //items | |
42 | #include "axis_p.h" |
|
42 | #include "chartaxis_p.h" | |
43 | #include "barchartitem_p.h" |
|
43 | #include "barchartitem_p.h" | |
44 | #include "stackedbarchartitem_p.h" |
|
44 | #include "stackedbarchartitem_p.h" | |
45 | #include "percentbarchartitem_p.h" |
|
45 | #include "percentbarchartitem_p.h" | |
@@ -264,7 +264,7 void ChartTheme::decorate(QSplineSeries *series, int index) | |||||
264 | } |
|
264 | } | |
265 | } |
|
265 | } | |
266 |
|
266 | |||
267 |
void ChartTheme::decorate(Q |
|
267 | void ChartTheme::decorate(QAxis *axis,bool axisX) | |
268 | { |
|
268 | { | |
269 | QPen pen; |
|
269 | QPen pen; | |
270 | QBrush brush; |
|
270 | QBrush brush; |
@@ -69,7 +69,7 public: | |||||
69 | void decorate(QScatterSeries *series, int index); |
|
69 | void decorate(QScatterSeries *series, int index); | |
70 | void decorate(QPieSeries *series, int index); |
|
70 | void decorate(QPieSeries *series, int index); | |
71 | void decorate(QSplineSeries *series, int index); |
|
71 | void decorate(QSplineSeries *series, int index); | |
72 |
void decorate(Q |
|
72 | void decorate(QAxis *axis, bool axisX); | |
73 | void setForced(bool enabled); |
|
73 | void setForced(bool enabled); | |
74 | bool isForced() { return m_force; } |
|
74 | bool isForced() { return m_force; } | |
75 |
|
75 |
@@ -22,6 +22,8 | |||||
22 | #include "qchart_p.h" |
|
22 | #include "qchart_p.h" | |
23 | #include "legendscroller_p.h" |
|
23 | #include "legendscroller_p.h" | |
24 | #include "qlegend_p.h" |
|
24 | #include "qlegend_p.h" | |
|
25 | #include "chartbackground_p.h" | |||
|
26 | #include "qaxis.h" | |||
25 | #include <QGraphicsScene> |
|
27 | #include <QGraphicsScene> | |
26 | #include <QGraphicsSceneResizeEvent> |
|
28 | #include <QGraphicsSceneResizeEvent> | |
27 |
|
29 | |||
@@ -91,7 +93,7 QChart::~QChart() | |||||
91 | If auto scaling is enabled, re-scales the axes the series is bound to (both the x axis and |
|
93 | If auto scaling is enabled, re-scales the axes the series is bound to (both the x axis and | |
92 | the y axis). |
|
94 | the y axis). | |
93 | */ |
|
95 | */ | |
94 |
void QChart::addSeries(QAbstractSeries *series, Q |
|
96 | void QChart::addSeries(QAbstractSeries *series, QAxis *axisY) | |
95 | { |
|
97 | { | |
96 | Q_ASSERT(series); |
|
98 | Q_ASSERT(series); | |
97 | d_ptr->m_dataset->addSeries(series, axisY); |
|
99 | d_ptr->m_dataset->addSeries(series, axisY); | |
@@ -273,7 +275,7 void QChart::zoomOut() | |||||
273 | /*! |
|
275 | /*! | |
274 | Returns the pointer to the x axis object of the chart |
|
276 | Returns the pointer to the x axis object of the chart | |
275 | */ |
|
277 | */ | |
276 |
Q |
|
278 | QAxis* QChart::axisX() const | |
277 | { |
|
279 | { | |
278 | return d_ptr->m_dataset->axisX(); |
|
280 | return d_ptr->m_dataset->axisX(); | |
279 | } |
|
281 | } | |
@@ -282,7 +284,7 QChartAxis* QChart::axisX() const | |||||
282 | Returns the pointer to the y axis object of the \a series |
|
284 | Returns the pointer to the y axis object of the \a series | |
283 | If no \a series is provided then default Y axis of the chart is returned. |
|
285 | If no \a series is provided then default Y axis of the chart is returned. | |
284 | */ |
|
286 | */ | |
285 |
Q |
|
287 | QAxis* QChart::axisY(QAbstractSeries *series) const | |
286 | { |
|
288 | { | |
287 | return d_ptr->m_dataset->axisY(series); |
|
289 | return d_ptr->m_dataset->axisY(series); | |
288 | } |
|
290 | } | |
@@ -425,8 +427,8 void QChartPrivate::createConnections() | |||||
425 |
|
427 | |||
426 | QObject::connect(m_dataset,SIGNAL(seriesAdded(QAbstractSeries *, Domain *)),m_presenter,SLOT(handleSeriesAdded(QAbstractSeries *, Domain *))); |
|
428 | QObject::connect(m_dataset,SIGNAL(seriesAdded(QAbstractSeries *, Domain *)),m_presenter,SLOT(handleSeriesAdded(QAbstractSeries *, Domain *))); | |
427 | QObject::connect(m_dataset,SIGNAL(seriesRemoved(QAbstractSeries *)),m_presenter,SLOT(handleSeriesRemoved(QAbstractSeries *))); |
|
429 | QObject::connect(m_dataset,SIGNAL(seriesRemoved(QAbstractSeries *)),m_presenter,SLOT(handleSeriesRemoved(QAbstractSeries *))); | |
428 |
QObject::connect(m_dataset,SIGNAL(axisAdded(Q |
|
430 | QObject::connect(m_dataset,SIGNAL(axisAdded(QAxis*,Domain*)),m_presenter,SLOT(handleAxisAdded(QAxis*,Domain*))); | |
429 |
QObject::connect(m_dataset,SIGNAL(axisRemoved(Q |
|
431 | QObject::connect(m_dataset,SIGNAL(axisRemoved(QAxis*)),m_presenter,SLOT(handleAxisRemoved(QAxis*))); | |
430 | } |
|
432 | } | |
431 |
|
433 | |||
432 | #include "moc_qchart.cpp" |
|
434 | #include "moc_qchart.cpp" |
@@ -30,7 +30,7 class QGraphicsSceneResizeEvent; | |||||
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
31 |
|
31 | |||
32 | class QAbstractSeries; |
|
32 | class QAbstractSeries; | |
33 |
class Q |
|
33 | class QAxis; | |
34 | class QLegend; |
|
34 | class QLegend; | |
35 | struct QChartPrivate; |
|
35 | struct QChartPrivate; | |
36 |
|
36 | |||
@@ -63,7 +63,7 public: | |||||
63 | explicit QChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); |
|
63 | explicit QChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); | |
64 | ~QChart(); |
|
64 | ~QChart(); | |
65 |
|
65 | |||
66 |
void addSeries(QAbstractSeries *series, Q |
|
66 | void addSeries(QAbstractSeries *series, QAxis *axisY = 0); | |
67 | void removeSeries(QAbstractSeries *series); |
|
67 | void removeSeries(QAbstractSeries *series); | |
68 | void removeAllSeries(); |
|
68 | void removeAllSeries(); | |
69 |
|
69 | |||
@@ -97,8 +97,8 public: | |||||
97 | void scrollUp(); |
|
97 | void scrollUp(); | |
98 | void scrollDown(); |
|
98 | void scrollDown(); | |
99 |
|
99 | |||
100 |
Q |
|
100 | QAxis* axisX() const; | |
101 |
Q |
|
101 | QAxis* axisY(QAbstractSeries* series = 0) const; | |
102 |
|
102 | |||
103 | QLegend* legend() const; |
|
103 | QLegend* legend() const; | |
104 | QRectF margins() const; |
|
104 | QRectF margins() const; |
@@ -21,7 +21,7 | |||||
21 | #ifndef QCHARTVIEW_H |
|
21 | #ifndef QCHARTVIEW_H | |
22 | #define QCHARTVIEW_H |
|
22 | #define QCHARTVIEW_H | |
23 |
|
23 | |||
24 |
#include <Q |
|
24 | #include <QAxis> | |
25 | #include <QAbstractSeries> |
|
25 | #include <QAbstractSeries> | |
26 | #include <QChart> |
|
26 | #include <QChart> | |
27 | #include <QGraphicsView> |
|
27 | #include <QGraphicsView> |
@@ -19,7 +19,7 | |||||
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include <QtTest/QtTest> |
|
21 | #include <QtTest/QtTest> | |
22 |
#include <q |
|
22 | #include <qaxis.h> | |
23 | #include <qlineseries.h> |
|
23 | #include <qlineseries.h> | |
24 | #include <private/chartdataset_p.h> |
|
24 | #include <private/chartdataset_p.h> | |
25 | #include <private/domain_p.h> |
|
25 | #include <private/domain_p.h> | |
@@ -27,7 +27,7 | |||||
27 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
27 | QTCOMMERCIALCHART_USE_NAMESPACE | |
28 |
|
28 | |||
29 | Q_DECLARE_METATYPE(Domain *) |
|
29 | Q_DECLARE_METATYPE(Domain *) | |
30 |
Q_DECLARE_METATYPE(Q |
|
30 | Q_DECLARE_METATYPE(QAxis *) | |
31 | Q_DECLARE_METATYPE(QAbstractSeries *) |
|
31 | Q_DECLARE_METATYPE(QAbstractSeries *) | |
32 | Q_DECLARE_METATYPE(QLineSeries *) |
|
32 | Q_DECLARE_METATYPE(QLineSeries *) | |
33 |
|
33 | |||
@@ -69,7 +69,7 private Q_SLOTS: | |||||
69 | void tst_ChartDataSet::initTestCase() |
|
69 | void tst_ChartDataSet::initTestCase() | |
70 | { |
|
70 | { | |
71 | qRegisterMetaType<Domain*>(); |
|
71 | qRegisterMetaType<Domain*>(); | |
72 |
qRegisterMetaType<Q |
|
72 | qRegisterMetaType<QAxis*>(); | |
73 | qRegisterMetaType<QAbstractSeries*>(); |
|
73 | qRegisterMetaType<QAbstractSeries*>(); | |
74 | } |
|
74 | } | |
75 |
|
75 | |||
@@ -104,40 +104,40 void tst_ChartDataSet::chartdataset() | |||||
104 | void tst_ChartDataSet::addSeries_data() |
|
104 | void tst_ChartDataSet::addSeries_data() | |
105 | { |
|
105 | { | |
106 | QTest::addColumn<QLineSeries*>("series0"); |
|
106 | QTest::addColumn<QLineSeries*>("series0"); | |
107 |
QTest::addColumn<Q |
|
107 | QTest::addColumn<QAxis*>("axis0"); | |
108 | QTest::addColumn<QLineSeries*>("series1"); |
|
108 | QTest::addColumn<QLineSeries*>("series1"); | |
109 |
QTest::addColumn<Q |
|
109 | QTest::addColumn<QAxis*>("axis1"); | |
110 | QTest::addColumn<QLineSeries*>("series2"); |
|
110 | QTest::addColumn<QLineSeries*>("series2"); | |
111 |
QTest::addColumn<Q |
|
111 | QTest::addColumn<QAxis*>("axis2"); | |
112 | QTest::addColumn<int>("axisCount"); |
|
112 | QTest::addColumn<int>("axisCount"); | |
113 |
|
113 | |||
114 | QLineSeries* series0 = new QLineSeries(this); |
|
114 | QLineSeries* series0 = new QLineSeries(this); | |
115 | QLineSeries* series1 = new QLineSeries(this); |
|
115 | QLineSeries* series1 = new QLineSeries(this); | |
116 | QLineSeries* series2 = new QLineSeries(this); |
|
116 | QLineSeries* series2 = new QLineSeries(this); | |
117 |
|
117 | |||
118 |
Q |
|
118 | QAxis* axis0 = new QAxis(this); | |
119 |
Q |
|
119 | QAxis* axis1 = new QAxis(this); | |
120 |
Q |
|
120 | QAxis* axis2 = new QAxis(this); | |
121 |
|
121 | |||
122 |
QTest::newRow("default axis Y: series0,series1,series2") << series0 << (Q |
|
122 | QTest::newRow("default axis Y: series0,series1,series2") << series0 << (QAxis*)0 << series1 << (QAxis*)0 << series2 << (QAxis*)0 << 2; | |
123 |
QTest::newRow("default axis Y: series0, axis 0: series1,series2") << series0 << (Q |
|
123 | QTest::newRow("default axis Y: series0, axis 0: series1,series2") << series0 << (QAxis*)0 << series1 << axis0 << series2 << axis0 << 3; | |
124 | QTest::newRow("axis0: series0, axis1: series1, axis2: series2") << series0 << axis0 << series1 << axis1 << series2 << axis2 << 4; |
|
124 | QTest::newRow("axis0: series0, axis1: series1, axis2: series2") << series0 << axis0 << series1 << axis1 << series2 << axis2 << 4; | |
125 | } |
|
125 | } | |
126 |
|
126 | |||
127 | void tst_ChartDataSet::addSeries() |
|
127 | void tst_ChartDataSet::addSeries() | |
128 | { |
|
128 | { | |
129 | QFETCH(QLineSeries*, series0); |
|
129 | QFETCH(QLineSeries*, series0); | |
130 |
QFETCH(Q |
|
130 | QFETCH(QAxis*, axis0); | |
131 | QFETCH(QLineSeries*, series1); |
|
131 | QFETCH(QLineSeries*, series1); | |
132 |
QFETCH(Q |
|
132 | QFETCH(QAxis*, axis1); | |
133 | QFETCH(QLineSeries*, series2); |
|
133 | QFETCH(QLineSeries*, series2); | |
134 |
QFETCH(Q |
|
134 | QFETCH(QAxis*, axis2); | |
135 | QFETCH(int, axisCount); |
|
135 | QFETCH(int, axisCount); | |
136 |
|
136 | |||
137 | ChartDataSet dataSet; |
|
137 | ChartDataSet dataSet; | |
138 |
|
138 | |||
139 |
QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(Q |
|
139 | QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(QAxis*,Domain*))); | |
140 |
QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(Q |
|
140 | QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(QAxis*))); | |
141 | QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QAbstractSeries *,Domain*))); |
|
141 | QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QAbstractSeries *,Domain*))); | |
142 | QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QAbstractSeries *))); |
|
142 | QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QAbstractSeries *))); | |
143 |
|
143 | |||
@@ -167,11 +167,11 void tst_ChartDataSet::removeSeries_data() | |||||
167 | void tst_ChartDataSet::removeSeries() |
|
167 | void tst_ChartDataSet::removeSeries() | |
168 | { |
|
168 | { | |
169 | QFETCH(QLineSeries*, series0); |
|
169 | QFETCH(QLineSeries*, series0); | |
170 |
QFETCH(Q |
|
170 | QFETCH(QAxis*, axis0); | |
171 | QFETCH(QLineSeries*, series1); |
|
171 | QFETCH(QLineSeries*, series1); | |
172 |
QFETCH(Q |
|
172 | QFETCH(QAxis*, axis1); | |
173 | QFETCH(QLineSeries*, series2); |
|
173 | QFETCH(QLineSeries*, series2); | |
174 |
QFETCH(Q |
|
174 | QFETCH(QAxis*, axis2); | |
175 | QFETCH(int, axisCount); |
|
175 | QFETCH(int, axisCount); | |
176 |
|
176 | |||
177 | ChartDataSet dataSet; |
|
177 | ChartDataSet dataSet; | |
@@ -180,8 +180,8 void tst_ChartDataSet::removeSeries() | |||||
180 | dataSet.addSeries(series1,axis1); |
|
180 | dataSet.addSeries(series1,axis1); | |
181 | dataSet.addSeries(series2,axis2); |
|
181 | dataSet.addSeries(series2,axis2); | |
182 |
|
182 | |||
183 |
QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(Q |
|
183 | QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(QAxis *, Domain *))); | |
184 |
QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(Q |
|
184 | QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(QAxis *))); | |
185 | QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QAbstractSeries *, Domain *))); |
|
185 | QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QAbstractSeries *, Domain *))); | |
186 | QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QAbstractSeries *))); |
|
186 | QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QAbstractSeries *))); | |
187 |
|
187 | |||
@@ -206,9 +206,9 void tst_ChartDataSet::removeAllSeries() | |||||
206 | QLineSeries* series1 = new QLineSeries(this); |
|
206 | QLineSeries* series1 = new QLineSeries(this); | |
207 | QLineSeries* series2 = new QLineSeries(this); |
|
207 | QLineSeries* series2 = new QLineSeries(this); | |
208 |
|
208 | |||
209 |
Q |
|
209 | QAxis* axis0 = new QAxis(this); | |
210 |
Q |
|
210 | QAxis* axis1 = new QAxis(this); | |
211 |
Q |
|
211 | QAxis* axis2 = new QAxis(this); | |
212 |
|
212 | |||
213 |
|
213 | |||
214 | ChartDataSet dataSet; |
|
214 | ChartDataSet dataSet; | |
@@ -217,8 +217,8 void tst_ChartDataSet::removeAllSeries() | |||||
217 | dataSet.addSeries(series1, axis1); |
|
217 | dataSet.addSeries(series1, axis1); | |
218 | dataSet.addSeries(series2, axis2); |
|
218 | dataSet.addSeries(series2, axis2); | |
219 |
|
219 | |||
220 |
QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(Q |
|
220 | QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(QAxis *, Domain *))); | |
221 |
QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(Q |
|
221 | QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(QAxis *))); | |
222 | QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QAbstractSeries *, Domain *))); |
|
222 | QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QAbstractSeries *, Domain *))); | |
223 | QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QAbstractSeries *))); |
|
223 | QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QAbstractSeries *))); | |
224 |
|
224 | |||
@@ -233,22 +233,22 void tst_ChartDataSet::removeAllSeries() | |||||
233 |
|
233 | |||
234 | void tst_ChartDataSet::axisY_data() |
|
234 | void tst_ChartDataSet::axisY_data() | |
235 | { |
|
235 | { | |
236 |
QTest::addColumn<Q |
|
236 | QTest::addColumn<QAxis*>("axis0"); | |
237 |
QTest::addColumn<Q |
|
237 | QTest::addColumn<QAxis*>("axis1"); | |
238 |
QTest::addColumn<Q |
|
238 | QTest::addColumn<QAxis*>("axis2"); | |
239 |
QTest::newRow("1 defualt, 2 optional") << (Q |
|
239 | QTest::newRow("1 defualt, 2 optional") << (QAxis*)0 << new QAxis() << new QAxis(); | |
240 |
QTest::newRow("3 optional") << new Q |
|
240 | QTest::newRow("3 optional") << new QAxis() << new QAxis() << new QAxis(); | |
241 | } |
|
241 | } | |
242 |
|
242 | |||
243 | void tst_ChartDataSet::axisY() |
|
243 | void tst_ChartDataSet::axisY() | |
244 | { |
|
244 | { | |
245 |
QFETCH(Q |
|
245 | QFETCH(QAxis*, axis0); | |
246 |
QFETCH(Q |
|
246 | QFETCH(QAxis*, axis1); | |
247 |
QFETCH(Q |
|
247 | QFETCH(QAxis*, axis2); | |
248 |
|
248 | |||
249 | ChartDataSet dataSet; |
|
249 | ChartDataSet dataSet; | |
250 |
|
250 | |||
251 |
Q |
|
251 | QAxis* defaultAxisY = dataSet.axisY(); | |
252 |
|
252 | |||
253 | QVERIFY2(defaultAxisY, "Missing axisY."); |
|
253 | QVERIFY2(defaultAxisY, "Missing axisY."); | |
254 |
|
254 | |||
@@ -279,11 +279,11 void tst_ChartDataSet::seriesCount_data() | |||||
279 | void tst_ChartDataSet::seriesCount() |
|
279 | void tst_ChartDataSet::seriesCount() | |
280 | { |
|
280 | { | |
281 | QFETCH(QLineSeries*, series0); |
|
281 | QFETCH(QLineSeries*, series0); | |
282 |
QFETCH(Q |
|
282 | QFETCH(QAxis*, axis0); | |
283 | QFETCH(QLineSeries*, series1); |
|
283 | QFETCH(QLineSeries*, series1); | |
284 |
QFETCH(Q |
|
284 | QFETCH(QAxis*, axis1); | |
285 | QFETCH(QLineSeries*, series2); |
|
285 | QFETCH(QLineSeries*, series2); | |
286 |
QFETCH(Q |
|
286 | QFETCH(QAxis*, axis2); | |
287 | QFETCH(int, axisCount); |
|
287 | QFETCH(int, axisCount); | |
288 | Q_UNUSED(axisCount); |
|
288 | Q_UNUSED(axisCount); | |
289 |
|
289 | |||
@@ -293,8 +293,8 void tst_ChartDataSet::seriesCount() | |||||
293 | dataSet.addSeries(series1, axis1); |
|
293 | dataSet.addSeries(series1, axis1); | |
294 | dataSet.addSeries(series2, axis2); |
|
294 | dataSet.addSeries(series2, axis2); | |
295 |
|
295 | |||
296 |
QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(Q |
|
296 | QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(QAxis *, Domain *))); | |
297 |
QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(Q |
|
297 | QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(QAxis *))); | |
298 | QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QAbstractSeries *, Domain *))); |
|
298 | QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QAbstractSeries *, Domain *))); | |
299 | QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QAbstractSeries *))); |
|
299 | QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QAbstractSeries *))); | |
300 |
|
300 | |||
@@ -319,11 +319,11 void tst_ChartDataSet::seriesIndex() | |||||
319 | //TODO: rewrite this series_index_data to match better |
|
319 | //TODO: rewrite this series_index_data to match better | |
320 |
|
320 | |||
321 | QFETCH(QLineSeries*, series0); |
|
321 | QFETCH(QLineSeries*, series0); | |
322 |
QFETCH(Q |
|
322 | QFETCH(QAxis*, axis0); | |
323 | QFETCH(QLineSeries*, series1); |
|
323 | QFETCH(QLineSeries*, series1); | |
324 |
QFETCH(Q |
|
324 | QFETCH(QAxis*, axis1); | |
325 | QFETCH(QLineSeries*, series2); |
|
325 | QFETCH(QLineSeries*, series2); | |
326 |
QFETCH(Q |
|
326 | QFETCH(QAxis*, axis2); | |
327 | QFETCH(int, axisCount); |
|
327 | QFETCH(int, axisCount); | |
328 | Q_UNUSED(axisCount); |
|
328 | Q_UNUSED(axisCount); | |
329 |
|
329 | |||
@@ -333,8 +333,8 void tst_ChartDataSet::seriesIndex() | |||||
333 | dataSet.addSeries(series1, axis1); |
|
333 | dataSet.addSeries(series1, axis1); | |
334 | dataSet.addSeries(series2, axis2); |
|
334 | dataSet.addSeries(series2, axis2); | |
335 |
|
335 | |||
336 |
QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(Q |
|
336 | QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(QAxis*,Domain*))); | |
337 |
QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(Q |
|
337 | QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(QAxis*))); | |
338 | QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QSeries*,Domain*))); |
|
338 | QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QSeries*,Domain*))); | |
339 | QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QSeries*))); |
|
339 | QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QSeries*))); | |
340 |
|
340 | |||
@@ -408,11 +408,11 void tst_ChartDataSet::domain_data() | |||||
408 | void tst_ChartDataSet::domain() |
|
408 | void tst_ChartDataSet::domain() | |
409 | { |
|
409 | { | |
410 | QFETCH(QLineSeries*, series0); |
|
410 | QFETCH(QLineSeries*, series0); | |
411 |
QFETCH(Q |
|
411 | QFETCH(QAxis*, axis0); | |
412 | QFETCH(QLineSeries*, series1); |
|
412 | QFETCH(QLineSeries*, series1); | |
413 |
QFETCH(Q |
|
413 | QFETCH(QAxis*, axis1); | |
414 | QFETCH(QLineSeries*, series2); |
|
414 | QFETCH(QLineSeries*, series2); | |
415 |
QFETCH(Q |
|
415 | QFETCH(QAxis*, axis2); | |
416 | QFETCH(int, axisCount); |
|
416 | QFETCH(int, axisCount); | |
417 | Q_UNUSED(axisCount); |
|
417 | Q_UNUSED(axisCount); | |
418 |
|
418 | |||
@@ -422,8 +422,8 void tst_ChartDataSet::domain() | |||||
422 | dataSet.addSeries(series1, axis1); |
|
422 | dataSet.addSeries(series1, axis1); | |
423 | dataSet.addSeries(series2, axis2); |
|
423 | dataSet.addSeries(series2, axis2); | |
424 |
|
424 | |||
425 |
QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(Q |
|
425 | QSignalSpy spy0(&dataSet, SIGNAL(axisAdded(QAxis *, Domain *))); | |
426 |
QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(Q |
|
426 | QSignalSpy spy1(&dataSet, SIGNAL(axisRemoved(QAxis *))); | |
427 | QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QAbstractSeries *, Domain *))); |
|
427 | QSignalSpy spy2(&dataSet, SIGNAL(seriesAdded(QAbstractSeries *, Domain *))); | |
428 | QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QAbstractSeries *))); |
|
428 | QSignalSpy spy3(&dataSet, SIGNAL(seriesRemoved(QAbstractSeries *))); | |
429 |
|
429 | |||
@@ -448,11 +448,11 void tst_ChartDataSet::zoomInDomain_data() | |||||
448 | void tst_ChartDataSet::zoomInDomain() |
|
448 | void tst_ChartDataSet::zoomInDomain() | |
449 | { |
|
449 | { | |
450 | QFETCH(QLineSeries*, series0); |
|
450 | QFETCH(QLineSeries*, series0); | |
451 |
QFETCH(Q |
|
451 | QFETCH(QAxis*, axis0); | |
452 | QFETCH(QLineSeries*, series1); |
|
452 | QFETCH(QLineSeries*, series1); | |
453 |
QFETCH(Q |
|
453 | QFETCH(QAxis*, axis1); | |
454 | QFETCH(QLineSeries*, series2); |
|
454 | QFETCH(QLineSeries*, series2); | |
455 |
QFETCH(Q |
|
455 | QFETCH(QAxis*, axis2); | |
456 | QFETCH(int, axisCount); |
|
456 | QFETCH(int, axisCount); | |
457 |
|
457 | |||
458 | Q_UNUSED(axisCount); |
|
458 | Q_UNUSED(axisCount); | |
@@ -489,11 +489,11 void tst_ChartDataSet::zoomOutDomain_data() | |||||
489 | void tst_ChartDataSet::zoomOutDomain() |
|
489 | void tst_ChartDataSet::zoomOutDomain() | |
490 | { |
|
490 | { | |
491 | QFETCH(QLineSeries*, series0); |
|
491 | QFETCH(QLineSeries*, series0); | |
492 |
QFETCH(Q |
|
492 | QFETCH(QAxis*, axis0); | |
493 | QFETCH(QLineSeries*, series1); |
|
493 | QFETCH(QLineSeries*, series1); | |
494 |
QFETCH(Q |
|
494 | QFETCH(QAxis*, axis1); | |
495 | QFETCH(QLineSeries*, series2); |
|
495 | QFETCH(QLineSeries*, series2); | |
496 |
QFETCH(Q |
|
496 | QFETCH(QAxis*, axis2); | |
497 | QFETCH(int, axisCount); |
|
497 | QFETCH(int, axisCount); | |
498 |
|
498 | |||
499 | Q_UNUSED(axisCount); |
|
499 | Q_UNUSED(axisCount); | |
@@ -531,11 +531,11 void tst_ChartDataSet::scrollDomain_data() | |||||
531 | void tst_ChartDataSet::scrollDomain() |
|
531 | void tst_ChartDataSet::scrollDomain() | |
532 | { |
|
532 | { | |
533 | QFETCH(QLineSeries*, series0); |
|
533 | QFETCH(QLineSeries*, series0); | |
534 |
QFETCH(Q |
|
534 | QFETCH(QAxis*, axis0); | |
535 | QFETCH(QLineSeries*, series1); |
|
535 | QFETCH(QLineSeries*, series1); | |
536 |
QFETCH(Q |
|
536 | QFETCH(QAxis*, axis1); | |
537 | QFETCH(QLineSeries*, series2); |
|
537 | QFETCH(QLineSeries*, series2); | |
538 |
QFETCH(Q |
|
538 | QFETCH(QAxis*, axis2); | |
539 | QFETCH(int, axisCount); |
|
539 | QFETCH(int, axisCount); | |
540 |
|
540 | |||
541 | Q_UNUSED(axisCount); |
|
541 | Q_UNUSED(axisCount); |
@@ -20,7 +20,7 | |||||
20 |
|
20 | |||
21 | #include <QtTest/QtTest> |
|
21 | #include <QtTest/QtTest> | |
22 | #include <private/domain_p.h> |
|
22 | #include <private/domain_p.h> | |
23 |
#include <q |
|
23 | #include <qaxis.h> | |
24 |
|
24 | |||
25 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
25 | QTCOMMERCIALCHART_USE_NAMESPACE | |
26 |
|
26 |
@@ -11,7 +11,7 | |||||
11 |
|
11 | |||
12 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
12 | QTCOMMERCIALCHART_USE_NAMESPACE | |
13 |
|
13 | |||
14 |
Q_DECLARE_METATYPE(Q |
|
14 | Q_DECLARE_METATYPE(QAxis *) | |
15 | Q_DECLARE_METATYPE(QAbstractSeries *) |
|
15 | Q_DECLARE_METATYPE(QAbstractSeries *) | |
16 | Q_DECLARE_METATYPE(QChart::AnimationOption) |
|
16 | Q_DECLARE_METATYPE(QChart::AnimationOption) | |
17 | Q_DECLARE_METATYPE(QBrush) |
|
17 | Q_DECLARE_METATYPE(QBrush) | |
@@ -157,7 +157,7 void tst_QChart::qchart() | |||||
157 | void tst_QChart::addSeries_data() |
|
157 | void tst_QChart::addSeries_data() | |
158 | { |
|
158 | { | |
159 | QTest::addColumn<QAbstractSeries *>("series"); |
|
159 | QTest::addColumn<QAbstractSeries *>("series"); | |
160 |
QTest::addColumn<Q |
|
160 | QTest::addColumn<QAxis *>("axis"); | |
161 |
|
161 | |||
162 | QAbstractSeries* series0 = new QLineSeries(this); |
|
162 | QAbstractSeries* series0 = new QLineSeries(this); | |
163 | QAbstractSeries* series1 = new QAreaSeries(static_cast<QLineSeries*>(series0)); |
|
163 | QAbstractSeries* series1 = new QAreaSeries(static_cast<QLineSeries*>(series0)); | |
@@ -168,23 +168,23 void tst_QChart::addSeries_data() | |||||
168 | QAbstractSeries* series6 = new QPercentBarSeries(QBarCategories(),this); |
|
168 | QAbstractSeries* series6 = new QPercentBarSeries(QBarCategories(),this); | |
169 | QAbstractSeries* series7 = new QStackedBarSeries(QBarCategories(),this); |
|
169 | QAbstractSeries* series7 = new QStackedBarSeries(QBarCategories(),this); | |
170 |
|
170 | |||
171 |
Q |
|
171 | QAxis* axis = new QAxis(this); | |
172 |
|
172 | |||
173 |
QTest::newRow("default axis: lineSeries") << series0 << (Q |
|
173 | QTest::newRow("default axis: lineSeries") << series0 << (QAxis*) 0; | |
174 | QTest::newRow("axis0: lineSeries") << series0 << axis; |
|
174 | QTest::newRow("axis0: lineSeries") << series0 << axis; | |
175 |
QTest::newRow("default axis: areaSeries") << series1 << (Q |
|
175 | QTest::newRow("default axis: areaSeries") << series1 << (QAxis*) 0; | |
176 | QTest::newRow("axis: areaSeries") << series1 << axis; |
|
176 | QTest::newRow("axis: areaSeries") << series1 << axis; | |
177 |
QTest::newRow("default axis: scatterSeries") << series2 << (Q |
|
177 | QTest::newRow("default axis: scatterSeries") << series2 << (QAxis*) 0; | |
178 | QTest::newRow("axis1: scatterSeries") << series2 << axis; |
|
178 | QTest::newRow("axis1: scatterSeries") << series2 << axis; | |
179 |
QTest::newRow("default axis: splineSeries") << series3 << (Q |
|
179 | QTest::newRow("default axis: splineSeries") << series3 << (QAxis*) 0; | |
180 | QTest::newRow("axis: splineSeries") << series3 << axis; |
|
180 | QTest::newRow("axis: splineSeries") << series3 << axis; | |
181 |
QTest::newRow("default axis: pieSeries") << series4 << (Q |
|
181 | QTest::newRow("default axis: pieSeries") << series4 << (QAxis*) 0; | |
182 | QTest::newRow("axis: pieSeries") << series4 << axis; |
|
182 | QTest::newRow("axis: pieSeries") << series4 << axis; | |
183 |
QTest::newRow("default axis: barSeries") << series5 << (Q |
|
183 | QTest::newRow("default axis: barSeries") << series5 << (QAxis*) 0; | |
184 | QTest::newRow("axis: barSeries") << series5 << axis; |
|
184 | QTest::newRow("axis: barSeries") << series5 << axis; | |
185 |
QTest::newRow("default axis: percentBarSeries") << series6 << (Q |
|
185 | QTest::newRow("default axis: percentBarSeries") << series6 << (QAxis*) 0; | |
186 | QTest::newRow("axis: barSeries") << series6 << axis; |
|
186 | QTest::newRow("axis: barSeries") << series6 << axis; | |
187 |
QTest::newRow("default axis: stackedBarSeries") << series7 << (Q |
|
187 | QTest::newRow("default axis: stackedBarSeries") << series7 << (QAxis*) 0; | |
188 | QTest::newRow("axis: barSeries") << series7 << axis; |
|
188 | QTest::newRow("axis: barSeries") << series7 << axis; | |
189 |
|
189 | |||
190 | } |
|
190 | } | |
@@ -192,7 +192,7 void tst_QChart::addSeries_data() | |||||
192 | void tst_QChart::addSeries() |
|
192 | void tst_QChart::addSeries() | |
193 | { |
|
193 | { | |
194 | QFETCH(QAbstractSeries *, series); |
|
194 | QFETCH(QAbstractSeries *, series); | |
195 |
QFETCH(Q |
|
195 | QFETCH(QAxis *, axis); | |
196 | m_view->show(); |
|
196 | m_view->show(); | |
197 | QTest::qWaitForWindowShown(m_view); |
|
197 | QTest::qWaitForWindowShown(m_view); | |
198 | if(!axis) axis = m_chart->axisY(); |
|
198 | if(!axis) axis = m_chart->axisY(); | |
@@ -227,7 +227,7 void tst_QChart::axisX_data() | |||||
227 | void tst_QChart::axisX() |
|
227 | void tst_QChart::axisX() | |
228 | { |
|
228 | { | |
229 | QVERIFY(m_chart->axisX()); |
|
229 | QVERIFY(m_chart->axisX()); | |
230 |
Q |
|
230 | QAxis* axis = m_chart->axisX(); | |
231 | createTestData(); |
|
231 | createTestData(); | |
232 | //it should be the same axis |
|
232 | //it should be the same axis | |
233 | QCOMPARE(axis,m_chart->axisX()); |
|
233 | QCOMPARE(axis,m_chart->axisX()); | |
@@ -235,21 +235,21 void tst_QChart::axisX() | |||||
235 |
|
235 | |||
236 | void tst_QChart::axisY_data() |
|
236 | void tst_QChart::axisY_data() | |
237 | { |
|
237 | { | |
238 |
QTest::addColumn<Q |
|
238 | QTest::addColumn<QAxis*>("axis0"); | |
239 |
QTest::addColumn<Q |
|
239 | QTest::addColumn<QAxis*>("axis1"); | |
240 |
QTest::addColumn<Q |
|
240 | QTest::addColumn<QAxis*>("axis2"); | |
241 |
QTest::newRow("1 defualt, 2 optional") << (Q |
|
241 | QTest::newRow("1 defualt, 2 optional") << (QAxis*)0 << new QAxis() << new QAxis(); | |
242 |
QTest::newRow("3 optional") << new Q |
|
242 | QTest::newRow("3 optional") << new QAxis() << new QAxis() << new QAxis(); | |
243 | } |
|
243 | } | |
244 |
|
244 | |||
245 |
|
245 | |||
246 | void tst_QChart::axisY() |
|
246 | void tst_QChart::axisY() | |
247 | { |
|
247 | { | |
248 |
QFETCH(Q |
|
248 | QFETCH(QAxis*, axis0); | |
249 |
QFETCH(Q |
|
249 | QFETCH(QAxis*, axis1); | |
250 |
QFETCH(Q |
|
250 | QFETCH(QAxis*, axis2); | |
251 |
|
251 | |||
252 |
Q |
|
252 | QAxis* defaultAxisY = m_chart->axisY(); | |
253 |
|
253 | |||
254 | QVERIFY2(defaultAxisY, "Missing axisY."); |
|
254 | QVERIFY2(defaultAxisY, "Missing axisY."); | |
255 |
|
255 | |||
@@ -385,7 +385,7 void tst_QChart::removeSeries_data() | |||||
385 | void tst_QChart::removeSeries() |
|
385 | void tst_QChart::removeSeries() | |
386 | { |
|
386 | { | |
387 | QFETCH(QAbstractSeries *, series); |
|
387 | QFETCH(QAbstractSeries *, series); | |
388 |
QFETCH(Q |
|
388 | QFETCH(QAxis *, axis); | |
389 | m_view->show(); |
|
389 | m_view->show(); | |
390 | QTest::qWaitForWindowShown(m_view); |
|
390 | QTest::qWaitForWindowShown(m_view); | |
391 | if(!axis) axis = m_chart->axisY(); |
|
391 | if(!axis) axis = m_chart->axisY(); |
@@ -145,9 +145,9 void tst_QChartView::rubberBand() | |||||
145 | //this is hack since view does not get events otherwise |
|
145 | //this is hack since view does not get events otherwise | |
146 | m_view->setMouseTracking(true); |
|
146 | m_view->setMouseTracking(true); | |
147 |
|
147 | |||
148 |
Q |
|
148 | QAxis* axisY = m_view->chart()->axisY(); | |
149 | QSignalSpy spy0(axisY, SIGNAL(rangeChanged(qreal,qreal))); |
|
149 | QSignalSpy spy0(axisY, SIGNAL(rangeChanged(qreal,qreal))); | |
150 |
Q |
|
150 | QAxis* axisX = m_view->chart()->axisX(); | |
151 | QSignalSpy spy1(axisX, SIGNAL(rangeChanged(qreal,qreal))); |
|
151 | QSignalSpy spy1(axisX, SIGNAL(rangeChanged(qreal,qreal))); | |
152 |
|
152 | |||
153 | QTest::qWaitForWindowShown(m_view); |
|
153 | QTest::qWaitForWindowShown(m_view); | |
@@ -197,9 +197,9 void tst_QChartView::keys() | |||||
197 | m_view->resize(100 + padding.left() + padding.right(), 100 + padding.top()+ padding.bottom()); |
|
197 | m_view->resize(100 + padding.left() + padding.right(), 100 + padding.top()+ padding.bottom()); | |
198 | m_view->show(); |
|
198 | m_view->show(); | |
199 |
|
199 | |||
200 |
Q |
|
200 | QAxis* axisY = m_view->chart()->axisY(); | |
201 | QSignalSpy spy0(axisY, SIGNAL(rangeChanged(qreal,qreal))); |
|
201 | QSignalSpy spy0(axisY, SIGNAL(rangeChanged(qreal,qreal))); | |
202 |
Q |
|
202 | QAxis* axisX = m_view->chart()->axisX(); | |
203 | QSignalSpy spy1(axisX, SIGNAL(rangeChanged(qreal,qreal))); |
|
203 | QSignalSpy spy1(axisX, SIGNAL(rangeChanged(qreal,qreal))); | |
204 |
|
204 | |||
205 | QTest::keyPress(m_view, key); |
|
205 | QTest::keyPress(m_view, key); |
@@ -22,7 +22,7 | |||||
22 |
|
22 | |||
23 | #include <QChart> |
|
23 | #include <QChart> | |
24 | #include <QScatterSeries> |
|
24 | #include <QScatterSeries> | |
25 |
#include <Q |
|
25 | #include <QAxis> | |
26 | #include <QBarSet> |
|
26 | #include <QBarSet> | |
27 | #include <QBarSeries> |
|
27 | #include <QBarSeries> | |
28 | #include <QLegend> |
|
28 | #include <QLegend> |
@@ -143,7 +143,7 void TableWidget::updateChartType(bool toggle) | |||||
143 |
|
143 | |||
144 | // renable axes of the chart (pie hides them) |
|
144 | // renable axes of the chart (pie hides them) | |
145 | // x axis |
|
145 | // x axis | |
146 |
Q |
|
146 | QAxis *axis = m_chart->axisX(); | |
147 | axis->setAxisVisible(true); |
|
147 | axis->setAxisVisible(true); | |
148 | axis->setGridLineVisible(true); |
|
148 | axis->setGridLineVisible(true); | |
149 | axis->setLabelsVisible(true); |
|
149 | axis->setLabelsVisible(true); |
General Comments 0
You need to be logged in to leave comments.
Login now