@@ -13,10 +13,10 QChartAxisCategories::~QChartAxisCategories() | |||
|
13 | 13 | // TODO Auto-generated destructor stub |
|
14 | 14 | } |
|
15 | 15 | |
|
16 |
void QChartAxisCategories::insert(QBarCategor |
|
|
16 | void QChartAxisCategories::insert(const QBarCategories& categories) | |
|
17 | 17 | { |
|
18 | 18 | int i=1; |
|
19 |
foreach(QString string , categor |
|
|
19 | foreach(QString string , categories){ | |
|
20 | 20 | m_map.insert(i,string); |
|
21 | 21 | i++; |
|
22 | 22 | } |
@@ -14,7 +14,7 private: | |||
|
14 | 14 | public: |
|
15 | 15 | ~QChartAxisCategories(); |
|
16 | 16 | |
|
17 |
void insert(QBarCategor |
|
|
17 | void insert(const QBarCategories& category); | |
|
18 | 18 | void insert(qreal value,QString label); |
|
19 | 19 | void remove(qreal value); |
|
20 | 20 | QString label(qreal value) const; |
@@ -33,7 +33,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
33 | 33 | Constructs empty QBarSeries. Parameter \a categories defines the categories for chart. |
|
34 | 34 | QBarSeries is QObject which is a child of a \a parent. |
|
35 | 35 | */ |
|
36 |
QBarSeries::QBarSeries(Q |
|
|
36 | QBarSeries::QBarSeries(QBarCategories categories, QObject *parent) | |
|
37 | 37 | : QSeries(parent) |
|
38 | 38 | ,mModel(new BarChartModel(categories, this)) |
|
39 | 39 | { |
@@ -365,6 +365,16 void QBarSeries::barsetChanged() | |||
|
365 | 365 | emit updatedBars(); |
|
366 | 366 | } |
|
367 | 367 | |
|
368 | QBarCategories QBarSeries::categories() const | |
|
369 | { | |
|
370 | QBarCategories categories; | |
|
371 | int count = mModel->categoryCount(); | |
|
372 | for (int i=1; i<=count; i++) { | |
|
373 | categories.insert(i, mModel->categoryName(i-1)); | |
|
374 | } | |
|
375 | return categories; | |
|
376 | } | |
|
377 | ||
|
368 | 378 | #include "moc_qbarseries.cpp" |
|
369 | 379 | |
|
370 | 380 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -6,7 +6,7 | |||
|
6 | 6 | |
|
7 | 7 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | 8 | |
|
9 |
typedef QStringList QBarCategor |
|
|
9 | typedef QStringList QBarCategories; | |
|
10 | 10 | |
|
11 | 11 | class QBarSet; |
|
12 | 12 | class BarChartModel; |
@@ -29,6 +29,8 public: | |||
|
29 | 29 | int barsetCount(); |
|
30 | 30 | int categoryCount(); |
|
31 | 31 | QList<QBarSet*> barSets(); |
|
32 | QBarCategories categories() const; | |
|
33 | ||
|
32 | 34 | |
|
33 | 35 | bool setModel(QAbstractItemModel* model); |
|
34 | 36 | QAbstractItemModel* modelExt() {return m_model;} |
@@ -240,12 +240,9 void ChartDataSet::calculateDomain(QSeries* series,Domain* domain) | |||
|
240 | 240 | |
|
241 | 241 | void ChartDataSet::setupCategories(QBarSeries* series) |
|
242 | 242 | { |
|
243 | int count = series->categoryCount(); | |
|
244 | 243 | QChartAxisCategories* categories = axisX()->categories(); |
|
245 | 244 | categories->clear(); |
|
246 | for (int i=1; i<=count; i++) { | |
|
247 | categories->insert(i,series->categoryName(i-1)); | |
|
248 | } | |
|
245 | categories->insert(series->categories()); | |
|
249 | 246 | } |
|
250 | 247 | |
|
251 | 248 | void ChartDataSet::zoomInDomain(const QRectF& rect, const QSizeF& size) |
General Comments 0
You need to be logged in to leave comments.
Login now