##// END OF EJS Templates
Adds proper series counter for theme initialization
Michal Klocek -
r533:3b56d6625202
parent child
Show More
@@ -247,6 +247,17 void ChartDataSet::zoomOutDomain(const QRectF& rect, const QSizeF& size)
247 }
247 }
248 }
248 }
249
249
250 int ChartDataSet::seriesCount(QSeries::QSeriesType type)
251 {
252 int count=0;
253 QMapIterator<QSeries*, QChartAxis*> i( m_seriesAxisMap);
254 while (i.hasNext()) {
255 i.next();
256 if(i.key()->type()==type) count++;
257 }
258 return count;
259 }
260
250 QChartAxis* ChartDataSet::axisY(QSeries* series) const
261 QChartAxis* ChartDataSet::axisY(QSeries* series) const
251 {
262 {
252 if(series == 0) return m_axisY;
263 if(series == 0) return m_axisY;
@@ -24,6 +24,8 public:
24 void zoomOutDomain(const QRectF& rect, const QSizeF& size);
24 void zoomOutDomain(const QRectF& rect, const QSizeF& size);
25 void scrollDomain(int dx,int dy,const QSizeF& size);
25 void scrollDomain(int dx,int dy,const QSizeF& size);
26
26
27 int seriesCount(QSeries::QSeriesType type);
28
27 Domain* domain(QSeries* series) const;
29 Domain* domain(QSeries* series) const;
28 Domain* domain(QChartAxis* axis) const;
30 Domain* domain(QChartAxis* axis) const;
29 QChartAxis* axis(QSeries* series) const;
31 QChartAxis* axis(QSeries* series) const;
@@ -145,7 +145,7 void ChartPresenter::handleSeriesAdded(QSeries* series,Domain* domain)
145 if(m_options.testFlag(QChart::SeriesAnimations)) {
145 if(m_options.testFlag(QChart::SeriesAnimations)) {
146 m_animator->addAnimation(line);
146 m_animator->addAnimation(line);
147 }
147 }
148 m_chartTheme->decorate(line,lineSeries,m_chartItems.count());
148 m_chartTheme->decorate(line,lineSeries,m_dataset->seriesCount(series->type()));
149 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),line,SLOT(handleGeometryChanged(const QRectF&)));
149 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),line,SLOT(handleGeometryChanged(const QRectF&)));
150 QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),line,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal)));
150 QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),line,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal)));
151 item = line;
151 item = line;
@@ -159,7 +159,7 void ChartPresenter::handleSeriesAdded(QSeries* series,Domain* domain)
159 if(m_options.testFlag(QChart::SeriesAnimations)) {
159 if(m_options.testFlag(QChart::SeriesAnimations)) {
160 // m_animator->addAnimation(area);
160 // m_animator->addAnimation(area);
161 }
161 }
162 m_chartTheme->decorate(area,areaSeries,m_chartItems.count());
162 m_chartTheme->decorate(area,areaSeries,m_dataset->seriesCount(series->type()));
163 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),area,SLOT(handleGeometryChanged(const QRectF&)));
163 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),area,SLOT(handleGeometryChanged(const QRectF&)));
164 QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),area,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal)));
164 QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),area,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal)));
165 item=area;
165 item=area;
@@ -172,7 +172,7 void ChartPresenter::handleSeriesAdded(QSeries* series,Domain* domain)
172 if(m_options.testFlag(QChart::SeriesAnimations)) {
172 if(m_options.testFlag(QChart::SeriesAnimations)) {
173 // m_animator->addAnimation(bar);
173 // m_animator->addAnimation(bar);
174 }
174 }
175 m_chartTheme->decorate(bar,barSeries,m_chartItems.count());
175 m_chartTheme->decorate(bar,barSeries,m_dataset->seriesCount(series->type()));
176 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),bar,SLOT(handleGeometryChanged(const QRectF&)));
176 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),bar,SLOT(handleGeometryChanged(const QRectF&)));
177 QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),bar,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal)));
177 QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),bar,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal)));
178 item=bar;
178 item=bar;
@@ -185,7 +185,7 void ChartPresenter::handleSeriesAdded(QSeries* series,Domain* domain)
185 if(m_options.testFlag(QChart::SeriesAnimations)) {
185 if(m_options.testFlag(QChart::SeriesAnimations)) {
186 // m_animator->addAnimation(bar);
186 // m_animator->addAnimation(bar);
187 }
187 }
188 m_chartTheme->decorate(bar,stackedBarSeries,m_chartItems.count());
188 m_chartTheme->decorate(bar,stackedBarSeries,m_dataset->seriesCount(series->type()));
189 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),bar,SLOT(handleGeometryChanged(const QRectF&)));
189 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),bar,SLOT(handleGeometryChanged(const QRectF&)));
190 QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),bar,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal)));
190 QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),bar,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal)));
191 item=bar;
191 item=bar;
@@ -198,7 +198,7 void ChartPresenter::handleSeriesAdded(QSeries* series,Domain* domain)
198 if(m_options.testFlag(QChart::SeriesAnimations)) {
198 if(m_options.testFlag(QChart::SeriesAnimations)) {
199 // m_animator->addAnimation(bar);
199 // m_animator->addAnimation(bar);
200 }
200 }
201 m_chartTheme->decorate(bar,percentBarSeries ,m_chartItems.count());
201 m_chartTheme->decorate(bar,percentBarSeries ,m_dataset->seriesCount(series->type()));
202 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),bar,SLOT(handleGeometryChanged(const QRectF&)));
202 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),bar,SLOT(handleGeometryChanged(const QRectF&)));
203 QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),bar,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal)));
203 QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),bar,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal)));
204 item=bar;
204 item=bar;
@@ -211,7 +211,7 void ChartPresenter::handleSeriesAdded(QSeries* series,Domain* domain)
211 if(m_options.testFlag(QChart::SeriesAnimations)) {
211 if(m_options.testFlag(QChart::SeriesAnimations)) {
212 m_animator->addAnimation(scatter);
212 m_animator->addAnimation(scatter);
213 }
213 }
214 m_chartTheme->decorate(scatter, scatterSeries, m_chartItems.count());
214 m_chartTheme->decorate(scatter, scatterSeries, m_dataset->seriesCount(series->type()));
215 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),scatter,SLOT(handleGeometryChanged(const QRectF&)));
215 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),scatter,SLOT(handleGeometryChanged(const QRectF&)));
216 QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),scatter,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal)));
216 QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),scatter,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal)));
217 item=scatter;
217 item=scatter;
@@ -224,7 +224,7 void ChartPresenter::handleSeriesAdded(QSeries* series,Domain* domain)
224 if(m_options.testFlag(QChart::SeriesAnimations)) {
224 if(m_options.testFlag(QChart::SeriesAnimations)) {
225 // m_animator->addAnimation(pie);
225 // m_animator->addAnimation(pie);
226 }
226 }
227 m_chartTheme->decorate(pie, pieSeries, m_chartItems.count());
227 m_chartTheme->decorate(pie, pieSeries, m_dataset->seriesCount(series->type()));
228 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),pie,SLOT(handleGeometryChanged(const QRectF&)));
228 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),pie,SLOT(handleGeometryChanged(const QRectF&)));
229 QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),pie,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal)));
229 QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),pie,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal)));
230 // Hide all from background when there is only piechart
230 // Hide all from background when there is only piechart
@@ -251,7 +251,7 void ChartPresenter::handleSeriesAdded(QSeries* series,Domain* domain)
251 if(m_options.testFlag(QChart::SeriesAnimations)) {
251 if(m_options.testFlag(QChart::SeriesAnimations)) {
252 m_animator->addAnimation(spline);
252 m_animator->addAnimation(spline);
253 }
253 }
254 m_chartTheme->decorate(spline, splineSeries, m_chartItems.count());
254 m_chartTheme->decorate(spline, splineSeries, m_dataset->seriesCount(series->type()));
255 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),spline,SLOT(handleGeometryChanged(const QRectF&)));
255 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),spline,SLOT(handleGeometryChanged(const QRectF&)));
256 QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),spline,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal)));
256 QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),spline,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal)));
257 item=spline;
257 item=spline;
General Comments 0
You need to be logged in to leave comments. Login now