@@ -22,7 +22,7 | |||||
22 | #include <QMainWindow> |
|
22 | #include <QMainWindow> | |
23 | #include <QChartView> |
|
23 | #include <QChartView> | |
24 | #include <QLineSeries> |
|
24 | #include <QLineSeries> | |
25 |
#include <Q |
|
25 | #include <QCategoryAxis> | |
26 |
|
26 | |||
27 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
27 | QTCOMMERCIALCHART_USE_NAMESPACE | |
28 |
|
28 | |||
@@ -62,8 +62,8 int main(int argc, char *argv[]) | |||||
62 | //![2] |
|
62 | //![2] | |
63 |
|
63 | |||
64 | //![3] |
|
64 | //![3] | |
65 |
Q |
|
65 | QCategoryAxis* axisX = new QCategoryAxis(); | |
66 |
Q |
|
66 | QCategoryAxis* axisY = new QCategoryAxis(); | |
67 |
|
67 | |||
68 | // Customize axis label font |
|
68 | // Customize axis label font | |
69 | QFont labelsFont; |
|
69 | QFont labelsFont; |
@@ -40,7 +40,7 ChartIntervalAxisX::~ChartIntervalAxisX() | |||||
40 |
|
40 | |||
41 | QVector<qreal> ChartIntervalAxisX::calculateLayout() const |
|
41 | QVector<qreal> ChartIntervalAxisX::calculateLayout() const | |
42 | { |
|
42 | { | |
43 |
Q |
|
43 | QCategoryAxis *axis = qobject_cast<QCategoryAxis *>(m_chartAxis); | |
44 | int tickCount = axis->intervalsLabels().count() + 1; |
|
44 | int tickCount = axis->intervalsLabels().count() + 1; | |
45 | QVector<qreal> points; |
|
45 | QVector<qreal> points; | |
46 |
|
46 | |||
@@ -71,7 +71,7 void ChartIntervalAxisX::updateGeometry() | |||||
71 |
|
71 | |||
72 | if(layout.isEmpty()) return; |
|
72 | if(layout.isEmpty()) return; | |
73 |
|
73 | |||
74 |
Q |
|
74 | QCategoryAxis *intervalAxis = qobject_cast<QCategoryAxis *>(m_chartAxis); | |
75 |
|
75 | |||
76 | QStringList ticksList = intervalAxis->intervalsLabels(); |
|
76 | QStringList ticksList = intervalAxis->intervalsLabels(); | |
77 |
|
77 |
@@ -41,7 +41,7 ChartIntervalAxisY::~ChartIntervalAxisY() | |||||
41 |
|
41 | |||
42 | QVector<qreal> ChartIntervalAxisY::calculateLayout() const |
|
42 | QVector<qreal> ChartIntervalAxisY::calculateLayout() const | |
43 | { |
|
43 | { | |
44 |
Q |
|
44 | QCategoryAxis *axis = qobject_cast<QCategoryAxis *>(m_chartAxis); | |
45 | int tickCount = axis->intervalsLabels().count() + 1; |
|
45 | int tickCount = axis->intervalsLabels().count() + 1; | |
46 | QVector<qreal> points; |
|
46 | QVector<qreal> points; | |
47 |
|
47 | |||
@@ -71,7 +71,7 void ChartIntervalAxisY::updateGeometry() | |||||
71 |
|
71 | |||
72 | if(layout.isEmpty()) return; |
|
72 | if(layout.isEmpty()) return; | |
73 |
|
73 | |||
74 |
Q |
|
74 | QCategoryAxis *intervalAxis = qobject_cast<QCategoryAxis *>(m_chartAxis); | |
75 |
|
75 | |||
76 | QStringList ticksList = intervalAxis->intervalsLabels(); |
|
76 | QStringList ticksList = intervalAxis->intervalsLabels(); | |
77 |
|
77 |
@@ -27,13 +27,13 | |||||
27 |
|
27 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 | /*! |
|
29 | /*! | |
30 |
\class Q |
|
30 | \class QCategoryAxis | |
31 |
\brief The Q |
|
31 | \brief The QCategoryAxis class is used for manipulating chart's axis. | |
32 | \mainclass |
|
32 | \mainclass | |
33 | */ |
|
33 | */ | |
34 |
|
34 | |||
35 | /*! |
|
35 | /*! | |
36 |
\qmlclass Axis Q |
|
36 | \qmlclass Axis QCategoryAxis | |
37 | \brief The Axis element is used for manipulating chart's axes. |
|
37 | \brief The Axis element is used for manipulating chart's axes. | |
38 |
|
38 | |||
39 | Axis can be setup to show axis line with tick marks, grid lines and shades. |
|
39 | Axis can be setup to show axis line with tick marks, grid lines and shades. | |
@@ -47,15 +47,15 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
47 | /*! |
|
47 | /*! | |
48 | Constructs an axis object which is a child of \a parent. |
|
48 | Constructs an axis object which is a child of \a parent. | |
49 | */ |
|
49 | */ | |
50 |
Q |
|
50 | QCategoryAxis::QCategoryAxis(QObject *parent): | |
51 |
QValueAxis(*new Q |
|
51 | QValueAxis(*new QCategoryAxisPrivate(this),parent) | |
52 | { |
|
52 | { | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
55 | /*! |
|
55 | /*! | |
56 | Destroys the object |
|
56 | Destroys the object | |
57 | */ |
|
57 | */ | |
58 |
Q |
|
58 | QCategoryAxis::~QCategoryAxis() | |
59 | { |
|
59 | { | |
60 | // Q_D(QValueAxis); |
|
60 | // Q_D(QValueAxis); | |
61 | // if(d->m_dataset) { |
|
61 | // if(d->m_dataset) { | |
@@ -66,7 +66,7 QIntervalsAxis::~QIntervalsAxis() | |||||
66 | /*! |
|
66 | /*! | |
67 | \internal |
|
67 | \internal | |
68 | */ |
|
68 | */ | |
69 |
Q |
|
69 | QCategoryAxis::QCategoryAxis(QCategoryAxisPrivate &d,QObject *parent):QValueAxis(d,parent) | |
70 | { |
|
70 | { | |
71 |
|
71 | |||
72 | } |
|
72 | } | |
@@ -78,9 +78,9 QIntervalsAxis::QIntervalsAxis(QIntervalsAxisPrivate &d,QObject *parent):QValueA | |||||
78 | It has to be greater than the high end limit of the previous interval. |
|
78 | It has to be greater than the high end limit of the previous interval. | |
79 | Otherwise the method returns without adding a new interval. |
|
79 | Otherwise the method returns without adding a new interval. | |
80 | */ |
|
80 | */ | |
81 |
void Q |
|
81 | void QCategoryAxis::append(const QString& intervalLabel, qreal intervalEnd) | |
82 | { |
|
82 | { | |
83 |
Q_D(Q |
|
83 | Q_D(QCategoryAxis); | |
84 |
|
84 | |||
85 | if (!d->m_intervals.contains(intervalLabel)) |
|
85 | if (!d->m_intervals.contains(intervalLabel)) | |
86 | { |
|
86 | { | |
@@ -99,9 +99,9 void QIntervalsAxis::append(const QString& intervalLabel, qreal intervalEnd) | |||||
99 | /*! |
|
99 | /*! | |
100 | Sets to \a min the low end limit of the first interval on the axis. |
|
100 | Sets to \a min the low end limit of the first interval on the axis. | |
101 | */ |
|
101 | */ | |
102 |
void Q |
|
102 | void QCategoryAxis::setFisrtIntervalMinimum(qreal min) | |
103 | { |
|
103 | { | |
104 |
Q_D(Q |
|
104 | Q_D(QCategoryAxis); | |
105 | if(d->m_intervals.isEmpty()){ |
|
105 | if(d->m_intervals.isEmpty()){ | |
106 | d->m_categoryMinimum = min; |
|
106 | d->m_categoryMinimum = min; | |
107 | }else{ |
|
107 | }else{ | |
@@ -113,27 +113,27 void QIntervalsAxis::setFisrtIntervalMinimum(qreal min) | |||||
113 | /*! |
|
113 | /*! | |
114 | Returns the low end limit of the interval specified by an \a intervalLabel |
|
114 | Returns the low end limit of the interval specified by an \a intervalLabel | |
115 | */ |
|
115 | */ | |
116 |
qreal Q |
|
116 | qreal QCategoryAxis::intervalMin(const QString& intervalLabel) const | |
117 | { |
|
117 | { | |
118 |
Q_D(const Q |
|
118 | Q_D(const QCategoryAxis); | |
119 | return d->m_intervalsMap.value(intervalLabel).first; |
|
119 | return d->m_intervalsMap.value(intervalLabel).first; | |
120 | } |
|
120 | } | |
121 |
|
121 | |||
122 | /*! |
|
122 | /*! | |
123 | Returns the high end limit of the interval specified by an \a intervalLabel |
|
123 | Returns the high end limit of the interval specified by an \a intervalLabel | |
124 | */ |
|
124 | */ | |
125 |
qreal Q |
|
125 | qreal QCategoryAxis::intervalMax(const QString& intervalLabel) const | |
126 | { |
|
126 | { | |
127 |
Q_D(const Q |
|
127 | Q_D(const QCategoryAxis); | |
128 | return d->m_intervalsMap.value(intervalLabel).second; |
|
128 | return d->m_intervalsMap.value(intervalLabel).second; | |
129 | } |
|
129 | } | |
130 |
|
130 | |||
131 | /*! |
|
131 | /*! | |
132 | Removes an interval specified by the \a intervalLabel from the axis |
|
132 | Removes an interval specified by the \a intervalLabel from the axis | |
133 | */ |
|
133 | */ | |
134 |
void Q |
|
134 | void QCategoryAxis::remove(const QString &intervalLabel) | |
135 | { |
|
135 | { | |
136 |
Q_D(Q |
|
136 | Q_D(QCategoryAxis); | |
137 | int labelIndex = d->m_intervals.indexOf(intervalLabel); |
|
137 | int labelIndex = d->m_intervals.indexOf(intervalLabel); | |
138 |
|
138 | |||
139 | // check if such label exists |
|
139 | // check if such label exists | |
@@ -163,9 +163,9 void QIntervalsAxis::remove(const QString &intervalLabel) | |||||
163 | Replaces \a oldLabel of an existing interval with a \a newLabel |
|
163 | Replaces \a oldLabel of an existing interval with a \a newLabel | |
164 | If the old label does not exist the method returns without making any changes. |
|
164 | If the old label does not exist the method returns without making any changes. | |
165 | */ |
|
165 | */ | |
166 |
void Q |
|
166 | void QCategoryAxis::replaceLabel(const QString& oldLabel, const QString& newLabel) | |
167 | { |
|
167 | { | |
168 |
Q_D(Q |
|
168 | Q_D(QCategoryAxis); | |
169 | int labelIndex = d->m_intervals.indexOf(oldLabel); |
|
169 | int labelIndex = d->m_intervals.indexOf(oldLabel); | |
170 |
|
170 | |||
171 | // check if such label exists |
|
171 | // check if such label exists | |
@@ -182,49 +182,49 void QIntervalsAxis::replaceLabel(const QString& oldLabel, const QString& newLab | |||||
182 | /*! |
|
182 | /*! | |
183 | Returns the list of the intervals labels |
|
183 | Returns the list of the intervals labels | |
184 | */ |
|
184 | */ | |
185 |
QStringList Q |
|
185 | QStringList QCategoryAxis::intervalsLabels() | |
186 | { |
|
186 | { | |
187 |
Q_D(Q |
|
187 | Q_D(QCategoryAxis); | |
188 | return d->m_intervals; |
|
188 | return d->m_intervals; | |
189 | } |
|
189 | } | |
190 |
|
190 | |||
191 | /*! |
|
191 | /*! | |
192 | Returns number of intervals. |
|
192 | Returns number of intervals. | |
193 | */ |
|
193 | */ | |
194 |
int Q |
|
194 | int QCategoryAxis::count() const | |
195 | { |
|
195 | { | |
196 |
Q_D(const Q |
|
196 | Q_D(const QCategoryAxis); | |
197 | return d->m_intervals.count(); |
|
197 | return d->m_intervals.count(); | |
198 | } |
|
198 | } | |
199 |
|
199 | |||
200 | /*! |
|
200 | /*! | |
201 | Returns the type of the axis |
|
201 | Returns the type of the axis | |
202 | */ |
|
202 | */ | |
203 |
QAbstractAxis::AxisType Q |
|
203 | QAbstractAxis::AxisType QCategoryAxis::type() const | |
204 | { |
|
204 | { | |
205 | return QAbstractAxis::AxisTypeIntervals; |
|
205 | return QAbstractAxis::AxisTypeIntervals; | |
206 | } |
|
206 | } | |
207 |
|
207 | |||
208 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
208 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
209 |
|
209 | |||
210 |
Q |
|
210 | QCategoryAxisPrivate::QCategoryAxisPrivate(QCategoryAxis* q): | |
211 | QValueAxisPrivate(q), |
|
211 | QValueAxisPrivate(q), | |
212 | m_categoryMinimum(0) |
|
212 | m_categoryMinimum(0) | |
213 | { |
|
213 | { | |
214 |
|
214 | |||
215 | } |
|
215 | } | |
216 |
|
216 | |||
217 |
Q |
|
217 | QCategoryAxisPrivate::~QCategoryAxisPrivate() | |
218 | { |
|
218 | { | |
219 |
|
219 | |||
220 | } |
|
220 | } | |
221 |
|
221 | |||
222 |
int Q |
|
222 | int QCategoryAxisPrivate::ticksCount() const | |
223 | { |
|
223 | { | |
224 | return m_intervals.count() + 1; |
|
224 | return m_intervals.count() + 1; | |
225 | } |
|
225 | } | |
226 |
|
226 | |||
227 |
void Q |
|
227 | void QCategoryAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count) | |
228 | { |
|
228 | { | |
229 | Q_UNUSED(count); |
|
229 | Q_UNUSED(count); | |
230 | Q_UNUSED(min); |
|
230 | Q_UNUSED(min); | |
@@ -233,9 +233,9 void QIntervalsAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int coun | |||||
233 | //m_max = max; |
|
233 | //m_max = max; | |
234 | } |
|
234 | } | |
235 |
|
235 | |||
236 |
ChartAxis* Q |
|
236 | ChartAxis* QCategoryAxisPrivate::createGraphics(ChartPresenter* presenter) | |
237 | { |
|
237 | { | |
238 |
Q_Q(Q |
|
238 | Q_Q(QCategoryAxis); | |
239 | if(m_orientation == Qt::Vertical){ |
|
239 | if(m_orientation == Qt::Vertical){ | |
240 | return new ChartIntervalAxisY(q,presenter); |
|
240 | return new ChartIntervalAxisY(q,presenter); | |
241 | }else{ |
|
241 | }else{ |
@@ -26,18 +26,18 | |||||
26 |
|
26 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
28 | |||
29 |
class Q |
|
29 | class QCategoryAxisPrivate; | |
30 |
|
30 | |||
31 |
class QTCOMMERCIALCHART_EXPORT Q |
|
31 | class QTCOMMERCIALCHART_EXPORT QCategoryAxis : public QValueAxis | |
32 | { |
|
32 | { | |
33 | Q_OBJECT |
|
33 | Q_OBJECT | |
34 |
|
34 | |||
35 | public: |
|
35 | public: | |
36 |
explicit Q |
|
36 | explicit QCategoryAxis(QObject *parent = 0); | |
37 |
~Q |
|
37 | ~QCategoryAxis(); | |
38 |
|
38 | |||
39 | protected: |
|
39 | protected: | |
40 |
Q |
|
40 | QCategoryAxis(QCategoryAxisPrivate &d,QObject *parent = 0); | |
41 |
|
41 | |||
42 | public: |
|
42 | public: | |
43 | AxisType type() const; |
|
43 | AxisType type() const; | |
@@ -56,8 +56,8 public: | |||||
56 |
|
56 | |||
57 |
|
57 | |||
58 | private: |
|
58 | private: | |
59 |
Q_DECLARE_PRIVATE(Q |
|
59 | Q_DECLARE_PRIVATE(QCategoryAxis) | |
60 |
Q_DISABLE_COPY(Q |
|
60 | Q_DISABLE_COPY(QCategoryAxis) | |
61 | }; |
|
61 | }; | |
62 |
|
62 | |||
63 | QTCOMMERCIALCHART_END_NAMESPACE |
|
63 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -27,8 +27,8 | |||||
27 | // |
|
27 | // | |
28 | // We mean it. |
|
28 | // We mean it. | |
29 |
|
29 | |||
30 | #ifndef QIntervalsAxis_P_H |
|
30 | #ifndef QCATEGORYAXIS_P_H | |
31 | #define QIntervalsAxis_P_H |
|
31 | #define QCATEGORYAXIS_P_H | |
32 |
|
32 | |||
33 | #include "qintervalsaxis.h" |
|
33 | #include "qintervalsaxis.h" | |
34 | #include "qvalueaxis_p.h" |
|
34 | #include "qvalueaxis_p.h" | |
@@ -37,13 +37,13 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
37 |
|
37 | |||
38 | typedef QPair<qreal, qreal> Range; |
|
38 | typedef QPair<qreal, qreal> Range; | |
39 |
|
39 | |||
40 |
class Q |
|
40 | class QCategoryAxisPrivate : public QValueAxisPrivate | |
41 | { |
|
41 | { | |
42 | Q_OBJECT |
|
42 | Q_OBJECT | |
43 |
|
43 | |||
44 | public: |
|
44 | public: | |
45 |
Q |
|
45 | QCategoryAxisPrivate(QCategoryAxis *q); | |
46 |
~Q |
|
46 | ~QCategoryAxisPrivate(); | |
47 |
|
47 | |||
48 |
|
48 | |||
49 | public: |
|
49 | public: | |
@@ -62,9 +62,9 private: | |||||
62 | qreal m_categoryMinimum; |
|
62 | qreal m_categoryMinimum; | |
63 |
|
63 | |||
64 | private: |
|
64 | private: | |
65 |
Q_DECLARE_PUBLIC(Q |
|
65 | Q_DECLARE_PUBLIC(QCategoryAxis) | |
66 | }; |
|
66 | }; | |
67 |
|
67 | |||
68 | QTCOMMERCIALCHART_END_NAMESPACE |
|
68 | QTCOMMERCIALCHART_END_NAMESPACE | |
69 |
|
69 | |||
70 |
#endif // QCATEGOR |
|
70 | #endif // QCATEGORYAXIS_P_H |
@@ -185,7 +185,7 QAbstractAxis* ChartDataSet::createAxis(QAbstractAxis::AxisType type, Qt::Orient | |||||
185 | axis = new QBarCategoryAxis(this); |
|
185 | axis = new QBarCategoryAxis(this); | |
186 | break; |
|
186 | break; | |
187 | case QAbstractAxis::AxisTypeIntervals: |
|
187 | case QAbstractAxis::AxisTypeIntervals: | |
188 |
axis = new Q |
|
188 | axis = new QCategoryAxis(this); | |
189 | break; |
|
189 | break; | |
190 | case QAbstractAxis::AxisTypeDateTime: |
|
190 | case QAbstractAxis::AxisTypeDateTime: | |
191 | axis = new QDateTimeAxis(this); |
|
191 | axis = new QDateTimeAxis(this); |
@@ -22,7 +22,7 | |||||
22 | #include "qintervalsaxis.h" |
|
22 | #include "qintervalsaxis.h" | |
23 | #include <qlineseries.h> |
|
23 | #include <qlineseries.h> | |
24 |
|
24 | |||
25 |
class tst_Q |
|
25 | class tst_QCategoryAxis: public tst_QAbstractAxis | |
26 | { |
|
26 | { | |
27 | Q_OBJECT |
|
27 | Q_OBJECT | |
28 |
|
28 | |||
@@ -59,21 +59,21 private slots: | |||||
59 | void interval(); |
|
59 | void interval(); | |
60 |
|
60 | |||
61 | private: |
|
61 | private: | |
62 |
Q |
|
62 | QCategoryAxis* m_intervalsaxis; | |
63 | QLineSeries* m_series; |
|
63 | QLineSeries* m_series; | |
64 | }; |
|
64 | }; | |
65 |
|
65 | |||
66 |
void tst_Q |
|
66 | void tst_QCategoryAxis::initTestCase() | |
67 | { |
|
67 | { | |
68 | } |
|
68 | } | |
69 |
|
69 | |||
70 |
void tst_Q |
|
70 | void tst_QCategoryAxis::cleanupTestCase() | |
71 | { |
|
71 | { | |
72 | } |
|
72 | } | |
73 |
|
73 | |||
74 |
void tst_Q |
|
74 | void tst_QCategoryAxis::init() | |
75 | { |
|
75 | { | |
76 |
m_intervalsaxis = new Q |
|
76 | m_intervalsaxis = new QCategoryAxis(); | |
77 | m_series = new QLineSeries(); |
|
77 | m_series = new QLineSeries(); | |
78 | *m_series << QPointF(-100, -100) << QPointF(0, 0) << QPointF(100, 100); |
|
78 | *m_series << QPointF(-100, -100) << QPointF(0, 0) << QPointF(100, 100); | |
79 | tst_QAbstractAxis::init(m_intervalsaxis, m_series); |
|
79 | tst_QAbstractAxis::init(m_intervalsaxis, m_series); | |
@@ -81,7 +81,7 void tst_QIntervalsAxis::init() | |||||
81 | m_chart->createDefaultAxes(); |
|
81 | m_chart->createDefaultAxes(); | |
82 | } |
|
82 | } | |
83 |
|
83 | |||
84 |
void tst_Q |
|
84 | void tst_QCategoryAxis::cleanup() | |
85 | { |
|
85 | { | |
86 | delete m_series; |
|
86 | delete m_series; | |
87 | delete m_intervalsaxis; |
|
87 | delete m_intervalsaxis; | |
@@ -90,11 +90,11 void tst_QIntervalsAxis::cleanup() | |||||
90 | tst_QAbstractAxis::cleanup(); |
|
90 | tst_QAbstractAxis::cleanup(); | |
91 | } |
|
91 | } | |
92 |
|
92 | |||
93 |
void tst_Q |
|
93 | void tst_QCategoryAxis::qintervalsaxis_data() | |
94 | { |
|
94 | { | |
95 | } |
|
95 | } | |
96 |
|
96 | |||
97 |
void tst_Q |
|
97 | void tst_QCategoryAxis::qintervalsaxis() | |
98 | { |
|
98 | { | |
99 | qabstractaxis(); |
|
99 | qabstractaxis(); | |
100 |
|
100 | |||
@@ -110,7 +110,7 void tst_QIntervalsAxis::qintervalsaxis() | |||||
110 | QVERIFY(!qFuzzyIsNull(m_intervalsaxis->min())); |
|
110 | QVERIFY(!qFuzzyIsNull(m_intervalsaxis->min())); | |
111 | } |
|
111 | } | |
112 |
|
112 | |||
113 |
void tst_Q |
|
113 | void tst_QCategoryAxis::max_raw_data() | |
114 | { |
|
114 | { | |
115 | QTest::addColumn<qreal>("max"); |
|
115 | QTest::addColumn<qreal>("max"); | |
116 | QTest::newRow("1.0") << 1.0; |
|
116 | QTest::newRow("1.0") << 1.0; | |
@@ -118,7 +118,7 void tst_QIntervalsAxis::max_raw_data() | |||||
118 | QTest::newRow("101.0") << 101.0; |
|
118 | QTest::newRow("101.0") << 101.0; | |
119 | } |
|
119 | } | |
120 |
|
120 | |||
121 |
void tst_Q |
|
121 | void tst_QCategoryAxis::max_raw() | |
122 | { |
|
122 | { | |
123 | QFETCH(qreal, max); |
|
123 | QFETCH(qreal, max); | |
124 |
|
124 | |||
@@ -134,12 +134,12 void tst_QIntervalsAxis::max_raw() | |||||
134 | QCOMPARE(spy2.count(), 1); |
|
134 | QCOMPARE(spy2.count(), 1); | |
135 | } |
|
135 | } | |
136 |
|
136 | |||
137 |
void tst_Q |
|
137 | void tst_QCategoryAxis::max_data() | |
138 | { |
|
138 | { | |
139 | max_raw_data(); |
|
139 | max_raw_data(); | |
140 | } |
|
140 | } | |
141 |
|
141 | |||
142 |
void tst_Q |
|
142 | void tst_QCategoryAxis::max() | |
143 | { |
|
143 | { | |
144 | m_chart->setAxisX(m_intervalsaxis, m_series); |
|
144 | m_chart->setAxisX(m_intervalsaxis, m_series); | |
145 | m_view->show(); |
|
145 | m_view->show(); | |
@@ -147,18 +147,18 void tst_QIntervalsAxis::max() | |||||
147 | max_raw(); |
|
147 | max_raw(); | |
148 | } |
|
148 | } | |
149 |
|
149 | |||
150 |
void tst_Q |
|
150 | void tst_QCategoryAxis::max_animation_data() | |
151 | { |
|
151 | { | |
152 | max_data(); |
|
152 | max_data(); | |
153 | } |
|
153 | } | |
154 |
|
154 | |||
155 |
void tst_Q |
|
155 | void tst_QCategoryAxis::max_animation() | |
156 | { |
|
156 | { | |
157 | m_chart->setAnimationOptions(QChart::GridAxisAnimations); |
|
157 | m_chart->setAnimationOptions(QChart::GridAxisAnimations); | |
158 | max(); |
|
158 | max(); | |
159 | } |
|
159 | } | |
160 |
|
160 | |||
161 |
void tst_Q |
|
161 | void tst_QCategoryAxis::min_raw_data() | |
162 | { |
|
162 | { | |
163 | QTest::addColumn<qreal>("min"); |
|
163 | QTest::addColumn<qreal>("min"); | |
164 | QTest::newRow("-1.0") << -1.0; |
|
164 | QTest::newRow("-1.0") << -1.0; | |
@@ -166,7 +166,7 void tst_QIntervalsAxis::min_raw_data() | |||||
166 | QTest::newRow("-101.0") << -101.0; |
|
166 | QTest::newRow("-101.0") << -101.0; | |
167 | } |
|
167 | } | |
168 |
|
168 | |||
169 |
void tst_Q |
|
169 | void tst_QCategoryAxis::min_raw() | |
170 | { |
|
170 | { | |
171 | QFETCH(qreal, min); |
|
171 | QFETCH(qreal, min); | |
172 |
|
172 | |||
@@ -182,12 +182,12 void tst_QIntervalsAxis::min_raw() | |||||
182 | QCOMPARE(spy2.count(), 1); |
|
182 | QCOMPARE(spy2.count(), 1); | |
183 | } |
|
183 | } | |
184 |
|
184 | |||
185 |
void tst_Q |
|
185 | void tst_QCategoryAxis::min_data() | |
186 | { |
|
186 | { | |
187 | min_raw_data(); |
|
187 | min_raw_data(); | |
188 | } |
|
188 | } | |
189 |
|
189 | |||
190 |
void tst_Q |
|
190 | void tst_QCategoryAxis::min() | |
191 | { |
|
191 | { | |
192 | m_chart->setAxisX(m_intervalsaxis, m_series); |
|
192 | m_chart->setAxisX(m_intervalsaxis, m_series); | |
193 | m_view->show(); |
|
193 | m_view->show(); | |
@@ -195,18 +195,18 void tst_QIntervalsAxis::min() | |||||
195 | min_raw(); |
|
195 | min_raw(); | |
196 | } |
|
196 | } | |
197 |
|
197 | |||
198 |
void tst_Q |
|
198 | void tst_QCategoryAxis::min_animation_data() | |
199 | { |
|
199 | { | |
200 | min_data(); |
|
200 | min_data(); | |
201 | } |
|
201 | } | |
202 |
|
202 | |||
203 |
void tst_Q |
|
203 | void tst_QCategoryAxis::min_animation() | |
204 | { |
|
204 | { | |
205 | m_chart->setAnimationOptions(QChart::GridAxisAnimations); |
|
205 | m_chart->setAnimationOptions(QChart::GridAxisAnimations); | |
206 | min(); |
|
206 | min(); | |
207 | } |
|
207 | } | |
208 |
|
208 | |||
209 |
void tst_Q |
|
209 | void tst_QCategoryAxis::range_raw_data() | |
210 | { |
|
210 | { | |
211 | QTest::addColumn<qreal>("min"); |
|
211 | QTest::addColumn<qreal>("min"); | |
212 | QTest::addColumn<qreal>("max"); |
|
212 | QTest::addColumn<qreal>("max"); | |
@@ -215,7 +215,7 void tst_QIntervalsAxis::range_raw_data() | |||||
215 | QTest::newRow("101.0") << 40.0 << 60.0; |
|
215 | QTest::newRow("101.0") << 40.0 << 60.0; | |
216 | } |
|
216 | } | |
217 |
|
217 | |||
218 |
void tst_Q |
|
218 | void tst_QCategoryAxis::range_raw() | |
219 | { |
|
219 | { | |
220 | QFETCH(qreal, min); |
|
220 | QFETCH(qreal, min); | |
221 | QFETCH(qreal, max); |
|
221 | QFETCH(qreal, max); | |
@@ -233,12 +233,12 void tst_QIntervalsAxis::range_raw() | |||||
233 | QCOMPARE(spy2.count(), 1); |
|
233 | QCOMPARE(spy2.count(), 1); | |
234 | } |
|
234 | } | |
235 |
|
235 | |||
236 |
void tst_Q |
|
236 | void tst_QCategoryAxis::range_data() | |
237 | { |
|
237 | { | |
238 | range_raw_data(); |
|
238 | range_raw_data(); | |
239 | } |
|
239 | } | |
240 |
|
240 | |||
241 |
void tst_Q |
|
241 | void tst_QCategoryAxis::range() | |
242 | { |
|
242 | { | |
243 | m_chart->setAxisX(m_intervalsaxis, m_series); |
|
243 | m_chart->setAxisX(m_intervalsaxis, m_series); | |
244 | m_view->show(); |
|
244 | m_view->show(); | |
@@ -246,23 +246,23 void tst_QIntervalsAxis::range() | |||||
246 | range_raw(); |
|
246 | range_raw(); | |
247 | } |
|
247 | } | |
248 |
|
248 | |||
249 |
void tst_Q |
|
249 | void tst_QCategoryAxis::range_animation_data() | |
250 | { |
|
250 | { | |
251 | range_data(); |
|
251 | range_data(); | |
252 | } |
|
252 | } | |
253 |
|
253 | |||
254 |
void tst_Q |
|
254 | void tst_QCategoryAxis::range_animation() | |
255 | { |
|
255 | { | |
256 | m_chart->setAnimationOptions(QChart::GridAxisAnimations); |
|
256 | m_chart->setAnimationOptions(QChart::GridAxisAnimations); | |
257 | range(); |
|
257 | range(); | |
258 | } |
|
258 | } | |
259 |
|
259 | |||
260 |
void tst_Q |
|
260 | void tst_QCategoryAxis::interval_data() | |
261 | { |
|
261 | { | |
262 | // |
|
262 | // | |
263 | } |
|
263 | } | |
264 |
|
264 | |||
265 |
void tst_Q |
|
265 | void tst_QCategoryAxis::interval() | |
266 | { |
|
266 | { | |
267 | // append one correct interval |
|
267 | // append one correct interval | |
268 | m_intervalsaxis->append("first", (qreal)45); |
|
268 | m_intervalsaxis->append("first", (qreal)45); | |
@@ -299,6 +299,6 void tst_QIntervalsAxis::interval() | |||||
299 | QCOMPARE(m_intervalsaxis->intervalMax("replaced"), (qreal)75); |
|
299 | QCOMPARE(m_intervalsaxis->intervalMax("replaced"), (qreal)75); | |
300 | } |
|
300 | } | |
301 |
|
301 | |||
302 |
QTEST_MAIN(tst_Q |
|
302 | QTEST_MAIN(tst_QCategoryAxis) | |
303 | #include "tst_qintervalsaxis.moc" |
|
303 | #include "tst_qintervalsaxis.moc" | |
304 |
|
304 |
General Comments 0
You need to be logged in to leave comments.
Login now