@@ -29,7 +29,7 Rectangle { | |||
|
29 | 29 | title: "Bar series" |
|
30 | 30 | anchors.fill: parent |
|
31 | 31 | legend.alignment: Qt.AlignBottom |
|
32 | CategoriesAxis { | |
|
32 | BarCategoriesAxis { | |
|
33 | 33 | id:myAxis |
|
34 | 34 | categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] |
|
35 | 35 | } |
@@ -29,7 +29,7 Rectangle { | |||
|
29 | 29 | title: "Stacked Bar series" |
|
30 | 30 | anchors.fill: parent |
|
31 | 31 | legend.alignment: Qt.AlignBottom |
|
32 | CategoriesAxis { | |
|
32 | BarCategoriesAxis { | |
|
33 | 33 | id: myAxis; |
|
34 | 34 | categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] |
|
35 | 35 | } |
@@ -29,7 +29,7 Rectangle { | |||
|
29 | 29 | title: "Percent Bar series" |
|
30 | 30 | anchors.fill: parent |
|
31 | 31 | legend.alignment: Qt.AlignBottom |
|
32 | CategoriesAxis { | |
|
32 | BarCategoriesAxis { | |
|
33 | 33 | id: myAxis |
|
34 | 34 | categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] |
|
35 | 35 | } |
@@ -32,7 +32,7 Rectangle { | |||
|
32 | 32 | anchors.fill: parent |
|
33 | 33 | animationOptions: ChartView.SeriesAnimations |
|
34 | 34 | |
|
35 | CategoriesAxis { | |
|
35 | BarCategoriesAxis { | |
|
36 | 36 | id: categoryAxis |
|
37 | 37 | categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] |
|
38 | 38 | } |
@@ -66,7 +66,7 int main(int argc, char *argv[]) | |||
|
66 | 66 | //![4] |
|
67 | 67 | QStringList categories; |
|
68 | 68 | categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; |
|
69 | QCategoriesAxis* axis = new QCategoriesAxis(); | |
|
69 | QBarCategoriesAxis* axis = new QBarCategoriesAxis(); | |
|
70 | 70 | axis->append(categories); |
|
71 | 71 | chart->setAxisX(axis,series); |
|
72 | 72 | //![4] |
@@ -88,7 +88,7 TableWidget::TableWidget(QWidget *parent) | |||
|
88 | 88 | //! [6] |
|
89 | 89 | QStringList categories; |
|
90 | 90 | categories << "April" << "May" << "June" << "July" << "August"; |
|
91 | QCategoriesAxis* axis = new QCategoriesAxis(); | |
|
91 | QBarCategoriesAxis* axis = new QBarCategoriesAxis(); | |
|
92 | 92 | axis->append(categories); |
|
93 | 93 | chart->createDefaultAxes(); |
|
94 | 94 | chart->setAxisX(axis, series); |
@@ -64,7 +64,7 int main(int argc, char *argv[]) | |||
|
64 | 64 | //![4] |
|
65 | 65 | QStringList categories; |
|
66 | 66 | categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; |
|
67 | QCategoriesAxis* axis = new QCategoriesAxis(); | |
|
67 | QBarCategoriesAxis* axis = new QBarCategoriesAxis(); | |
|
68 | 68 | axis->append(categories); |
|
69 | 69 | chart->createDefaultAxes(); |
|
70 | 70 | chart->setAxisX(axis,series); |
@@ -65,7 +65,7 int main(int argc, char *argv[]) | |||
|
65 | 65 | //![4] |
|
66 | 66 | QStringList categories; |
|
67 | 67 | categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; |
|
68 | QCategoriesAxis* axis = new QCategoriesAxis(); | |
|
68 | QBarCategoriesAxis* axis = new QBarCategoriesAxis(); | |
|
69 | 69 | axis->append(categories); |
|
70 | 70 | chart->setAxisX(axis,series); |
|
71 | 71 | //![4] |
@@ -38,7 +38,7 void DrilldownChart::changeSeries(DrilldownBarSeries *series) | |||
|
38 | 38 | m_currentSeries = series; |
|
39 | 39 | |
|
40 | 40 | // Reset axis |
|
41 | QCategoriesAxis* axis = new QCategoriesAxis(); | |
|
41 | QBarCategoriesAxis* axis = new QBarCategoriesAxis(); | |
|
42 | 42 | axis->append(m_currentSeries->categories()); |
|
43 | 43 | |
|
44 | 44 | addSeries(series); |
@@ -68,7 +68,7 public: | |||
|
68 | 68 | qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper"); |
|
69 | 69 | qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper"); |
|
70 | 70 | qmlRegisterType<QValuesAxis>(uri, 1, 0, "ValuesAxis"); |
|
71 | qmlRegisterType<QCategoriesAxis>(uri, 1, 0, "CategoriesAxis"); | |
|
71 | qmlRegisterType<QBarCategoriesAxis>(uri, 1, 0, "BarCategoriesAxis"); | |
|
72 | 72 | |
|
73 | 73 | qmlRegisterUncreatableType<QLegend>(uri, 1, 0, "Legend", |
|
74 | 74 | QLatin1String("Trying to create uncreatable: Legend.")); |
@@ -31,7 +31,7 static int label_padding = 5; | |||
|
31 | 31 | |
|
32 | 32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
33 | 33 | |
|
34 | ChartCategoriesAxisX::ChartCategoriesAxisX(QCategoriesAxis *axis,ChartPresenter *presenter) : ChartAxis(axis,presenter), | |
|
34 | ChartCategoriesAxisX::ChartCategoriesAxisX(QBarCategoriesAxis *axis,ChartPresenter *presenter) : ChartAxis(axis,presenter), | |
|
35 | 35 | m_categoriesAxis(axis) |
|
36 | 36 | { |
|
37 | 37 |
@@ -36,12 +36,12 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
36 | 36 | |
|
37 | 37 | class QAbstractAxis; |
|
38 | 38 | class ChartPresenter; |
|
39 | class QCategoriesAxis; | |
|
39 | class QBarCategoriesAxis; | |
|
40 | 40 | |
|
41 | 41 | class ChartCategoriesAxisX : public ChartAxis |
|
42 | 42 | { |
|
43 | 43 | public: |
|
44 | ChartCategoriesAxisX(QCategoriesAxis *axis, ChartPresenter *presenter); | |
|
44 | ChartCategoriesAxisX(QBarCategoriesAxis *axis, ChartPresenter *presenter); | |
|
45 | 45 | ~ChartCategoriesAxisX(); |
|
46 | 46 | |
|
47 | 47 | AxisType axisType() const { return X_AXIS;} |
@@ -51,7 +51,7 protected: | |||
|
51 | 51 | void updateGeometry(); |
|
52 | 52 | |
|
53 | 53 | private: |
|
54 | QCategoriesAxis *m_categoriesAxis; | |
|
54 | QBarCategoriesAxis *m_categoriesAxis; | |
|
55 | 55 | }; |
|
56 | 56 | |
|
57 | 57 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -35,7 +35,7 | |||
|
35 | 35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
36 | 36 | |
|
37 | 37 | class QAbstractAxis; |
|
38 | class QCategoriesAxis; | |
|
38 | class QBarCategoriesAxis; | |
|
39 | 39 | class ChartPresenter; |
|
40 | 40 | |
|
41 | 41 | class ChartCategoriesAxisY : public ChartAxis |
@@ -51,7 +51,7 protected: | |||
|
51 | 51 | void updateGeometry(); |
|
52 | 52 | |
|
53 | 53 | private: |
|
54 | QCategoriesAxis *m_categoriesAxis; | |
|
54 | QBarCategoriesAxis *m_categoriesAxis; | |
|
55 | 55 | }; |
|
56 | 56 | |
|
57 | 57 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -27,16 +27,16 | |||
|
27 | 27 | |
|
28 | 28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | 29 | |
|
30 | QCategoriesAxis::QCategoriesAxis(QObject *parent): | |
|
31 | QAbstractAxis(*new QCategoriesAxisPrivate(this),parent) | |
|
30 | QBarCategoriesAxis::QBarCategoriesAxis(QObject *parent): | |
|
31 | QAbstractAxis(*new QBarCategoriesAxisPrivate(this),parent) | |
|
32 | 32 | { |
|
33 | 33 | } |
|
34 | 34 | |
|
35 | QCategoriesAxis::~QCategoriesAxis() | |
|
35 | QBarCategoriesAxis::~QBarCategoriesAxis() | |
|
36 | 36 | { |
|
37 | 37 | } |
|
38 | 38 | |
|
39 | QCategoriesAxis::QCategoriesAxis(QCategoriesAxisPrivate &d,QObject *parent):QAbstractAxis(d,parent) | |
|
39 | QBarCategoriesAxis::QBarCategoriesAxis(QBarCategoriesAxisPrivate &d,QObject *parent):QAbstractAxis(d,parent) | |
|
40 | 40 | { |
|
41 | 41 | |
|
42 | 42 | } |
@@ -44,9 +44,9 QCategoriesAxis::QCategoriesAxis(QCategoriesAxisPrivate &d,QObject *parent):QAbs | |||
|
44 | 44 | /*! |
|
45 | 45 | Appends \a categories to axis |
|
46 | 46 | */ |
|
47 | void QCategoriesAxis::append(const QStringList &categories) | |
|
47 | void QBarCategoriesAxis::append(const QStringList &categories) | |
|
48 | 48 | { |
|
49 | Q_D(QCategoriesAxis); | |
|
49 | Q_D(QBarCategoriesAxis); | |
|
50 | 50 | if (d->m_categories.isEmpty()) { |
|
51 | 51 | d->m_categories.append(categories); |
|
52 | 52 | setRange(categories.first(),categories.last()); |
@@ -60,9 +60,9 void QCategoriesAxis::append(const QStringList &categories) | |||
|
60 | 60 | /*! |
|
61 | 61 | Appends \a category to axis |
|
62 | 62 | */ |
|
63 | void QCategoriesAxis::append(const QString &category) | |
|
63 | void QBarCategoriesAxis::append(const QString &category) | |
|
64 | 64 | { |
|
65 | Q_D(QCategoriesAxis); | |
|
65 | Q_D(QBarCategoriesAxis); | |
|
66 | 66 | if (d->m_categories.isEmpty()) { |
|
67 | 67 | d->m_categories.append(category); |
|
68 | 68 | setRange(category,category); |
@@ -75,9 +75,9 void QCategoriesAxis::append(const QString &category) | |||
|
75 | 75 | /*! |
|
76 | 76 | Removes \a category from axis |
|
77 | 77 | */ |
|
78 | void QCategoriesAxis::remove(const QString &category) | |
|
78 | void QBarCategoriesAxis::remove(const QString &category) | |
|
79 | 79 | { |
|
80 | Q_D(QCategoriesAxis); | |
|
80 | Q_D(QBarCategoriesAxis); | |
|
81 | 81 | if (d->m_categories.contains(category)) { |
|
82 | 82 | d->m_categories.removeAt(d->m_categories.indexOf(category)); |
|
83 | 83 | setRange(d->m_categories.first(),d->m_categories.last()); |
@@ -88,9 +88,9 void QCategoriesAxis::remove(const QString &category) | |||
|
88 | 88 | /*! |
|
89 | 89 | Inserts \a category to axis at \a index |
|
90 | 90 | */ |
|
91 | void QCategoriesAxis::insert(int index, const QString &category) | |
|
91 | void QBarCategoriesAxis::insert(int index, const QString &category) | |
|
92 | 92 | { |
|
93 | Q_D(QCategoriesAxis); | |
|
93 | Q_D(QBarCategoriesAxis); | |
|
94 | 94 | if (d->m_categories.isEmpty()) { |
|
95 | 95 | d->m_categories.insert(index,category); |
|
96 | 96 | setRange(category,category); |
@@ -103,17 +103,17 void QCategoriesAxis::insert(int index, const QString &category) | |||
|
103 | 103 | /*! |
|
104 | 104 | Removes all categories. |
|
105 | 105 | */ |
|
106 | void QCategoriesAxis::clear() | |
|
106 | void QBarCategoriesAxis::clear() | |
|
107 | 107 | { |
|
108 | Q_D(QCategoriesAxis); | |
|
108 | Q_D(QBarCategoriesAxis); | |
|
109 | 109 | d->m_categories.clear(); |
|
110 | 110 | setRange(QString::null,QString::null); |
|
111 | 111 | emit categoriesChanged(); |
|
112 | 112 | } |
|
113 | 113 | |
|
114 | void QCategoriesAxis::setCategories(const QStringList &categories) | |
|
114 | void QBarCategoriesAxis::setCategories(const QStringList &categories) | |
|
115 | 115 | { |
|
116 | Q_D(QCategoriesAxis); | |
|
116 | Q_D(QBarCategoriesAxis); | |
|
117 | 117 | if(d->m_categories!=categories){ |
|
118 | 118 | d->m_categories = categories; |
|
119 | 119 | setRange(categories.first(),categories.last()); |
@@ -121,72 +121,72 void QCategoriesAxis::setCategories(const QStringList &categories) | |||
|
121 | 121 | } |
|
122 | 122 | } |
|
123 | 123 | |
|
124 | QStringList QCategoriesAxis::categories() | |
|
124 | QStringList QBarCategoriesAxis::categories() | |
|
125 | 125 | { |
|
126 | Q_D(QCategoriesAxis); | |
|
126 | Q_D(QBarCategoriesAxis); | |
|
127 | 127 | return d->m_categories; |
|
128 | 128 | } |
|
129 | 129 | |
|
130 | 130 | /*! |
|
131 | 131 | Returns number of categories. |
|
132 | 132 | */ |
|
133 | int QCategoriesAxis::count() const | |
|
133 | int QBarCategoriesAxis::count() const | |
|
134 | 134 | { |
|
135 | Q_D(const QCategoriesAxis); | |
|
135 | Q_D(const QBarCategoriesAxis); | |
|
136 | 136 | return d->m_categories.count(); |
|
137 | 137 | } |
|
138 | 138 | |
|
139 | 139 | /*! |
|
140 | 140 | Returns category at \a index. Index must be valid. |
|
141 | 141 | */ |
|
142 | QString QCategoriesAxis::at(int index) const | |
|
142 | QString QBarCategoriesAxis::at(int index) const | |
|
143 | 143 | { |
|
144 | Q_D(const QCategoriesAxis); | |
|
144 | Q_D(const QBarCategoriesAxis); | |
|
145 | 145 | return d->m_categories.at(index); |
|
146 | 146 | } |
|
147 | 147 | |
|
148 | 148 | /*! |
|
149 | 149 | Sets minimum category to \a min. |
|
150 | 150 | */ |
|
151 | void QCategoriesAxis::setMin(const QString& min) | |
|
151 | void QBarCategoriesAxis::setMin(const QString& min) | |
|
152 | 152 | { |
|
153 | Q_D(QCategoriesAxis); | |
|
153 | Q_D(QBarCategoriesAxis); | |
|
154 | 154 | setRange(min,d->m_maxCategory); |
|
155 | 155 | } |
|
156 | 156 | |
|
157 | 157 | /*! |
|
158 | 158 | Returns minimum category. |
|
159 | 159 | */ |
|
160 | QString QCategoriesAxis::min() const | |
|
160 | QString QBarCategoriesAxis::min() const | |
|
161 | 161 | { |
|
162 | Q_D(const QCategoriesAxis); | |
|
162 | Q_D(const QBarCategoriesAxis); | |
|
163 | 163 | return d->m_minCategory; |
|
164 | 164 | } |
|
165 | 165 | |
|
166 | 166 | /*! |
|
167 | 167 | Sets maximum category to \a max. |
|
168 | 168 | */ |
|
169 | void QCategoriesAxis::setMax(const QString& max) | |
|
169 | void QBarCategoriesAxis::setMax(const QString& max) | |
|
170 | 170 | { |
|
171 | Q_D(QCategoriesAxis); | |
|
171 | Q_D(QBarCategoriesAxis); | |
|
172 | 172 | setRange(d->m_minCategory,max); |
|
173 | 173 | } |
|
174 | 174 | |
|
175 | 175 | /*! |
|
176 | 176 | Returns maximum category |
|
177 | 177 | */ |
|
178 | QString QCategoriesAxis::max() const | |
|
178 | QString QBarCategoriesAxis::max() const | |
|
179 | 179 | { |
|
180 | Q_D(const QCategoriesAxis); | |
|
180 | Q_D(const QBarCategoriesAxis); | |
|
181 | 181 | return d->m_maxCategory; |
|
182 | 182 | } |
|
183 | 183 | |
|
184 | 184 | /*! |
|
185 | 185 | Sets range from \a minCategory to \a maxCategory |
|
186 | 186 | */ |
|
187 | void QCategoriesAxis::setRange(const QString& minCategory, const QString& maxCategory) | |
|
187 | void QBarCategoriesAxis::setRange(const QString& minCategory, const QString& maxCategory) | |
|
188 | 188 | { |
|
189 | Q_D(QCategoriesAxis); | |
|
189 | Q_D(QBarCategoriesAxis); | |
|
190 | 190 | |
|
191 | 191 | int minIndex = d->m_categories.indexOf(minCategory); |
|
192 | 192 | if (minIndex == -1) { |
@@ -224,57 +224,57 void QCategoriesAxis::setRange(const QString& minCategory, const QString& maxCat | |||
|
224 | 224 | /*! |
|
225 | 225 | Returns the type of axis. |
|
226 | 226 | */ |
|
227 | QAbstractAxis::AxisType QCategoriesAxis::type() const | |
|
227 | QAbstractAxis::AxisType QBarCategoriesAxis::type() const | |
|
228 | 228 | { |
|
229 | 229 | return AxisTypeCategories; |
|
230 | 230 | } |
|
231 | 231 | |
|
232 | 232 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
233 | 233 | |
|
234 | QCategoriesAxisPrivate::QCategoriesAxisPrivate(QCategoriesAxis* q): | |
|
234 | QBarCategoriesAxisPrivate::QBarCategoriesAxisPrivate(QBarCategoriesAxis* q): | |
|
235 | 235 | QAbstractAxisPrivate(q) |
|
236 | 236 | { |
|
237 | 237 | |
|
238 | 238 | } |
|
239 | 239 | |
|
240 | QCategoriesAxisPrivate::~QCategoriesAxisPrivate() | |
|
240 | QBarCategoriesAxisPrivate::~QBarCategoriesAxisPrivate() | |
|
241 | 241 | { |
|
242 | 242 | |
|
243 | 243 | } |
|
244 | 244 | |
|
245 | void QCategoriesAxisPrivate::setMin(const QVariant &min) | |
|
245 | void QBarCategoriesAxisPrivate::setMin(const QVariant &min) | |
|
246 | 246 | { |
|
247 | 247 | setRange(min,m_maxCategory); |
|
248 | 248 | } |
|
249 | 249 | |
|
250 | void QCategoriesAxisPrivate::setMax(const QVariant &max) | |
|
250 | void QBarCategoriesAxisPrivate::setMax(const QVariant &max) | |
|
251 | 251 | { |
|
252 | 252 | setRange(m_minCategory,max); |
|
253 | 253 | } |
|
254 | 254 | |
|
255 | void QCategoriesAxisPrivate::setRange(const QVariant &min, const QVariant &max) | |
|
255 | void QBarCategoriesAxisPrivate::setRange(const QVariant &min, const QVariant &max) | |
|
256 | 256 | { |
|
257 | Q_Q(QCategoriesAxis); | |
|
257 | Q_Q(QBarCategoriesAxis); | |
|
258 | 258 | QString value1 = min.toString(); |
|
259 | 259 | QString value2 = max.toString(); |
|
260 | 260 | q->setRange(value1,value2); |
|
261 | 261 | } |
|
262 | 262 | |
|
263 | int QCategoriesAxisPrivate::ticksCount() const | |
|
263 | int QBarCategoriesAxisPrivate::ticksCount() const | |
|
264 | 264 | { |
|
265 | 265 | return m_categories.count()+1; |
|
266 | 266 | } |
|
267 | 267 | |
|
268 | void QCategoriesAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count) | |
|
268 | void QBarCategoriesAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count) | |
|
269 | 269 | { |
|
270 | 270 | m_min = min; |
|
271 | 271 | m_max = max; |
|
272 | 272 | m_ticksCount = count; |
|
273 | 273 | } |
|
274 | 274 | |
|
275 | ChartAxis* QCategoriesAxisPrivate::createGraphics(ChartPresenter* presenter) | |
|
275 | ChartAxis* QBarCategoriesAxisPrivate::createGraphics(ChartPresenter* presenter) | |
|
276 | 276 | { |
|
277 | Q_Q( QCategoriesAxis); | |
|
277 | Q_Q( QBarCategoriesAxis); | |
|
278 | 278 | if(m_orientation == Qt::Vertical){ |
|
279 | 279 | return new ChartCategoriesAxisY(q,presenter); |
|
280 | 280 | }else{ |
@@ -282,9 +282,9 ChartAxis* QCategoriesAxisPrivate::createGraphics(ChartPresenter* presenter) | |||
|
282 | 282 | } |
|
283 | 283 | } |
|
284 | 284 | |
|
285 | void QCategoriesAxisPrivate::emitRange() | |
|
285 | void QBarCategoriesAxisPrivate::emitRange() | |
|
286 | 286 | { |
|
287 | Q_Q( QCategoriesAxis); | |
|
287 | Q_Q( QBarCategoriesAxis); | |
|
288 | 288 | if(!q->signalsBlocked()) { |
|
289 | 289 | emit changed(m_min -0.5, m_max +0.5, qCeil(m_max + 0.5) -qCeil(m_min - 0.5) +1, false); |
|
290 | 290 | } |
@@ -25,9 +25,9 | |||
|
25 | 25 | |
|
26 | 26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | 27 | |
|
28 | class QCategoriesAxisPrivate; | |
|
28 | class QBarCategoriesAxisPrivate; | |
|
29 | 29 | |
|
30 | class QTCOMMERCIALCHART_EXPORT QCategoriesAxis : public QAbstractAxis | |
|
30 | class QTCOMMERCIALCHART_EXPORT QBarCategoriesAxis : public QAbstractAxis | |
|
31 | 31 | { |
|
32 | 32 | Q_OBJECT |
|
33 | 33 | Q_PROPERTY(QStringList categories READ categories WRITE setCategories NOTIFY categoriesChanged) |
@@ -35,11 +35,11 class QTCOMMERCIALCHART_EXPORT QCategoriesAxis : public QAbstractAxis | |||
|
35 | 35 | Q_PROPERTY(QString max READ max WRITE setMax NOTIFY maxChanged) |
|
36 | 36 | |
|
37 | 37 | public: |
|
38 | explicit QCategoriesAxis(QObject *parent = 0); | |
|
39 | ~QCategoriesAxis(); | |
|
38 | explicit QBarCategoriesAxis(QObject *parent = 0); | |
|
39 | ~QBarCategoriesAxis(); | |
|
40 | 40 | |
|
41 | 41 | protected: |
|
42 | QCategoriesAxis(QCategoriesAxisPrivate &d,QObject *parent = 0); | |
|
42 | QBarCategoriesAxis(QBarCategoriesAxisPrivate &d,QObject *parent = 0); | |
|
43 | 43 | |
|
44 | 44 | public: |
|
45 | 45 | AxisType type() const; |
@@ -67,8 +67,8 Q_SIGNALS: | |||
|
67 | 67 | void rangeChanged(const QString &min, const QString &max); |
|
68 | 68 | |
|
69 | 69 | private: |
|
70 | Q_DECLARE_PRIVATE(QCategoriesAxis) | |
|
71 | Q_DISABLE_COPY(QCategoriesAxis) | |
|
70 | Q_DECLARE_PRIVATE(QBarCategoriesAxis) | |
|
71 | Q_DISABLE_COPY(QBarCategoriesAxis) | |
|
72 | 72 | }; |
|
73 | 73 | |
|
74 | 74 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -35,13 +35,13 | |||
|
35 | 35 | |
|
36 | 36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
37 | 37 | |
|
38 | class QCategoriesAxisPrivate : public QAbstractAxisPrivate | |
|
38 | class QBarCategoriesAxisPrivate : public QAbstractAxisPrivate | |
|
39 | 39 | { |
|
40 | 40 | Q_OBJECT |
|
41 | 41 | |
|
42 | 42 | public: |
|
43 | QCategoriesAxisPrivate(QCategoriesAxis *q); | |
|
44 | ~QCategoriesAxisPrivate(); | |
|
43 | QBarCategoriesAxisPrivate(QBarCategoriesAxis *q); | |
|
44 | ~QBarCategoriesAxisPrivate(); | |
|
45 | 45 | |
|
46 | 46 | public: |
|
47 | 47 | ChartAxis* createGraphics(ChartPresenter* presenter); |
@@ -66,7 +66,7 private: | |||
|
66 | 66 | QString m_maxCategory; |
|
67 | 67 | |
|
68 | 68 | private: |
|
69 | Q_DECLARE_PUBLIC(QCategoriesAxis) | |
|
69 | Q_DECLARE_PUBLIC(QBarCategoriesAxis) | |
|
70 | 70 | }; |
|
71 | 71 | |
|
72 | 72 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -712,7 +712,7 void QAbstractBarSeriesPrivate::initializeAxisX(QAbstractAxis* axis) | |||
|
712 | 712 | { |
|
713 | 713 | if(axis->type()==QAbstractAxis::AxisTypeCategories) |
|
714 | 714 | { |
|
715 | QCategoriesAxis* cataxis = qobject_cast<QCategoriesAxis*>(axis); | |
|
715 | QBarCategoriesAxis* cataxis = qobject_cast<QBarCategoriesAxis*>(axis); | |
|
716 | 716 | Q_ASSERT(cataxis); |
|
717 | 717 | QStringList categories; |
|
718 | 718 | for (int i(1); i < categoryCount()+1; i++) |
@@ -163,7 +163,7 QAbstractAxis* ChartDataSet::createAxis(QAbstractAxis::AxisType type) | |||
|
163 | 163 | axis = new QValuesAxis(this); |
|
164 | 164 | break; |
|
165 | 165 | case QAbstractAxis::AxisTypeCategories: |
|
166 | axis = new QCategoriesAxis(this); | |
|
166 | axis = new QBarCategoriesAxis(this); | |
|
167 | 167 | break; |
|
168 | 168 | default: |
|
169 | 169 | axis = 0; |
@@ -275,17 +275,17 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS | |||
|
275 | 275 | QAbstractBarSeries* series = 0; |
|
276 | 276 | if (seriesName == "Bar") { |
|
277 | 277 | series = new QBarSeries(this); |
|
278 | QCategoriesAxis* axis = new QCategoriesAxis(); | |
|
278 | QBarCategoriesAxis* axis = new QBarCategoriesAxis(); | |
|
279 | 279 | axis->append(category); |
|
280 | 280 | m_chart->setAxisX(axis,series); |
|
281 | 281 | } else if (seriesName == "Stacked bar") { |
|
282 | 282 | series = new QStackedBarSeries(this); |
|
283 | QCategoriesAxis* axis = new QCategoriesAxis(); | |
|
283 | QBarCategoriesAxis* axis = new QBarCategoriesAxis(); | |
|
284 | 284 | axis->append(category); |
|
285 | 285 | m_chart->setAxisX(axis,series); |
|
286 | 286 | } else { |
|
287 | 287 | series = new QPercentBarSeries(this); |
|
288 | QCategoriesAxis* axis = new QCategoriesAxis(); | |
|
288 | QBarCategoriesAxis* axis = new QBarCategoriesAxis(); | |
|
289 | 289 | axis->append(category); |
|
290 | 290 | m_chart->setAxisX(axis,series); |
|
291 | 291 | } |
@@ -29,7 +29,7 ChartView { | |||
|
29 | 29 | |
|
30 | 30 | property variant series: mySeries |
|
31 | 31 | |
|
32 | CategoriesAxis { | |
|
32 | BarCategoriesAxis { | |
|
33 | 33 | id:myAxis; |
|
34 | 34 | categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } |
|
35 | 35 |
General Comments 0
You need to be logged in to leave comments.
Login now