@@ -0,0 +1,26 | |||||
|
1 | #include "charttheme_p.h" | |||
|
2 | ||||
|
3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
4 | ||||
|
5 | class ChartThemeDefault: public ChartTheme | |||
|
6 | { | |||
|
7 | public: | |||
|
8 | ChartThemeDefault():ChartTheme(QChart::ChartThemeDefault) | |||
|
9 | { | |||
|
10 | m_seriesColors << QRgb(0xff000000); | |||
|
11 | m_seriesColors << QRgb(0xff707070); | |||
|
12 | ||||
|
13 | QLinearGradient g1; | |||
|
14 | g1.setColorAt(0.0, m_seriesColors.at(0)); | |||
|
15 | g1.setColorAt(1.0, m_seriesColors.at(1)); | |||
|
16 | m_seriesGradients << g1; | |||
|
17 | ||||
|
18 | QLinearGradient backgroundGradient; | |||
|
19 | backgroundGradient.setColorAt(0.0, QRgb(0xffffffff)); | |||
|
20 | backgroundGradient.setColorAt(1.0, QRgb(0xffafafaf)); | |||
|
21 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |||
|
22 | m_backgroundGradient = backgroundGradient; | |||
|
23 | } | |||
|
24 | }; | |||
|
25 | ||||
|
26 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -27,6 +27,7 | |||||
27 | #include "splinechartitem_p.h" |
|
27 | #include "splinechartitem_p.h" | |
28 |
|
28 | |||
29 | //themes |
|
29 | //themes | |
|
30 | #include "chartthemedefault_p.h" | |||
30 | #include "chartthemevanilla_p.h" |
|
31 | #include "chartthemevanilla_p.h" | |
31 | #include "chartthemeicy_p.h" |
|
32 | #include "chartthemeicy_p.h" | |
32 | #include "chartthemegrayscale_p.h" |
|
33 | #include "chartthemegrayscale_p.h" | |
@@ -35,26 +36,9 | |||||
35 |
|
36 | |||
36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
37 |
|
38 | |||
38 | /* TODO |
|
|||
39 | case QChart::ChartThemeUnnamed1: |
|
|||
40 | m_seriesThemes.append(SeriesTheme(QColor(QRgb(0xff3fa9f5)), 2)); |
|
|||
41 | m_seriesThemes.append(SeriesTheme(QColor(QRgb(0xff7AC943)), 2)); |
|
|||
42 | m_seriesThemes.append(SeriesTheme(QColor(QRgb(0xffFF931E)), 2)); |
|
|||
43 | m_seriesThemes.append(SeriesTheme(QColor(QRgb(0xffFF1D25)), 2)); |
|
|||
44 | m_seriesThemes.append(SeriesTheme(QColor(QRgb(0xffFF7BAC)), 2)); |
|
|||
45 |
|
||||
46 | m_gradientStartColor = QColor(QRgb(0xfff3dc9e)); |
|
|||
47 | m_gradientEndColor = QColor(QRgb(0xffafafaf)); |
|
|||
48 | */ |
|
|||
49 |
|
||||
50 | ChartTheme::ChartTheme(QChart::ChartTheme id) |
|
39 | ChartTheme::ChartTheme(QChart::ChartTheme id) | |
51 | { |
|
40 | { | |
52 | m_id = id; |
|
41 | m_id = id; | |
53 | m_seriesColor.append(QRgb(0xff000000)); |
|
|||
54 | m_seriesColor.append(QRgb(0xff707070)); |
|
|||
55 | m_gradientStartColor = QColor(QRgb(0xffffffff)); |
|
|||
56 | m_gradientEndColor = QColor(QRgb(0xffafafaf)); |
|
|||
57 |
|
||||
58 | qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); |
|
42 | qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); | |
59 | } |
|
43 | } | |
60 |
|
44 | |||
@@ -62,8 +46,6 ChartTheme::ChartTheme(QChart::ChartTheme id) | |||||
62 | ChartTheme* ChartTheme::createTheme(QChart::ChartTheme theme) |
|
46 | ChartTheme* ChartTheme::createTheme(QChart::ChartTheme theme) | |
63 | { |
|
47 | { | |
64 | switch(theme) { |
|
48 | switch(theme) { | |
65 | case QChart::ChartThemeDefault: |
|
|||
66 | return new ChartTheme(); |
|
|||
67 | case QChart::ChartThemeVanilla: |
|
49 | case QChart::ChartThemeVanilla: | |
68 | return new ChartThemeVanilla(); |
|
50 | return new ChartThemeVanilla(); | |
69 | case QChart::ChartThemeIcy: |
|
51 | case QChart::ChartThemeIcy: | |
@@ -72,16 +54,14 ChartTheme* ChartTheme::createTheme(QChart::ChartTheme theme) | |||||
72 | return new ChartThemeGrayscale(); |
|
54 | return new ChartThemeGrayscale(); | |
73 | case QChart::ChartThemeScientific: |
|
55 | case QChart::ChartThemeScientific: | |
74 | return new ChartThemeScientific(); |
|
56 | return new ChartThemeScientific(); | |
|
57 | default: | |||
|
58 | return new ChartThemeDefault(); | |||
75 | } |
|
59 | } | |
76 | } |
|
60 | } | |
77 |
|
61 | |||
78 | void ChartTheme::decorate(QChart* chart) |
|
62 | void ChartTheme::decorate(QChart* chart) | |
79 | { |
|
63 | { | |
80 | QLinearGradient backgroundGradient; |
|
64 | chart->setChartBackgroundBrush(m_backgroundGradient); | |
81 | backgroundGradient.setColorAt(0.0, m_gradientStartColor); |
|
|||
82 | backgroundGradient.setColorAt(1.0, m_gradientEndColor); |
|
|||
83 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
|||
84 | chart->setChartBackgroundBrush(backgroundGradient); |
|
|||
85 | } |
|
65 | } | |
86 | //TODO helper to by removed later |
|
66 | //TODO helper to by removed later | |
87 | void ChartTheme::decorate(ChartItem* item, QSeries* series,int count) |
|
67 | void ChartTheme::decorate(ChartItem* item, QSeries* series,int count) | |
@@ -147,7 +127,7 void ChartTheme::decorate(AreaChartItem* item, QAreaSeries* series,int count) | |||||
147 | if(pen != series->pen()){ |
|
127 | if(pen != series->pen()){ | |
148 | item->setPen(series->pen()); |
|
128 | item->setPen(series->pen()); | |
149 | }else{ |
|
129 | }else{ | |
150 | pen.setColor(m_seriesColor.at(count%m_seriesColor.size())); |
|
130 | pen.setColor(m_seriesColors.at(count%m_seriesColors.size())); | |
151 | pen.setWidthF(2); |
|
131 | pen.setWidthF(2); | |
152 | item->setPen(pen); |
|
132 | item->setPen(pen); | |
153 | } |
|
133 | } | |
@@ -155,7 +135,7 void ChartTheme::decorate(AreaChartItem* item, QAreaSeries* series,int count) | |||||
155 | if(brush != series->brush()){ |
|
135 | if(brush != series->brush()){ | |
156 | item->setBrush(series->brush()); |
|
136 | item->setBrush(series->brush()); | |
157 | }else{ |
|
137 | }else{ | |
158 | QBrush brush(m_seriesColor.at(count%m_seriesColor.size())); |
|
138 | QBrush brush(m_seriesColors.at(count%m_seriesColors.size())); | |
159 | item->setBrush(brush); |
|
139 | item->setBrush(brush); | |
160 | } |
|
140 | } | |
161 | } |
|
141 | } | |
@@ -168,7 +148,7 void ChartTheme::decorate(LineChartItem* item, QLineSeries* series,int count) | |||||
168 | item->setLinePen(series->pen()); |
|
148 | item->setLinePen(series->pen()); | |
169 | return; |
|
149 | return; | |
170 | } |
|
150 | } | |
171 | pen.setColor(m_seriesColor.at(count%m_seriesColor.size())); |
|
151 | pen.setColor(m_seriesColors.at(count%m_seriesColors.size())); | |
172 | pen.setWidthF(2); |
|
152 | pen.setWidthF(2); | |
173 | item->setLinePen(pen); |
|
153 | item->setLinePen(pen); | |
174 | } |
|
154 | } | |
@@ -177,7 +157,7 void ChartTheme::decorate(BarPresenter* item, QBarSeries* series,int count) | |||||
177 | { |
|
157 | { | |
178 | QList<QBarSet*> sets = series->barSets(); |
|
158 | QList<QBarSet*> sets = series->barSets(); | |
179 | for (int i=0; i<series->barsetCount(); i++) { |
|
159 | for (int i=0; i<series->barsetCount(); i++) { | |
180 | sets.at(i)->setBrush(QBrush(m_seriesColor.at(i%m_seriesColor.count()))); |
|
160 | sets.at(i)->setBrush(QBrush(m_seriesColors.at(i%m_seriesColors.count()))); | |
181 | } |
|
161 | } | |
182 | } |
|
162 | } | |
183 |
|
163 | |||
@@ -185,7 +165,7 void ChartTheme::decorate(StackedBarPresenter* item, QStackedBarSeries* series,i | |||||
185 | { |
|
165 | { | |
186 | QList<QBarSet*> sets = series->barSets(); |
|
166 | QList<QBarSet*> sets = series->barSets(); | |
187 | for (int i=0; i<series->barsetCount(); i++) { |
|
167 | for (int i=0; i<series->barsetCount(); i++) { | |
188 | sets.at(i)->setBrush(QBrush(m_seriesColor.at(i%m_seriesColor.count()))); |
|
168 | sets.at(i)->setBrush(QBrush(m_seriesColors.at(i%m_seriesColors.count()))); | |
189 | } |
|
169 | } | |
190 | } |
|
170 | } | |
191 |
|
171 | |||
@@ -193,7 +173,7 void ChartTheme::decorate(PercentBarPresenter* item, QPercentBarSeries* series,i | |||||
193 | { |
|
173 | { | |
194 | QList<QBarSet*> sets = series->barSets(); |
|
174 | QList<QBarSet*> sets = series->barSets(); | |
195 | for (int i=0; i<series->barsetCount(); i++) { |
|
175 | for (int i=0; i<series->barsetCount(); i++) { | |
196 | sets.at(i)->setBrush(QBrush(m_seriesColor.at(i%m_seriesColor.count()))); |
|
176 | sets.at(i)->setBrush(QBrush(m_seriesColors.at(i%m_seriesColors.count()))); | |
197 | } |
|
177 | } | |
198 | } |
|
178 | } | |
199 |
|
179 | |||
@@ -202,7 +182,7 void ChartTheme::decorate(ScatterChartItem* item, QScatterSeries* series, int co | |||||
202 | Q_ASSERT(item); |
|
182 | Q_ASSERT(item); | |
203 | Q_ASSERT(series); |
|
183 | Q_ASSERT(series); | |
204 |
|
184 | |||
205 | QColor color = m_seriesColor.at(count % m_seriesColor.size()); |
|
185 | QColor color = m_seriesColors.at(count % m_seriesColors.size()); | |
206 | // TODO: define alpha in the theme? or in the series? |
|
186 | // TODO: define alpha in the theme? or in the series? | |
207 | //color.setAlpha(120); |
|
187 | //color.setAlpha(120); | |
208 |
|
188 | |||
@@ -214,70 +194,25 void ChartTheme::decorate(ScatterChartItem* item, QScatterSeries* series, int co | |||||
214 | item->setPen(pen); |
|
194 | item->setPen(pen); | |
215 | } |
|
195 | } | |
216 |
|
196 | |||
217 |
void ChartTheme::decorate(PiePresenter* item, QPieSeries* series, int |
|
197 | void ChartTheme::decorate(PiePresenter* item, QPieSeries* series, int count) | |
218 | { |
|
198 | { | |
219 | // create a list of slice colors based on current theme |
|
199 | // create a list of slice colors based on current theme | |
220 | int i = 0; |
|
200 | int i = 0; | |
221 | QList<QColor> colors; |
|
201 | QList<QColor> colors; | |
|
202 | bool toggle = false; | |||
222 | while (colors.count() < series->count()) { |
|
203 | while (colors.count() < series->count()) { | |
223 |
|
204 | |||
224 | // get base color |
|
205 | qreal pos = (qreal) colors.count() / (qreal) series->count(); | |
225 | QColor c = m_seriesColor[i++]; |
|
206 | if (toggle) | |
226 | i = i % m_seriesColor.count(); |
|
207 | pos += 0.5; | |
|
208 | toggle = !toggle; | |||
|
209 | if (pos > 1.0) | |||
|
210 | pos = pos - 1.0; | |||
227 |
|
211 | |||
228 | // dont use black colors... looks bad |
|
212 | //qreal pos = (qreal) (qrand() % series->count()) / (qreal) series->count(); | |
229 | if (c == Qt::black) |
|
|||
230 | continue; |
|
|||
231 |
|
213 | |||
232 | // by default use the "raw" theme color |
|
214 | QColor c = colorAt(m_seriesGradients.at(count % m_seriesGradients.size()), pos); | |
233 | if (!colors.contains(c)) { |
|
|||
234 | colors << c; |
|
|||
235 | continue; |
|
|||
236 | } |
|
|||
237 | // ...ok we need to generate something that looks like the same color |
|
|||
238 | // but different lightness |
|
|||
239 |
|
||||
240 | int tryCount = 0; |
|
|||
241 | while (tryCount++ < 100) { |
|
|||
242 |
|
||||
243 | // find maximum value we can raise the lightness |
|
|||
244 | int lMax = 255; |
|
|||
245 | if (lMax > 255 - c.red()) |
|
|||
246 | lMax = 255 - c.red(); |
|
|||
247 | if (lMax > 255 - c.green()) |
|
|||
248 | lMax = 255 - c.green(); |
|
|||
249 | if (lMax > 255 - c.blue()) |
|
|||
250 | lMax = 255 - c.blue(); |
|
|||
251 |
|
||||
252 | // find maximum value we can make it darker |
|
|||
253 | int dMax = 255; |
|
|||
254 | if (dMax > c.red()) |
|
|||
255 | dMax = c.red(); |
|
|||
256 | if (dMax > c.green()) |
|
|||
257 | dMax = c.green(); |
|
|||
258 | if (dMax > c.blue()) |
|
|||
259 | dMax = c.blue(); |
|
|||
260 |
|
||||
261 | int max = dMax + lMax; |
|
|||
262 | if (max == 0) { |
|
|||
263 | // no room to make color lighter or darker... |
|
|||
264 | qDebug() << "cannot generate a color for pie!"; |
|
|||
265 | break; |
|
|||
266 | } |
|
|||
267 |
|
||||
268 | // generate random color |
|
|||
269 | int r = c.red() - dMax; |
|
|||
270 | int g = c.green() - dMax; |
|
|||
271 | int b = c.blue() - dMax; |
|
|||
272 | int d = qrand() % max; |
|
|||
273 | c.setRgb(r+d, g+d, b+d); |
|
|||
274 |
|
||||
275 | // found a unique color? |
|
|||
276 | if (!colors.contains(c)) |
|
|||
277 | break; |
|
|||
278 | } |
|
|||
279 |
|
215 | |||
280 | qDebug() << "generated a color for pie" << c; |
|
|||
281 | colors << c; |
|
216 | colors << c; | |
282 | } |
|
217 | } | |
283 |
|
218 | |||
@@ -290,7 +225,7 void ChartTheme::decorate(PiePresenter* item, QPieSeries* series, int /*count*/) | |||||
290 | } |
|
225 | } | |
291 |
|
226 | |||
292 |
|
227 | |||
293 | void ChartTheme::decorate(QChartAxis* axis,AxisItem* item) |
|
228 | void ChartTheme::decorate(QChartAxis* axis, AxisItem* item) | |
294 | { |
|
229 | { | |
295 | //TODO: dummy defults for now |
|
230 | //TODO: dummy defults for now | |
296 | axis->setLabelsBrush(Qt::black); |
|
231 | axis->setLabelsBrush(Qt::black); | |
@@ -309,12 +244,12 void ChartTheme::decorate(SplineChartItem* item, QSplineSeries* series, int coun | |||||
309 | if(pen != series->pen()){ |
|
244 | if(pen != series->pen()){ | |
310 | item->setLinePen(series->pen()); |
|
245 | item->setLinePen(series->pen()); | |
311 | }else{ |
|
246 | }else{ | |
312 | pen.setColor(m_seriesColor.at(count%m_seriesColor.size())); |
|
247 | pen.setColor(m_seriesColors.at(count%m_seriesColors.size())); | |
313 | pen.setWidthF(series->pen().widthF()); |
|
248 | pen.setWidthF(series->pen().widthF()); | |
314 | item->setLinePen(series->pen()); |
|
249 | item->setLinePen(series->pen()); | |
315 | } |
|
250 | } | |
316 |
|
251 | |||
317 | // QColor color = m_seriesColor.at(count % m_seriesColor.size()); |
|
252 | // QColor color = m_seriesColors.at(count % m_seriesColors.size()); | |
318 | // TODO: define alpha in the theme? or in the series? |
|
253 | // TODO: define alpha in the theme? or in the series? | |
319 | //color.setAlpha(120); |
|
254 | //color.setAlpha(120); | |
320 |
|
255 | |||
@@ -326,4 +261,58 void ChartTheme::decorate(SplineChartItem* item, QSplineSeries* series, int coun | |||||
326 | // presenter->m_markerPen = pen; |
|
261 | // presenter->m_markerPen = pen; | |
327 | } |
|
262 | } | |
328 |
|
263 | |||
|
264 | QColor ChartTheme::colorAt(const QColor &start, const QColor &end, qreal pos) | |||
|
265 | { | |||
|
266 | Q_ASSERT(pos >=0.0 && pos <= 1.0); | |||
|
267 | qreal r = start.redF() + ((end.redF() - start.redF()) * pos); | |||
|
268 | qreal g = start.greenF() + ((end.greenF() - start.greenF()) * pos); | |||
|
269 | qreal b = start.blueF() + ((end.blueF() - start.blueF()) * pos); | |||
|
270 | QColor c; | |||
|
271 | c.setRgbF(r, g, b); | |||
|
272 | return c; | |||
|
273 | } | |||
|
274 | ||||
|
275 | QColor ChartTheme::colorAt(const QGradient &gradient, qreal pos) | |||
|
276 | { | |||
|
277 | Q_ASSERT(pos >=0 && pos <= 1.0); | |||
|
278 | ||||
|
279 | // another possibility: | |||
|
280 | // http://stackoverflow.com/questions/3306786/get-intermediate-color-from-a-gradient | |||
|
281 | ||||
|
282 | QGradientStops stops = gradient.stops(); | |||
|
283 | int count = stops.count(); | |||
|
284 | ||||
|
285 | // find previous stop relative to position | |||
|
286 | QGradientStop prev = stops.first(); | |||
|
287 | for (int i=0; i<count; i++) { | |||
|
288 | QGradientStop stop = stops.at(i); | |||
|
289 | if (pos > stop.first) | |||
|
290 | prev = stop; | |||
|
291 | ||||
|
292 | // given position is actually a stop position? | |||
|
293 | if (pos == stop.first) { | |||
|
294 | //qDebug() << "stop color" << pos; | |||
|
295 | return stop.second; | |||
|
296 | } | |||
|
297 | } | |||
|
298 | ||||
|
299 | // find next stop relative to position | |||
|
300 | QGradientStop next = stops.last(); | |||
|
301 | for (int i=count-1; i>=0; i--) { | |||
|
302 | QGradientStop stop = stops.at(i); | |||
|
303 | if (pos < stop.first) | |||
|
304 | next = stop; | |||
|
305 | } | |||
|
306 | ||||
|
307 | //qDebug() << "prev" << prev.first << "pos" << pos << "next" << next.first; | |||
|
308 | ||||
|
309 | qreal range = next.first - prev.first; | |||
|
310 | qreal posDelta = pos - prev.first; | |||
|
311 | qreal relativePos = posDelta / range; | |||
|
312 | ||||
|
313 | //qDebug() << "range" << range << "posDelta" << posDelta << "relativePos" << relativePos; | |||
|
314 | ||||
|
315 | return colorAt(prev.second, next.second, relativePos); | |||
|
316 | } | |||
|
317 | ||||
329 | QTCOMMERCIALCHART_END_NAMESPACE |
|
318 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -4,6 +4,7 | |||||
4 | #include "qchartglobal.h" |
|
4 | #include "qchartglobal.h" | |
5 | #include "qchart.h" |
|
5 | #include "qchart.h" | |
6 | #include <QColor> |
|
6 | #include <QColor> | |
|
7 | #include <QGradientStops> | |||
7 |
|
8 | |||
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
9 |
|
10 | |||
@@ -45,12 +46,15 public: | |||||
45 | void decorate(QChartAxis* axis,AxisItem* item); |
|
46 | void decorate(QChartAxis* axis,AxisItem* item); | |
46 | void decorate(SplineChartItem* presenter, QSplineSeries* series, int count); |
|
47 | void decorate(SplineChartItem* presenter, QSplineSeries* series, int count); | |
47 |
|
48 | |||
|
49 | public: // utils | |||
|
50 | static QColor colorAt(const QColor &start, const QColor &end, qreal pos); | |||
|
51 | static QColor colorAt(const QGradient &gradient, qreal pos); | |||
|
52 | ||||
48 | protected: |
|
53 | protected: | |
49 | QChart::ChartTheme m_id; |
|
54 | QChart::ChartTheme m_id; | |
50 |
QColor m_ |
|
55 | QList<QColor> m_seriesColors; | |
51 | QColor m_gradientEndColor; |
|
56 | QList<QGradient> m_seriesGradients; | |
52 | QList<QColor> m_seriesColor; |
|
57 | QLinearGradient m_backgroundGradient; | |
53 |
|
||||
54 | }; |
|
58 | }; | |
55 |
|
59 | |||
56 | QTCOMMERCIALCHART_END_NAMESPACE |
|
60 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -35,7 +35,8 include(piechart/piechart.pri) | |||||
35 | include(scatterseries/scatter.pri) |
|
35 | include(scatterseries/scatter.pri) | |
36 | include(splinechart/splinechart.pri) |
|
36 | include(splinechart/splinechart.pri) | |
37 |
|
37 | |||
38 |
THEMES += themes/charttheme |
|
38 | THEMES += themes/chartthemedefault_p.h \ | |
|
39 | themes/chartthemeicy_p.h \ | |||
39 | themes/chartthemegrayscale_p.h \ |
|
40 | themes/chartthemegrayscale_p.h \ | |
40 | themes/chartthemescientific_p.h \ |
|
41 | themes/chartthemescientific_p.h \ | |
41 | themes/chartthemevanilla_p.h |
|
42 | themes/chartthemevanilla_p.h |
@@ -7,13 +7,31 class ChartThemeGrayscale: public ChartTheme | |||||
7 | public: |
|
7 | public: | |
8 | ChartThemeGrayscale():ChartTheme(QChart::ChartThemeGrayscale) |
|
8 | ChartThemeGrayscale():ChartTheme(QChart::ChartThemeGrayscale) | |
9 | { |
|
9 | { | |
10 |
m_seriesColor |
|
10 | m_seriesColors << QRgb(0xFF869299); | |
11 |
m_seriesColor |
|
11 | m_seriesColors << QRgb(0xFFA5BDCC); | |
12 |
m_seriesColor |
|
12 | m_seriesColors << QRgb(0xFFE8FFFC); | |
13 |
m_seriesColor |
|
13 | m_seriesColors << QRgb(0xFFCCC2C2); | |
14 |
|
14 | |||
15 | m_gradientStartColor = QColor(QRgb(0xffffffff)); |
|
15 | QLinearGradient g1; | |
16 | m_gradientEndColor = QColor(QRgb(0xffafafaf)); |
|
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 | ||||
|
30 | QLinearGradient backgroundGradient; | |||
|
31 | backgroundGradient.setColorAt(0.0, QRgb(0xffffffff)); | |||
|
32 | backgroundGradient.setColorAt(1.0, QRgb(0xffafafaf)); | |||
|
33 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |||
|
34 | m_backgroundGradient = backgroundGradient; | |||
17 | } |
|
35 | } | |
18 | }; |
|
36 | }; | |
19 |
|
37 |
@@ -7,13 +7,31 class ChartThemeIcy: public ChartTheme | |||||
7 | public: |
|
7 | public: | |
8 | ChartThemeIcy():ChartTheme(QChart::ChartThemeIcy) |
|
8 | ChartThemeIcy():ChartTheme(QChart::ChartThemeIcy) | |
9 | { |
|
9 | { | |
10 |
m_seriesColor |
|
10 | m_seriesColors << QRgb(0xFF0D2673); | |
11 |
m_seriesColor |
|
11 | m_seriesColors << QRgb(0xFF2685BF); | |
12 |
m_seriesColor |
|
12 | m_seriesColors << QRgb(0xFF3DADD9); | |
13 |
m_seriesColor |
|
13 | m_seriesColors << QRgb(0xFF62C3D9); | |
14 |
|
14 | |||
15 | m_gradientStartColor = QColor(QRgb(0xffBDE3F2)); |
|
15 | QLinearGradient g1; | |
16 | m_gradientEndColor = QColor(QRgb(0xffafafaf)); |
|
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 | ||||
|
30 | QLinearGradient backgroundGradient; | |||
|
31 | backgroundGradient.setColorAt(0.0, QRgb(0xffBDE3F2)); | |||
|
32 | backgroundGradient.setColorAt(1.0, QRgb(0xffafafaf)); | |||
|
33 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |||
|
34 | m_backgroundGradient = backgroundGradient; | |||
17 | } |
|
35 | } | |
18 | }; |
|
36 | }; | |
19 |
|
37 |
@@ -7,13 +7,31 class ChartThemeScientific: public ChartTheme | |||||
7 | public: |
|
7 | public: | |
8 | ChartThemeScientific():ChartTheme(QChart::ChartThemeScientific) |
|
8 | ChartThemeScientific():ChartTheme(QChart::ChartThemeScientific) | |
9 | { |
|
9 | { | |
10 |
m_seriesColor |
|
10 | m_seriesColors << QRgb(0xFF000000); | |
11 |
m_seriesColor |
|
11 | m_seriesColors << QRgb(0xFFFFAD00); | |
12 |
m_seriesColor |
|
12 | m_seriesColors << QRgb(0xFF596A75); | |
13 |
m_seriesColor |
|
13 | m_seriesColors << QRgb(0xFF474747); | |
14 |
|
14 | |||
15 | m_gradientStartColor = QColor(QRgb(0xffafafaf)); |
|
15 | QLinearGradient g1; | |
16 | m_gradientEndColor = QColor(QRgb(0xffafafaf)); |
|
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 | ||||
|
30 | QLinearGradient backgroundGradient; | |||
|
31 | backgroundGradient.setColorAt(0.0, QRgb(0xffafafaf)); | |||
|
32 | backgroundGradient.setColorAt(1.0, QRgb(0xffafafaf)); | |||
|
33 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |||
|
34 | m_backgroundGradient = backgroundGradient; | |||
17 | } |
|
35 | } | |
18 | }; |
|
36 | }; | |
19 |
|
37 |
@@ -7,14 +7,37 class ChartThemeVanilla: public ChartTheme | |||||
7 | public: |
|
7 | public: | |
8 | ChartThemeVanilla():ChartTheme(QChart::ChartThemeVanilla) |
|
8 | ChartThemeVanilla():ChartTheme(QChart::ChartThemeVanilla) | |
9 | { |
|
9 | { | |
10 |
m_seriesColor |
|
10 | m_seriesColors << QColor(217, 197, 116); | |
11 |
m_seriesColor |
|
11 | m_seriesColors << QColor(214, 168, 150); | |
12 |
m_seriesColor |
|
12 | m_seriesColors << QColor(160, 160, 113); | |
13 |
m_seriesColor |
|
13 | m_seriesColors << QColor(210, 210, 52); | |
14 |
m_seriesColor |
|
14 | m_seriesColors << QColor(136, 114, 58); | |
15 |
|
15 | |||
16 | m_gradientStartColor = QColor(QRgb(0xff9d844d)); |
|
16 | QLinearGradient g1; | |
17 | m_gradientEndColor = QColor(QRgb(0xffafafaf)); |
|
17 | g1.setColorAt(0.0, m_seriesColors.at(0)); | |
|
18 | g1.setColorAt(1.0, m_seriesColors.at(1)); | |||
|
19 | m_seriesGradients << g1; | |||
|
20 | ||||
|
21 | QLinearGradient g2; | |||
|
22 | g2.setColorAt(0.0, m_seriesColors.at(1)); | |||
|
23 | g2.setColorAt(1.0, m_seriesColors.at(2)); | |||
|
24 | m_seriesGradients << g2; | |||
|
25 | ||||
|
26 | QLinearGradient g3; | |||
|
27 | g3.setColorAt(0.0, m_seriesColors.at(2)); | |||
|
28 | g3.setColorAt(1.0, m_seriesColors.at(3)); | |||
|
29 | m_seriesGradients << g3; | |||
|
30 | ||||
|
31 | QLinearGradient g4; | |||
|
32 | g4.setColorAt(0.0, m_seriesColors.at(3)); | |||
|
33 | g4.setColorAt(1.0, m_seriesColors.at(4)); | |||
|
34 | m_seriesGradients << g4; | |||
|
35 | ||||
|
36 | QLinearGradient backgroundGradient; | |||
|
37 | backgroundGradient.setColorAt(0.0, QRgb(0xff9d844d)); | |||
|
38 | backgroundGradient.setColorAt(1.0, QRgb(0xffafafaf)); | |||
|
39 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |||
|
40 | m_backgroundGradient = backgroundGradient; | |||
18 | } |
|
41 | } | |
19 | }; |
|
42 | }; | |
20 |
|
43 |
General Comments 0
You need to be logged in to leave comments.
Login now