@@ -258,6 +258,19 int ChartDataSet::seriesCount(QSeries::QSeriesType type) | |||||
258 | return count; |
|
258 | return count; | |
259 | } |
|
259 | } | |
260 |
|
260 | |||
|
261 | int ChartDataSet::seriesIndex(QSeries *series) | |||
|
262 | { | |||
|
263 | int count(-1); | |||
|
264 | QMapIterator<QSeries*, QChartAxis*> i(m_seriesAxisMap); | |||
|
265 | while (i.hasNext()) { | |||
|
266 | i.next(); | |||
|
267 | count++; | |||
|
268 | if (i.key() == series) | |||
|
269 | return count; | |||
|
270 | } | |||
|
271 | return count; | |||
|
272 | } | |||
|
273 | ||||
261 | QChartAxis* ChartDataSet::axisY(QSeries* series) const |
|
274 | QChartAxis* ChartDataSet::axisY(QSeries* series) const | |
262 | { |
|
275 | { | |
263 | if(series == 0) return m_axisY; |
|
276 | if(series == 0) return m_axisY; |
@@ -25,6 +25,7 public: | |||||
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); |
|
27 | int seriesCount(QSeries::QSeriesType type); | |
|
28 | int seriesIndex(QSeries *series); | |||
28 |
|
29 | |||
29 | Domain* domain(QSeries* series) const; |
|
30 | Domain* domain(QSeries* series) const; | |
30 | Domain* domain(QChartAxis* axis) const; |
|
31 | Domain* domain(QChartAxis* axis) 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_dataset->series |
|
148 | m_chartTheme->decorate(line, lineSeries, m_dataset->seriesIndex(series)); | |
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_dataset->series |
|
162 | m_chartTheme->decorate(area, areaSeries, m_dataset->seriesIndex(series)); | |
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_dataset->series |
|
175 | m_chartTheme->decorate(bar, barSeries, m_dataset->seriesIndex(barSeries)); | |
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_dataset->series |
|
188 | m_chartTheme->decorate(bar, stackedBarSeries, m_dataset->seriesIndex(stackedBarSeries)); | |
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 |
|
201 | m_chartTheme->decorate(bar, percentBarSeries, m_dataset->seriesIndex(percentBarSeries)); | |
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 |
|
|
211 | if(m_options.testFlag(QChart::SeriesAnimations)) { | |
212 |
|
|
212 | m_animator->addAnimation(scatter); | |
213 | } |
|
213 | } | |
214 |
|
|
214 | m_chartTheme->decorate(scatter, scatterSeries, m_dataset->seriesIndex(series)); | |
215 |
|
|
215 | QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),scatter,SLOT(handleGeometryChanged(const QRectF&))); | |
216 |
|
|
216 | QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),scatter,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal))); | |
217 |
|
|
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_dataset->series |
|
227 | m_chartTheme->decorate(pie, pieSeries, m_dataset->seriesIndex(series)); | |
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 | |
@@ -239,13 +239,12 void ChartPresenter::handleSeriesAdded(QSeries* series,Domain* domain) | |||||
239 | } |
|
239 | } | |
240 |
|
240 | |||
241 | case QSeries::SeriesTypeSpline: { |
|
241 | case QSeries::SeriesTypeSpline: { | |
242 |
|
||||
243 |
|
|
242 | QSplineSeries* splineSeries = static_cast<QSplineSeries*>(series); | |
244 |
|
|
243 | SplineChartItem* spline = new SplineChartItem(splineSeries, m_chart); | |
245 |
|
|
244 | if(m_options.testFlag(QChart::SeriesAnimations)) { | |
246 |
|
|
245 | m_animator->addAnimation(spline); | |
247 | } |
|
246 | } | |
248 |
|
|
247 | m_chartTheme->decorate(spline, splineSeries, m_dataset->seriesIndex(series)); | |
249 |
|
|
248 | QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),spline,SLOT(handleGeometryChanged(const QRectF&))); | |
250 |
|
|
249 | QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),spline,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal))); | |
251 |
|
|
250 | item=spline; |
@@ -64,7 +64,7 void ChartTheme::decorate(QChart* chart) | |||||
64 | chart->setChartBackgroundBrush(m_backgroundGradient); |
|
64 | chart->setChartBackgroundBrush(m_backgroundGradient); | |
65 | } |
|
65 | } | |
66 |
|
66 | |||
67 |
void ChartTheme::decorate(AreaChartItem* item, QAreaSeries* series,int |
|
67 | void ChartTheme::decorate(AreaChartItem* item, QAreaSeries* series, int index) | |
68 | { |
|
68 | { | |
69 | QPen pen; |
|
69 | QPen pen; | |
70 | QBrush brush; |
|
70 | QBrush brush; | |
@@ -72,7 +72,7 void ChartTheme::decorate(AreaChartItem* item, QAreaSeries* series,int count) | |||||
72 | if (pen != series->pen()){ |
|
72 | if (pen != series->pen()){ | |
73 | item->setPen(series->pen()); |
|
73 | item->setPen(series->pen()); | |
74 | } else { |
|
74 | } else { | |
75 |
pen.setColor(colorAt(m_seriesGradients.at( |
|
75 | pen.setColor(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 1.0)); | |
76 | pen.setWidthF(2); |
|
76 | pen.setWidthF(2); | |
77 | item->setPen(pen); |
|
77 | item->setPen(pen); | |
78 | } |
|
78 | } | |
@@ -80,106 +80,106 void ChartTheme::decorate(AreaChartItem* item, QAreaSeries* series,int count) | |||||
80 | if (brush != series->brush()) { |
|
80 | if (brush != series->brush()) { | |
81 | item->setBrush(series->brush()); |
|
81 | item->setBrush(series->brush()); | |
82 | } else { |
|
82 | } else { | |
83 |
QBrush brush(m_seriesColors.at( |
|
83 | QBrush brush(m_seriesColors.at(index % m_seriesColors.size())); | |
84 | item->setBrush(brush); |
|
84 | item->setBrush(brush); | |
85 | } |
|
85 | } | |
86 | } |
|
86 | } | |
87 |
|
87 | |||
88 |
|
88 | |||
89 |
void ChartTheme::decorate(LineChartItem* item, QLineSeries* series,int |
|
89 | void ChartTheme::decorate(LineChartItem* item, QLineSeries* series,int index) | |
90 | { |
|
90 | { | |
91 | QPen pen; |
|
91 | QPen pen; | |
92 | if(pen != series->pen()){ |
|
92 | if(pen != series->pen()){ | |
93 | item->setLinePen(series->pen()); |
|
93 | item->setLinePen(series->pen()); | |
94 | return; |
|
94 | return; | |
95 | } |
|
95 | } | |
96 |
pen.setColor(m_seriesColors.at( |
|
96 | pen.setColor(m_seriesColors.at(index%m_seriesColors.size())); | |
97 | pen.setWidthF(2); |
|
97 | pen.setWidthF(2); | |
98 | item->setLinePen(pen); |
|
98 | item->setLinePen(pen); | |
99 | } |
|
99 | } | |
100 |
|
100 | |||
101 |
void ChartTheme::decorate(BarPresenter* item, QBarSeries* series,int |
|
101 | void ChartTheme::decorate(BarPresenter* item, QBarSeries* series,int index) | |
102 | { |
|
102 | { | |
103 | QList<QBarSet*> sets = series->barSets(); |
|
103 | QList<QBarSet*> sets = series->barSets(); | |
104 | for (int i=0; i<sets.count(); i++) { |
|
104 | for (int i=0; i<sets.count(); i++) { | |
105 | qreal pos = 0.5; |
|
105 | qreal pos = 0.5; | |
106 | if (sets.count() > 1) |
|
106 | if (sets.count() > 1) | |
107 | pos = (qreal) i / (qreal) (sets.count() - 1); |
|
107 | pos = (qreal) i / (qreal) (sets.count() - 1); | |
108 |
QColor c = colorAt(m_seriesGradients.at( |
|
108 | QColor c = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), pos); | |
109 | sets.at(i)->setBrush(QBrush(c)); |
|
109 | sets.at(i)->setBrush(QBrush(c)); | |
110 |
|
110 | |||
111 | // Pick label color as far as possible from bar color (within gradient). |
|
111 | // Pick label color as far as possible from bar color (within gradient). | |
112 | // 0.3 is magic number that was picked as value that gave enough contrast with icy theme gradient :) |
|
112 | // 0.3 is magic number that was picked as value that gave enough contrast with icy theme gradient :) | |
113 | // TODO: better picking of label color? |
|
113 | // TODO: better picking of label color? | |
114 | if (pos < 0.3) { |
|
114 | if (pos < 0.3) { | |
115 |
c = colorAt(m_seriesGradients.at( |
|
115 | c = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 1); | |
116 | } else { |
|
116 | } else { | |
117 |
c = colorAt(m_seriesGradients.at( |
|
117 | c = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0); | |
118 | } |
|
118 | } | |
119 | sets.at(i)->setFloatingValuePen(QPen(c)); |
|
119 | sets.at(i)->setFloatingValuePen(QPen(c)); | |
120 | } |
|
120 | } | |
121 | } |
|
121 | } | |
122 |
|
122 | |||
123 |
void ChartTheme::decorate(StackedBarPresenter* item, QStackedBarSeries* series,int |
|
123 | void ChartTheme::decorate(StackedBarPresenter* item, QStackedBarSeries* series,int index) | |
124 | { |
|
124 | { | |
125 | QList<QBarSet*> sets = series->barSets(); |
|
125 | QList<QBarSet*> sets = series->barSets(); | |
126 | for (int i=0; i<sets.count(); i++) { |
|
126 | for (int i=0; i<sets.count(); i++) { | |
127 | qreal pos = 0.5; |
|
127 | qreal pos = 0.5; | |
128 | if (sets.count() > 1) |
|
128 | if (sets.count() > 1) | |
129 | pos = (qreal) i / (qreal) (sets.count() - 1); |
|
129 | pos = (qreal) i / (qreal) (sets.count() - 1); | |
130 |
QColor c = colorAt(m_seriesGradients.at( |
|
130 | QColor c = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), pos); | |
131 | sets.at(i)->setBrush(QBrush(c)); |
|
131 | sets.at(i)->setBrush(QBrush(c)); | |
132 |
|
132 | |||
133 | if (pos < 0.3) { |
|
133 | if (pos < 0.3) { | |
134 |
c = colorAt(m_seriesGradients.at( |
|
134 | c = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 1); | |
135 | } else { |
|
135 | } else { | |
136 |
c = colorAt(m_seriesGradients.at( |
|
136 | c = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0); | |
137 | } |
|
137 | } | |
138 | sets.at(i)->setFloatingValuePen(QPen(c)); |
|
138 | sets.at(i)->setFloatingValuePen(QPen(c)); | |
139 | } |
|
139 | } | |
140 | } |
|
140 | } | |
141 |
|
141 | |||
142 |
void ChartTheme::decorate(PercentBarPresenter* item, QPercentBarSeries* series,int |
|
142 | void ChartTheme::decorate(PercentBarPresenter* item, QPercentBarSeries* series,int index) | |
143 | { |
|
143 | { | |
144 | QList<QBarSet*> sets = series->barSets(); |
|
144 | QList<QBarSet*> sets = series->barSets(); | |
145 | for (int i=0; i<sets.count(); i++) { |
|
145 | for (int i=0; i<sets.count(); i++) { | |
146 | qreal pos = 0.5; |
|
146 | qreal pos = 0.5; | |
147 | if (sets.count() > 1) |
|
147 | if (sets.count() > 1) | |
148 | pos = (qreal) i / (qreal) (sets.count() - 1); |
|
148 | pos = (qreal) i / (qreal) (sets.count() - 1); | |
149 |
QColor c = colorAt(m_seriesGradients.at( |
|
149 | QColor c = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), pos); | |
150 | sets.at(i)->setBrush(QBrush(c)); |
|
150 | sets.at(i)->setBrush(QBrush(c)); | |
151 |
|
151 | |||
152 | if (pos < 0.3) { |
|
152 | if (pos < 0.3) { | |
153 |
c = colorAt(m_seriesGradients.at( |
|
153 | c = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 1); | |
154 | } else { |
|
154 | } else { | |
155 |
c = colorAt(m_seriesGradients.at( |
|
155 | c = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0); | |
156 | } |
|
156 | } | |
157 | sets.at(i)->setFloatingValuePen(QPen(c)); |
|
157 | sets.at(i)->setFloatingValuePen(QPen(c)); | |
158 | } |
|
158 | } | |
159 | } |
|
159 | } | |
160 |
|
160 | |||
161 |
void ChartTheme::decorate(ScatterChartItem* item, QScatterSeries* series, int |
|
161 | void ChartTheme::decorate(ScatterChartItem* item, QScatterSeries* series, int index) | |
162 | { |
|
162 | { | |
163 | Q_ASSERT(item); |
|
163 | Q_ASSERT(item); | |
164 | Q_ASSERT(series); |
|
164 | Q_ASSERT(series); | |
165 |
|
165 | |||
166 | // Use a base color for brush |
|
166 | // Use a base color for brush | |
167 |
item->setBrush(m_seriesColors.at( |
|
167 | item->setBrush(m_seriesColors.at(index % m_seriesColors.size())); | |
168 |
|
168 | |||
169 | // Take pen near from gradient start, effectively using a lighter color for outline |
|
169 | // Take pen near from gradient start, effectively using a lighter color for outline | |
170 | QPen pen(QBrush(Qt::SolidPattern), 3); |
|
170 | QPen pen(QBrush(Qt::SolidPattern), 3); | |
171 |
pen.setColor(colorAt(m_seriesGradients.at( |
|
171 | pen.setColor(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 1.0)); | |
172 | item->setPen(pen); |
|
172 | item->setPen(pen); | |
173 | } |
|
173 | } | |
174 |
|
174 | |||
175 |
void ChartTheme::decorate(PiePresenter* item, QPieSeries* series, int |
|
175 | void ChartTheme::decorate(PiePresenter* item, QPieSeries* series, int index) | |
176 | { |
|
176 | { | |
177 | // Get color for a slice from a gradient linearly, beginning from the start of the gradient |
|
177 | // Get color for a slice from a gradient linearly, beginning from the start of the gradient | |
178 | for (int i(0); i < series->slices().count(); i++) { |
|
178 | for (int i(0); i < series->slices().count(); i++) { | |
179 | qreal pos = (qreal) i / (qreal) series->count(); |
|
179 | qreal pos = (qreal) i / (qreal) series->count(); | |
180 |
QColor penColor = colorAt(m_seriesGradients.at( |
|
180 | QColor penColor = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0.1); | |
181 | series->slices().at(i)->setSlicePen(penColor); |
|
181 | series->slices().at(i)->setSlicePen(penColor); | |
182 |
QColor brushColor = colorAt(m_seriesGradients.at( |
|
182 | QColor brushColor = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), pos); | |
183 | series->slices().at(i)->setSliceBrush(brushColor); |
|
183 | series->slices().at(i)->setSliceBrush(brushColor); | |
184 | } |
|
184 | } | |
185 | } |
|
185 | } | |
@@ -194,7 +194,7 void ChartTheme::decorate(QChartAxis* axis, AxisItem* item) | |||||
194 | axis->setShadesOpacity(0.5); |
|
194 | axis->setShadesOpacity(0.5); | |
195 | } |
|
195 | } | |
196 |
|
196 | |||
197 |
void ChartTheme::decorate(SplineChartItem* item, QSplineSeries* series, int |
|
197 | void ChartTheme::decorate(SplineChartItem* item, QSplineSeries* series, int index) | |
198 | { |
|
198 | { | |
199 | Q_ASSERT(item); |
|
199 | Q_ASSERT(item); | |
200 | Q_ASSERT(series); |
|
200 | Q_ASSERT(series); | |
@@ -204,12 +204,12 void ChartTheme::decorate(SplineChartItem* item, QSplineSeries* series, int coun | |||||
204 | if(pen != series->pen()){ |
|
204 | if(pen != series->pen()){ | |
205 | item->setLinePen(series->pen()); |
|
205 | item->setLinePen(series->pen()); | |
206 | }else{ |
|
206 | }else{ | |
207 |
pen.setColor(m_seriesColors.at( |
|
207 | pen.setColor(m_seriesColors.at(index%m_seriesColors.size())); | |
208 | pen.setWidthF(series->pen().widthF()); |
|
208 | pen.setWidthF(series->pen().widthF()); | |
209 | item->setLinePen(series->pen()); |
|
209 | item->setLinePen(series->pen()); | |
210 | } |
|
210 | } | |
211 |
|
211 | |||
212 |
// QColor color = m_seriesColors.at( |
|
212 | // QColor color = m_seriesColors.at(index % m_seriesColors.size()); | |
213 | // TODO: define alpha in the theme? or in the series? |
|
213 | // TODO: define alpha in the theme? or in the series? | |
214 | //color.setAlpha(120); |
|
214 | //color.setAlpha(120); | |
215 |
|
215 |
@@ -35,16 +35,16 public: | |||||
35 | static ChartTheme* createTheme(QChart::ChartTheme theme); |
|
35 | static ChartTheme* createTheme(QChart::ChartTheme theme); | |
36 | QChart::ChartTheme id() const {return m_id;} |
|
36 | QChart::ChartTheme id() const {return m_id;} | |
37 | void decorate(QChart* chart); |
|
37 | void decorate(QChart* chart); | |
38 |
//void decorate(ChartItem* item, QSeries* series,int |
|
38 | //void decorate(ChartItem* item, QSeries* series,int index); | |
39 |
void decorate(BarPresenter* item, QBarSeries* series,int |
|
39 | void decorate(BarPresenter* item, QBarSeries* series, int index); | |
40 |
void decorate(StackedBarPresenter* item, QStackedBarSeries* series,int |
|
40 | void decorate(StackedBarPresenter* item, QStackedBarSeries* series, int index); | |
41 |
void decorate(PercentBarPresenter* item, QPercentBarSeries* series,int |
|
41 | void decorate(PercentBarPresenter* item, QPercentBarSeries* series, int index); | |
42 |
void decorate(LineChartItem* item, QLineSeries* series,int |
|
42 | void decorate(LineChartItem* item, QLineSeries* series, int index); | |
43 |
void decorate(AreaChartItem* item, QAreaSeries* series,int |
|
43 | void decorate(AreaChartItem* item, QAreaSeries* series, int index); | |
44 |
void decorate(ScatterChartItem* presenter, QScatterSeries* series, int |
|
44 | void decorate(ScatterChartItem* presenter, QScatterSeries* series, int index); | |
45 |
void decorate(PiePresenter* item, QPieSeries* series, int |
|
45 | void decorate(PiePresenter* item, QPieSeries* series, int index); | |
46 | void decorate(QChartAxis* axis,AxisItem* item); |
|
46 | void decorate(QChartAxis* axis,AxisItem* item); | |
47 |
void decorate(SplineChartItem* presenter, QSplineSeries* series, int |
|
47 | void decorate(SplineChartItem* presenter, QSplineSeries* series, int index); | |
48 |
|
48 | |||
49 | public: // utils |
|
49 | public: // utils | |
50 | void generateSeriesGradients(); |
|
50 | void generateSeriesGradients(); |
General Comments 0
You need to be logged in to leave comments.
Login now