@@ -33,8 +33,8 int BarChartModel::countItemsInSeries() | |||
|
33 | 33 | { |
|
34 | 34 | int count(0); |
|
35 | 35 | for (int i=0; i<mSeries.count(); i++){ |
|
36 |
// TODO: can we assume that all series have same number of |
|
|
37 |
int temp = mSeries.at(i)->count |
|
|
36 | // TODO: can we assume that all series have same number of values? If not. then which values are empty? | |
|
37 | int temp = mSeries.at(i)->countValues(); | |
|
38 | 38 | if (temp > count) { |
|
39 | 39 | count = temp; |
|
40 | 40 | } |
@@ -86,7 +86,7 qreal BarChartModel::valueAt(int series, int item) | |||
|
86 | 86 | if ((series < 0) || (series >= mSeries.count())) { |
|
87 | 87 | // No series, no value. |
|
88 | 88 | return 0; |
|
89 |
} else if ((item < 0) || (item >= mSeries.at(series)->count |
|
|
89 | } else if ((item < 0) || (item >= mSeries.at(series)->countValues())) { | |
|
90 | 90 | // No item, no value. |
|
91 | 91 | return 0; |
|
92 | 92 | } |
@@ -141,7 +141,7 qreal BarChartSeriesBase::max() | |||
|
141 | 141 | return max; |
|
142 | 142 | } |
|
143 | 143 | |
|
144 |
int BarChartSeriesBase::count |
|
|
144 | int BarChartSeriesBase::countValues() | |
|
145 | 145 | { |
|
146 | 146 | Q_ASSERT(mData != 0); |
|
147 | 147 | return mData->count(); |
@@ -39,7 +39,7 public: | |||
|
39 | 39 | |
|
40 | 40 | qreal min(); |
|
41 | 41 | qreal max(); |
|
42 |
int count |
|
|
42 | int countValues(); | |
|
43 | 43 | qreal valueAt(int item); |
|
44 | 44 | |
|
45 | 45 | public Q_SLOTS: |
@@ -54,33 +54,38 void ChartDataSet::addSeries(QChartSeries* series) | |||
|
54 | 54 | case QChartSeries::SeriesTypeBar: { |
|
55 | 55 | |
|
56 | 56 | BarChartSeries* barSeries = static_cast<BarChartSeries*>(series); |
|
57 |
qreal x = barSeries->count |
|
|
57 | qreal x = barSeries->countValues(); | |
|
58 | 58 | qreal y = barSeries->max(); |
|
59 | 59 | domain.m_minX = qMin(domain.m_minX,x); |
|
60 | 60 | domain.m_minY = qMin(domain.m_minY,y); |
|
61 | 61 | domain.m_maxX = qMax(domain.m_maxX,x); |
|
62 | 62 | domain.m_maxY = qMax(domain.m_maxY,y); |
|
63 | ||
|
63 | 64 | } |
|
64 | 65 | break; |
|
65 | 66 | case QChartSeries::SeriesTypeStackedBar: { |
|
66 | 67 | |
|
67 | 68 | StackedBarChartSeries* stackedBarSeries = static_cast<StackedBarChartSeries*>(series); |
|
69 | /* | |
|
68 | 70 | qreal x = stackedBarSeries->countColumns(); |
|
69 | 71 | qreal y = stackedBarSeries->maxColumnSum(); |
|
70 | 72 | domain.m_minX = qMin(domain.m_minX,x); |
|
71 | 73 | domain.m_minY = qMin(domain.m_minY,y); |
|
72 | 74 | domain.m_maxX = qMax(domain.m_maxX,x); |
|
73 | 75 | domain.m_maxY = qMax(domain.m_maxY,y); |
|
76 | */ | |
|
74 | 77 | } |
|
75 | 78 | break; |
|
76 | 79 | case QChartSeries::SeriesTypePercentBar: { |
|
77 | 80 | |
|
78 | 81 | PercentBarChartSeries* percentBarSeries = static_cast<PercentBarChartSeries*>(series); |
|
82 | /* | |
|
79 | 83 | qreal x = percentBarSeries->countColumns(); |
|
80 | 84 | domain.m_minX = qMin(domain.m_minX,x); |
|
81 | 85 | domain.m_minY = 0; |
|
82 | 86 | domain.m_maxX = qMax(domain.m_maxX,x); |
|
83 | 87 | domain.m_maxY = 100; |
|
88 | */ | |
|
84 | 89 | } |
|
85 | 90 | break; |
|
86 | 91 |
General Comments 0
You need to be logged in to leave comments.
Login now