@@ -211,7 +211,7 QChart* ThemeWidget::createBarChart(int valueCount) const | |||||
211 | QBarSet *set = new QBarSet("Set" + QString::number(i)); |
|
211 | QBarSet *set = new QBarSet("Set" + QString::number(i)); | |
212 | foreach (Data data, m_dataTable[i]) |
|
212 | foreach (Data data, m_dataTable[i]) | |
213 | *set << data.first.y(); |
|
213 | *set << data.first.y(); | |
214 |
series->a |
|
214 | series->appendBarSet(set); | |
215 | } |
|
215 | } | |
216 | chart->addSeries(series); |
|
216 | chart->addSeries(series); | |
217 | } |
|
217 | } |
@@ -69,11 +69,11 int main(int argc, char *argv[]) | |||||
69 | //![2] |
|
69 | //![2] | |
70 | //![3] |
|
70 | //![3] | |
71 | QBarSeries* series = new QBarSeries(categories); |
|
71 | QBarSeries* series = new QBarSeries(categories); | |
72 |
series->a |
|
72 | series->appendBarSet(set0); | |
73 |
series->a |
|
73 | series->appendBarSet(set1); | |
74 |
series->a |
|
74 | series->appendBarSet(set2); | |
75 |
series->a |
|
75 | series->appendBarSet(set3); | |
76 |
series->a |
|
76 | series->appendBarSet(set4); | |
77 | //![3] |
|
77 | //![3] | |
78 | //![4] |
|
78 | //![4] | |
79 | QChart* chart = new QChart(); |
|
79 | QChart* chart = new QChart(); |
@@ -69,11 +69,11 int main(int argc, char *argv[]) | |||||
69 | //![2] |
|
69 | //![2] | |
70 | //![3] |
|
70 | //![3] | |
71 | QPercentBarSeries* series = new QPercentBarSeries(categories); |
|
71 | QPercentBarSeries* series = new QPercentBarSeries(categories); | |
72 |
series->a |
|
72 | series->appendBarSet(set0); | |
73 |
series->a |
|
73 | series->appendBarSet(set1); | |
74 |
series->a |
|
74 | series->appendBarSet(set2); | |
75 |
series->a |
|
75 | series->appendBarSet(set3); | |
76 |
series->a |
|
76 | series->appendBarSet(set4); | |
77 | //![3] |
|
77 | //![3] | |
78 | //![4] |
|
78 | //![4] | |
79 | QChart* chart = new QChart(); |
|
79 | QChart* chart = new QChart(); |
@@ -69,11 +69,11 int main(int argc, char *argv[]) | |||||
69 | //![2] |
|
69 | //![2] | |
70 | //![3] |
|
70 | //![3] | |
71 | QStackedBarSeries* series = new QStackedBarSeries(categories); |
|
71 | QStackedBarSeries* series = new QStackedBarSeries(categories); | |
72 |
series->a |
|
72 | series->appendBarSet(set0); | |
73 |
series->a |
|
73 | series->appendBarSet(set1); | |
74 |
series->a |
|
74 | series->appendBarSet(set2); | |
75 |
series->a |
|
75 | series->appendBarSet(set3); | |
76 |
series->a |
|
76 | series->appendBarSet(set4); | |
77 | //![3] |
|
77 | //![3] | |
78 | //![4] |
|
78 | //![4] | |
79 | QChart* chart = new QChart(); |
|
79 | QChart* chart = new QChart(); |
@@ -36,9 +36,9 void DeclarativeBarSeries::componentComplete() | |||||
36 | *set1 << 5 << 0 << 0 << 4 << 0 << 7; |
|
36 | *set1 << 5 << 0 << 0 << 4 << 0 << 7; | |
37 | *set2 << 3 << 5 << 8 << 13 << 8 << 5; |
|
37 | *set2 << 3 << 5 << 8 << 13 << 8 << 5; | |
38 |
|
38 | |||
39 |
m_series->a |
|
39 | m_series->appendBarSet(set0); | |
40 |
m_series->a |
|
40 | m_series->appendBarSet(set1); | |
41 |
m_series->a |
|
41 | m_series->appendBarSet(set2); | |
42 |
|
42 | |||
43 | chart->addSeries(m_series); |
|
43 | chart->addSeries(m_series); | |
44 | } |
|
44 | } |
@@ -140,9 +140,9 QVector<QRectF> BarChartItem::calculateLayout() | |||||
140 | value->setPen(barSet->floatingValuePen()); |
|
140 | value->setPen(barSet->floatingValuePen()); | |
141 |
|
141 | |||
142 | if (!qFuzzyIsNull(m_series->valueAt(set,category))) { |
|
142 | if (!qFuzzyIsNull(m_series->valueAt(set,category))) { | |
143 |
value->set |
|
143 | value->setText(QString::number(m_series->valueAt(set, category))); | |
144 | } else { |
|
144 | } else { | |
145 |
value->set |
|
145 | value->setText(QString("")); | |
146 | } |
|
146 | } | |
147 |
|
147 | |||
148 | itemIndex++; |
|
148 | itemIndex++; |
@@ -16,7 +16,7 QStringList BarChartModel::category() | |||||
16 | return m_category; |
|
16 | return m_category; | |
17 | } |
|
17 | } | |
18 |
|
18 | |||
19 |
void BarChartModel::a |
|
19 | void BarChartModel::appendBarSet(QBarSet *set) | |
20 | { |
|
20 | { | |
21 | m_dataModel.append(set); |
|
21 | m_dataModel.append(set); | |
22 | } |
|
22 | } | |
@@ -43,27 +43,27 void BarChartModel::removeCategory(int i) | |||||
43 | m_category.removeAt(i); |
|
43 | m_category.removeAt(i); | |
44 | } |
|
44 | } | |
45 |
|
45 | |||
46 | QBarSet* BarChartModel::setAt(int index) |
|
46 | QBarSet* BarChartModel::barsetAt(int index) const | |
47 | { |
|
47 | { | |
48 | return m_dataModel.at(index); |
|
48 | return m_dataModel.at(index); | |
49 | } |
|
49 | } | |
50 |
|
50 | |||
51 | QList<QBarSet*> BarChartModel::barSets() |
|
51 | QList<QBarSet*> BarChartModel::barSets() const | |
52 | { |
|
52 | { | |
53 | return m_dataModel; |
|
53 | return m_dataModel; | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
56 | int BarChartModel::barsetCount() |
|
56 | int BarChartModel::barsetCount() const | |
57 | { |
|
57 | { | |
58 | return m_dataModel.count(); |
|
58 | return m_dataModel.count(); | |
59 | } |
|
59 | } | |
60 |
|
60 | |||
61 | int BarChartModel::categoryCount() |
|
61 | int BarChartModel::categoryCount() const | |
62 | { |
|
62 | { | |
63 | return m_category.count(); |
|
63 | return m_category.count(); | |
64 | } |
|
64 | } | |
65 |
|
65 | |||
66 | qreal BarChartModel::min() |
|
66 | qreal BarChartModel::min() const | |
67 | { |
|
67 | { | |
68 | Q_ASSERT(m_dataModel.count() > 0); |
|
68 | Q_ASSERT(m_dataModel.count() > 0); | |
69 | // TODO: make min and max members and update them when data changes. |
|
69 | // TODO: make min and max members and update them when data changes. | |
@@ -81,7 +81,7 qreal BarChartModel::min() | |||||
81 | return min; |
|
81 | return min; | |
82 | } |
|
82 | } | |
83 |
|
83 | |||
84 | qreal BarChartModel::max() |
|
84 | qreal BarChartModel::max() const | |
85 | { |
|
85 | { | |
86 | Q_ASSERT(m_dataModel.count() > 0); |
|
86 | Q_ASSERT(m_dataModel.count() > 0); | |
87 |
|
87 | |||
@@ -101,7 +101,7 qreal BarChartModel::max() | |||||
101 | return max; |
|
101 | return max; | |
102 | } |
|
102 | } | |
103 |
|
103 | |||
104 | qreal BarChartModel::valueAt(int set, int category) |
|
104 | qreal BarChartModel::valueAt(int set, int category) const | |
105 | { |
|
105 | { | |
106 | if ((set < 0) || (set >= m_dataModel.count())) { |
|
106 | if ((set < 0) || (set >= m_dataModel.count())) { | |
107 | // No set, no value. |
|
107 | // No set, no value. | |
@@ -114,7 +114,7 qreal BarChartModel::valueAt(int set, int category) | |||||
114 | return m_dataModel.at(set)->valueAt(category); |
|
114 | return m_dataModel.at(set)->valueAt(category); | |
115 | } |
|
115 | } | |
116 |
|
116 | |||
117 | qreal BarChartModel::percentageAt(int set, int category) |
|
117 | qreal BarChartModel::percentageAt(int set, int category) const | |
118 | { |
|
118 | { | |
119 | if ((set < 0) || (set >= m_dataModel.count())) { |
|
119 | if ((set < 0) || (set >= m_dataModel.count())) { | |
120 | // No set, no value. |
|
120 | // No set, no value. | |
@@ -133,7 +133,7 qreal BarChartModel::percentageAt(int set, int category) | |||||
133 | } |
|
133 | } | |
134 |
|
134 | |||
135 |
|
135 | |||
136 | qreal BarChartModel::categorySum(int category) |
|
136 | qreal BarChartModel::categorySum(int category) const | |
137 | { |
|
137 | { | |
138 | qreal sum(0); |
|
138 | qreal sum(0); | |
139 | int count = m_dataModel.count(); // Count sets |
|
139 | int count = m_dataModel.count(); // Count sets | |
@@ -145,7 +145,7 qreal BarChartModel::categorySum(int category) | |||||
145 | return sum; |
|
145 | return sum; | |
146 | } |
|
146 | } | |
147 |
|
147 | |||
148 | qreal BarChartModel::maxCategorySum() |
|
148 | qreal BarChartModel::maxCategorySum() const | |
149 | { |
|
149 | { | |
150 | qreal max = INT_MIN; |
|
150 | qreal max = INT_MIN; | |
151 | int count = categoryCount(); |
|
151 | int count = categoryCount(); |
@@ -20,24 +20,24 public: | |||||
20 | explicit BarChartModel(QStringList categories, QObject *parent = 0); |
|
20 | explicit BarChartModel(QStringList categories, QObject *parent = 0); | |
21 |
|
21 | |||
22 | QStringList category(); |
|
22 | QStringList category(); | |
23 |
void a |
|
23 | void appendBarSet(QBarSet *set); | |
24 | void removeBarSet(QBarSet *set); |
|
24 | void removeBarSet(QBarSet *set); | |
25 | void insertBarSet(int i, QBarSet *set); |
|
25 | void insertBarSet(int i, QBarSet *set); | |
26 | void insertCategory(int i, QString category); |
|
26 | void insertCategory(int i, QString category); | |
27 | void removeCategory(int i); |
|
27 | void removeCategory(int i); | |
28 | QBarSet *setAt(int index); |
|
28 | QBarSet *barsetAt(int index) const; | |
29 | QList<QBarSet *> barSets(); |
|
29 | QList<QBarSet *> barSets() const; | |
30 |
|
30 | |||
31 | int barsetCount(); // Number of sets in model |
|
31 | int barsetCount() const; // Number of sets in model | |
32 | int categoryCount(); // Number of categories |
|
32 | int categoryCount() const; // Number of categories | |
33 |
|
33 | |||
34 | qreal max(); // Maximum value of all sets |
|
34 | qreal max() const; // Maximum value of all sets | |
35 | qreal min(); // Minimum value of all sets |
|
35 | qreal min() const; // Minimum value of all sets | |
36 | qreal valueAt(int set, int category); |
|
36 | qreal valueAt(int set, int category) const; | |
37 | qreal percentageAt(int set, int category); |
|
37 | qreal percentageAt(int set, int category) const; | |
38 |
|
38 | |||
39 | qreal categorySum(int category); |
|
39 | qreal categorySum(int category) const; | |
40 | qreal maxCategorySum(); // returns maximum sum of sets in all categories. |
|
40 | qreal maxCategorySum() const; // returns maximum sum of sets in all categories. | |
41 |
|
41 | |||
42 | QString categoryName(int category); |
|
42 | QString categoryName(int category); | |
43 |
|
43 |
@@ -15,17 +15,17 BarValue::BarValue(QBarSet &set, QGraphicsItem *parent) | |||||
15 | setVisible(false); |
|
15 | setVisible(false); | |
16 | } |
|
16 | } | |
17 |
|
17 | |||
18 |
void BarValue::set |
|
18 | void BarValue::setText(QString str) | |
19 | { |
|
19 | { | |
20 | m_valueString = str; |
|
20 | m_valueString = str; | |
21 | } |
|
21 | } | |
22 |
|
22 | |||
23 |
QString BarValue:: |
|
23 | QString BarValue::text() const | |
24 | { |
|
24 | { | |
25 | return m_valueString; |
|
25 | return m_valueString; | |
26 | } |
|
26 | } | |
27 |
|
27 | |||
28 | void BarValue::setPen(const QPen pen) |
|
28 | void BarValue::setPen(const QPen &pen) | |
29 | { |
|
29 | { | |
30 | m_pen = pen; |
|
30 | m_pen = pen; | |
31 | } |
|
31 | } |
@@ -17,10 +17,10 class BarValue : public QGraphicsObject | |||||
17 | public: |
|
17 | public: | |
18 | BarValue(QBarSet &set, QGraphicsItem *parent = 0); |
|
18 | BarValue(QBarSet &set, QGraphicsItem *parent = 0); | |
19 |
|
19 | |||
20 |
void set |
|
20 | void setText(QString str); | |
21 |
QString |
|
21 | QString text() const; | |
22 |
|
22 | |||
23 | void setPen(const QPen pen); |
|
23 | void setPen(const QPen &pen); | |
24 | QPen pen() const; |
|
24 | QPen pen() const; | |
25 |
|
25 | |||
26 | void resize(qreal w, qreal h); |
|
26 | void resize(qreal w, qreal h); |
@@ -63,9 +63,9 QVector<QRectF> PercentBarChartItem::calculateLayout() | |||||
63 | QString vString(QString::number(p)); |
|
63 | QString vString(QString::number(p)); | |
64 | vString.truncate(3); |
|
64 | vString.truncate(3); | |
65 | vString.append("%"); |
|
65 | vString.append("%"); | |
66 |
value->set |
|
66 | value->setText(vString); | |
67 | } else { |
|
67 | } else { | |
68 |
value->set |
|
68 | value->setText(QString("")); | |
69 | } |
|
69 | } | |
70 |
|
70 | |||
71 | itemIndex++; |
|
71 | itemIndex++; |
@@ -50,9 +50,9 QBarSeries::QBarSeries(QBarCategories categories, QObject *parent) : QSeries(par | |||||
50 | Connects the clicked(QString) and rightClicked(QString) signals |
|
50 | Connects the clicked(QString) and rightClicked(QString) signals | |
51 | of \a set to this series |
|
51 | of \a set to this series | |
52 | */ |
|
52 | */ | |
53 |
void QBarSeries::a |
|
53 | void QBarSeries::appendBarSet(QBarSet *set) | |
54 | { |
|
54 | { | |
55 |
m_internalModel->a |
|
55 | m_internalModel->appendBarSet(set); | |
56 | connect(set, SIGNAL(clicked(QString)), this, SLOT(barsetClicked(QString))); |
|
56 | connect(set, SIGNAL(clicked(QString)), this, SLOT(barsetClicked(QString))); | |
57 | connect(set, SIGNAL(rightClicked(QString)), this, SLOT(barsetRightClicked(QString))); |
|
57 | connect(set, SIGNAL(rightClicked(QString)), this, SLOT(barsetRightClicked(QString))); | |
58 | connect(set, SIGNAL(valueChanged()), this, SLOT(barsetChanged())); |
|
58 | connect(set, SIGNAL(valueChanged()), this, SLOT(barsetChanged())); | |
@@ -91,7 +91,7 void QBarSeries::removeCategory(int i) | |||||
91 | /*! |
|
91 | /*! | |
92 | Returns number of sets in series. |
|
92 | Returns number of sets in series. | |
93 | */ |
|
93 | */ | |
94 | int QBarSeries::barsetCount() |
|
94 | int QBarSeries::barsetCount() const | |
95 | { |
|
95 | { | |
96 | // if(m_model) |
|
96 | // if(m_model) | |
97 | // return m_mapBarTop - m_mapBarBottom; |
|
97 | // return m_mapBarTop - m_mapBarBottom; | |
@@ -102,7 +102,7 int QBarSeries::barsetCount() | |||||
102 | /*! |
|
102 | /*! | |
103 | Returns number of categories in series |
|
103 | Returns number of categories in series | |
104 | */ |
|
104 | */ | |
105 | int QBarSeries::categoryCount() |
|
105 | int QBarSeries::categoryCount() const | |
106 | { |
|
106 | { | |
107 | return m_internalModel->categoryCount(); |
|
107 | return m_internalModel->categoryCount(); | |
108 | } |
|
108 | } | |
@@ -110,7 +110,7 int QBarSeries::categoryCount() | |||||
110 | /*! |
|
110 | /*! | |
111 | Returns a list of sets in series. Keeps ownership of sets. |
|
111 | Returns a list of sets in series. Keeps ownership of sets. | |
112 | */ |
|
112 | */ | |
113 | QList<QBarSet*> QBarSeries::barSets() |
|
113 | QList<QBarSet*> QBarSeries::barSets() const | |
114 | { |
|
114 | { | |
115 | return m_internalModel->barSets(); |
|
115 | return m_internalModel->barSets(); | |
116 | } |
|
116 | } | |
@@ -120,7 +120,7 QList<QBarSet*> QBarSeries::barSets() | |||||
120 | */ |
|
120 | */ | |
121 | QBarSet* QBarSeries::barsetAt(int index) |
|
121 | QBarSet* QBarSeries::barsetAt(int index) | |
122 | { |
|
122 | { | |
123 | return m_internalModel->setAt(index); |
|
123 | return m_internalModel->barsetAt(index); | |
124 | } |
|
124 | } | |
125 |
|
125 | |||
126 | /*! |
|
126 | /*! | |
@@ -141,12 +141,12 void QBarSeries::setToolTipEnabled(bool enabled) | |||||
141 | // TODO: what if we add sets after call to this function? Those sets won't have tooltip enabled. |
|
141 | // TODO: what if we add sets after call to this function? Those sets won't have tooltip enabled. | |
142 | if (enabled) { |
|
142 | if (enabled) { | |
143 | for (int i=0; i<m_internalModel->barsetCount(); i++) { |
|
143 | for (int i=0; i<m_internalModel->barsetCount(); i++) { | |
144 | QBarSet *set = m_internalModel->setAt(i); |
|
144 | QBarSet *set = m_internalModel->barsetAt(i); | |
145 | connect(set, SIGNAL(showToolTip(QPoint,QString)), this, SIGNAL(showToolTip(QPoint,QString))); |
|
145 | connect(set, SIGNAL(showToolTip(QPoint,QString)), this, SIGNAL(showToolTip(QPoint,QString))); | |
146 | } |
|
146 | } | |
147 | } else { |
|
147 | } else { | |
148 | for (int i=0; i<m_internalModel->barsetCount(); i++) { |
|
148 | for (int i=0; i<m_internalModel->barsetCount(); i++) { | |
149 | QBarSet *set = m_internalModel->setAt(i); |
|
149 | QBarSet *set = m_internalModel->barsetAt(i); | |
150 | disconnect(set, SIGNAL(showToolTip(QPoint,QString)), this, SIGNAL(showToolTip(QPoint,QString))); |
|
150 | disconnect(set, SIGNAL(showToolTip(QPoint,QString)), this, SIGNAL(showToolTip(QPoint,QString))); | |
151 | } |
|
151 | } | |
152 | } |
|
152 | } | |
@@ -297,7 +297,7 void QBarSeries::setModelMapping(int categories, int bottomBoundry, int topBound | |||||
297 | QBarSet* barSet = new QBarSet(QString("Column: %1").arg(i + 1)); |
|
297 | QBarSet* barSet = new QBarSet(QString("Column: %1").arg(i + 1)); | |
298 | for(int m = m_mapFirst; m < m_mapFirst + m_mapCount; m++) |
|
298 | for(int m = m_mapFirst; m < m_mapFirst + m_mapCount; m++) | |
299 | *barSet << m_model->data(m_model->index(m, i), Qt::DisplayRole).toDouble(); |
|
299 | *barSet << m_model->data(m_model->index(m, i), Qt::DisplayRole).toDouble(); | |
300 |
a |
|
300 | appendBarSet(barSet); | |
301 | } |
|
301 | } | |
302 | } else { |
|
302 | } else { | |
303 | QStringList categories; |
|
303 | QStringList categories; | |
@@ -309,7 +309,7 void QBarSeries::setModelMapping(int categories, int bottomBoundry, int topBound | |||||
309 | QBarSet* barSet = new QBarSet(QString("Row: %1").arg(i + 1)); |
|
309 | QBarSet* barSet = new QBarSet(QString("Row: %1").arg(i + 1)); | |
310 | for(int m = m_mapFirst; m < m_mapFirst + m_mapCount; m++) |
|
310 | for(int m = m_mapFirst; m < m_mapFirst + m_mapCount; m++) | |
311 | *barSet << m_model->data(m_model->index(i, m), Qt::DisplayRole).toDouble(); |
|
311 | *barSet << m_model->data(m_model->index(i, m), Qt::DisplayRole).toDouble(); | |
312 |
a |
|
312 | appendBarSet(barSet); | |
313 | } |
|
313 | } | |
314 | } |
|
314 | } | |
315 | } |
|
315 | } |
@@ -21,14 +21,14 public: | |||||
21 |
|
21 | |||
22 | virtual QSeriesType type() const { return QSeries::SeriesTypeBar; } |
|
22 | virtual QSeriesType type() const { return QSeries::SeriesTypeBar; } | |
23 |
|
23 | |||
24 |
void a |
|
24 | void appendBarSet(QBarSet *set); // Takes ownership of set | |
25 | void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set |
|
25 | void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set | |
26 | void insertBarSet(int i, QBarSet *set); |
|
26 | void insertBarSet(int i, QBarSet *set); | |
27 | void insertCategory(int i, QString category); |
|
27 | void insertCategory(int i, QString category); | |
28 | void removeCategory(int i); |
|
28 | void removeCategory(int i); | |
29 | int barsetCount(); |
|
29 | int barsetCount() const; | |
30 | int categoryCount(); |
|
30 | int categoryCount() const; | |
31 | QList<QBarSet*> barSets(); |
|
31 | QList<QBarSet*> barSets() const; | |
32 | QBarCategories categories() const; |
|
32 | QBarCategories categories() const; | |
33 |
|
33 | |||
34 | bool setModel(QAbstractItemModel *model); |
|
34 | bool setModel(QAbstractItemModel *model); |
@@ -71,7 +71,7 void QBarSet::setName(QString name) | |||||
71 | /*! |
|
71 | /*! | |
72 | Returns name of the set. |
|
72 | Returns name of the set. | |
73 | */ |
|
73 | */ | |
74 | QString QBarSet::name() |
|
74 | QString QBarSet::name() const | |
75 | { |
|
75 | { | |
76 | return m_name; |
|
76 | return m_name; | |
77 | } |
|
77 | } | |
@@ -99,7 +99,7 void QBarSet::removeValue(int i) | |||||
99 | /*! |
|
99 | /*! | |
100 | Returns count of values in set. |
|
100 | Returns count of values in set. | |
101 | */ |
|
101 | */ | |
102 | int QBarSet::count() |
|
102 | int QBarSet::count() const | |
103 | { |
|
103 | { | |
104 | return m_values.count(); |
|
104 | return m_values.count(); | |
105 | } |
|
105 | } | |
@@ -107,7 +107,7 int QBarSet::count() | |||||
107 | /*! |
|
107 | /*! | |
108 | Returns value of set indexed by \a index |
|
108 | Returns value of set indexed by \a index | |
109 | */ |
|
109 | */ | |
110 | qreal QBarSet::valueAt(int index) |
|
110 | qreal QBarSet::valueAt(int index) const | |
111 | { |
|
111 | { | |
112 | return m_values.at(index); |
|
112 | return m_values.at(index); | |
113 | } |
|
113 | } | |
@@ -124,7 +124,7 void QBarSet::setValue(int index, qreal value) | |||||
124 | /*! |
|
124 | /*! | |
125 | Returns total sum of all values in barset. |
|
125 | Returns total sum of all values in barset. | |
126 | */ |
|
126 | */ | |
127 | qreal QBarSet::total() |
|
127 | qreal QBarSet::total() const | |
128 | { |
|
128 | { | |
129 | qreal total(0); |
|
129 | qreal total(0); | |
130 | for (int i=0; i < m_values.count(); i++) { |
|
130 | for (int i=0; i < m_values.count(); i++) { |
@@ -14,16 +14,16 public: | |||||
14 | QBarSet(QString name, QObject *parent = 0); |
|
14 | QBarSet(QString name, QObject *parent = 0); | |
15 |
|
15 | |||
16 | void setName(QString name); |
|
16 | void setName(QString name); | |
17 | QString name(); |
|
17 | QString name() const; | |
18 | QBarSet& operator << (const qreal &value); // appends new value to set |
|
18 | QBarSet& operator << (const qreal &value); // appends new value to set | |
19 | void insertValue(int i, qreal value); |
|
19 | void insertValue(int i, qreal value); | |
20 | void removeValue(int i); |
|
20 | void removeValue(int i); | |
21 |
|
21 | |||
22 | // TODO: remove indices eventually. Use as internal? |
|
22 | // TODO: remove indices eventually. Use as internal? | |
23 |
int count(); |
|
23 | int count() const; // count of values in set | |
24 | qreal valueAt(int index); // for modifying individual values |
|
24 | qreal valueAt(int index) const; // for modifying individual values | |
25 | void setValue(int index, qreal value); // setter for individual value |
|
25 | void setValue(int index, qreal value); // setter for individual value | |
26 | qreal total(); // total values in the set |
|
26 | qreal total() const; // total values in the set | |
27 |
|
27 | |||
28 | // TODO: |
|
28 | // TODO: | |
29 | //qreal value(QString category); |
|
29 | //qreal value(QString category); |
@@ -65,9 +65,9 QVector<QRectF> StackedBarChartItem::calculateLayout() | |||||
65 | value->setPen(barSet->floatingValuePen()); |
|
65 | value->setPen(barSet->floatingValuePen()); | |
66 |
|
66 | |||
67 | if (!qFuzzyIsNull(m_series->valueAt(set, category))) { |
|
67 | if (!qFuzzyIsNull(m_series->valueAt(set, category))) { | |
68 |
value->set |
|
68 | value->setText(QString::number(m_series->valueAt(set,category))); | |
69 | } else { |
|
69 | } else { | |
70 |
value->set |
|
70 | value->setText(QString("")); | |
71 | } |
|
71 | } | |
72 |
|
72 | |||
73 | itemIndex++; |
|
73 | itemIndex++; |
General Comments 0
You need to be logged in to leave comments.
Login now