@@ -157,7 +157,9 void ChartTheme::decorate(BarPresenter* item, QBarSeries* series,int count) | |||||
157 | { |
|
157 | { | |
158 | QList<QBarSet*> sets = series->barSets(); |
|
158 | QList<QBarSet*> sets = series->barSets(); | |
159 | for (int i=0; i<sets.count(); i++) { |
|
159 | for (int i=0; i<sets.count(); i++) { | |
160 | qreal pos = (qreal) i / (qreal) sets.count(); |
|
160 | qreal pos = 0.5; | |
|
161 | if (sets.count() > 1) | |||
|
162 | pos = (qreal) i / (qreal) (sets.count() - 1); | |||
161 | QColor c = colorAt(m_seriesGradients.at(count % m_seriesGradients.size()), pos); |
|
163 | QColor c = colorAt(m_seriesGradients.at(count % m_seriesGradients.size()), pos); | |
162 | sets.at(i)->setBrush(QBrush(c)); |
|
164 | sets.at(i)->setBrush(QBrush(c)); | |
163 |
|
165 | |||
@@ -177,7 +179,9 void ChartTheme::decorate(StackedBarPresenter* item, QStackedBarSeries* series,i | |||||
177 | { |
|
179 | { | |
178 | QList<QBarSet*> sets = series->barSets(); |
|
180 | QList<QBarSet*> sets = series->barSets(); | |
179 | for (int i=0; i<sets.count(); i++) { |
|
181 | for (int i=0; i<sets.count(); i++) { | |
180 | qreal pos = (qreal) i / (qreal) sets.count(); |
|
182 | qreal pos = 0.5; | |
|
183 | if (sets.count() > 1) | |||
|
184 | pos = (qreal) i / (qreal) (sets.count() - 1); | |||
181 | QColor c = colorAt(m_seriesGradients.at(count % m_seriesGradients.size()), pos); |
|
185 | QColor c = colorAt(m_seriesGradients.at(count % m_seriesGradients.size()), pos); | |
182 | sets.at(i)->setBrush(QBrush(c)); |
|
186 | sets.at(i)->setBrush(QBrush(c)); | |
183 |
|
187 | |||
@@ -194,7 +198,9 void ChartTheme::decorate(PercentBarPresenter* item, QPercentBarSeries* series,i | |||||
194 | { |
|
198 | { | |
195 | QList<QBarSet*> sets = series->barSets(); |
|
199 | QList<QBarSet*> sets = series->barSets(); | |
196 | for (int i=0; i<sets.count(); i++) { |
|
200 | for (int i=0; i<sets.count(); i++) { | |
197 | qreal pos = (qreal) i / (qreal) sets.count(); |
|
201 | qreal pos = 0.5; | |
|
202 | if (sets.count() > 1) | |||
|
203 | pos = (qreal) i / (qreal) (sets.count() - 1); | |||
198 | QColor c = colorAt(m_seriesGradients.at(count % m_seriesGradients.size()), pos); |
|
204 | QColor c = colorAt(m_seriesGradients.at(count % m_seriesGradients.size()), pos); | |
199 | sets.at(i)->setBrush(QBrush(c)); |
|
205 | sets.at(i)->setBrush(QBrush(c)); | |
200 |
|
206 |
@@ -7,25 +7,12 class ChartThemeScientific: public ChartTheme | |||||
7 | public: |
|
7 | public: | |
8 | ChartThemeScientific():ChartTheme(QChart::ChartThemeScientific) |
|
8 | ChartThemeScientific():ChartTheme(QChart::ChartThemeScientific) | |
9 | { |
|
9 | { | |
10 | m_seriesColors << QRgb(0xFF000000); |
|
|||
11 | m_seriesColors << QRgb(0xFFFFAD00); |
|
10 | m_seriesColors << QRgb(0xFFFFAD00); | |
12 | m_seriesColors << QRgb(0xFF596A75); |
|
11 | m_seriesColors << QRgb(0xFF596A75); | |
|
12 | m_seriesColors << QRgb(0xFF202020); | |||
13 | m_seriesColors << QRgb(0xFF474747); |
|
13 | m_seriesColors << QRgb(0xFF474747); | |
14 |
|
14 | |||
15 |
|
|
15 | generateSeriesGradients(); | |
16 | g1.setColorAt(0.0, m_seriesColors.at(0)); |
|
|||
17 | g1.setColorAt(1.0, m_seriesColors.at(1)); |
|
|||
18 | m_seriesGradients << g1; |
|
|||
19 |
|
||||
20 | QLinearGradient g2; |
|
|||
21 | g2.setColorAt(0.0, m_seriesColors.at(1)); |
|
|||
22 | g2.setColorAt(1.0, m_seriesColors.at(2)); |
|
|||
23 | m_seriesGradients << g2; |
|
|||
24 |
|
||||
25 | QLinearGradient g3; |
|
|||
26 | g3.setColorAt(0.0, m_seriesColors.at(2)); |
|
|||
27 | g3.setColorAt(1.0, m_seriesColors.at(3)); |
|
|||
28 | m_seriesGradients << g3; |
|
|||
29 |
|
16 | |||
30 | QLinearGradient backgroundGradient; |
|
17 | QLinearGradient backgroundGradient; | |
31 | backgroundGradient.setColorAt(0.0, QRgb(0xffafafaf)); |
|
18 | backgroundGradient.setColorAt(0.0, QRgb(0xffafafaf)); |
General Comments 0
You need to be logged in to leave comments.
Login now