@@ -30,7 +30,7 class ChartAnimation: public QVariantAnimation | |||||
30 | { |
|
30 | { | |
31 | public: |
|
31 | public: | |
32 | enum Animation { LineDrawAnimation, MoveDownAnimation, MoveUpAnimation }; |
|
32 | enum Animation { LineDrawAnimation, MoveDownAnimation, MoveUpAnimation }; | |
33 |
ChartAnimation(QObject* |
|
33 | ChartAnimation(QObject *parent = 0):QVariantAnimation(parent), m_type(MoveDownAnimation){} | |
34 | void setAnimationType(Animation type){ |
|
34 | void setAnimationType(Animation type){ | |
35 | m_type=type; |
|
35 | m_type=type; | |
36 | } |
|
36 | } |
@@ -33,7 +33,7 class SplineAnimation : public ChartAnimation | |||||
33 | { |
|
33 | { | |
34 | public: |
|
34 | public: | |
35 |
|
35 | |||
36 |
SplineAnimation(SplineChartItem* |
|
36 | SplineAnimation(SplineChartItem *item); | |
37 | ~SplineAnimation(); |
|
37 | ~SplineAnimation(); | |
38 | void setValues(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, QVector<QPointF> &oldContorlPoints, QVector<QPointF> &newControlPoints, int index); |
|
38 | void setValues(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, QVector<QPointF> &oldContorlPoints, QVector<QPointF> &newControlPoints, int index); | |
39 |
|
39 |
@@ -99,7 +99,7 ChartTheme* ChartTheme::createTheme(QChart::ChartTheme theme) | |||||
99 | } |
|
99 | } | |
100 | } |
|
100 | } | |
101 |
|
101 | |||
102 |
void ChartTheme::decorate(QChart* |
|
102 | void ChartTheme::decorate(QChart *chart) | |
103 | { |
|
103 | { | |
104 | QBrush brush; |
|
104 | QBrush brush; | |
105 |
|
105 | |||
@@ -109,7 +109,7 void ChartTheme::decorate(QChart* chart) | |||||
109 | chart->setTitleBrush(m_titleBrush); |
|
109 | chart->setTitleBrush(m_titleBrush); | |
110 | } |
|
110 | } | |
111 |
|
111 | |||
112 |
void ChartTheme::decorate(QLegend* |
|
112 | void ChartTheme::decorate(QLegend *legend) | |
113 | { |
|
113 | { | |
114 | QPen pen; |
|
114 | QPen pen; | |
115 | QBrush brush; |
|
115 | QBrush brush; | |
@@ -124,7 +124,7 void ChartTheme::decorate(QLegend* legend) | |||||
124 | } |
|
124 | } | |
125 | } |
|
125 | } | |
126 |
|
126 | |||
127 |
void ChartTheme::decorate(QAreaSeries* |
|
127 | void ChartTheme::decorate(QAreaSeries *series, int index) | |
128 | { |
|
128 | { | |
129 | QPen pen; |
|
129 | QPen pen; | |
130 | QBrush brush; |
|
130 | QBrush brush; | |
@@ -142,7 +142,7 void ChartTheme::decorate(QAreaSeries* series, int index) | |||||
142 | } |
|
142 | } | |
143 |
|
143 | |||
144 |
|
144 | |||
145 |
void ChartTheme::decorate(QLineSeries* |
|
145 | void ChartTheme::decorate(QLineSeries *series,int index) | |
146 | { |
|
146 | { | |
147 | QPen pen; |
|
147 | QPen pen; | |
148 | if(pen == series->pen() || m_force ){ |
|
148 | if(pen == series->pen() || m_force ){ | |
@@ -152,11 +152,11 void ChartTheme::decorate(QLineSeries* series,int index) | |||||
152 | } |
|
152 | } | |
153 | } |
|
153 | } | |
154 |
|
154 | |||
155 |
void ChartTheme::decorate(QBarSeries* |
|
155 | void ChartTheme::decorate(QBarSeries *series, int index) | |
156 | { |
|
156 | { | |
157 | QBrush brush; |
|
157 | QBrush brush; | |
158 | QPen pen; |
|
158 | QPen pen; | |
159 | QList<QBarSet*> sets = series->barSets(); |
|
159 | QList<QBarSet *> sets = series->barSets(); | |
160 |
|
160 | |||
161 | qreal takeAtPos = 0.5; |
|
161 | qreal takeAtPos = 0.5; | |
162 | qreal step = 0.2; |
|
162 | qreal step = 0.2; | |
@@ -194,7 +194,7 void ChartTheme::decorate(QBarSeries* series, int index) | |||||
194 | } |
|
194 | } | |
195 | } |
|
195 | } | |
196 |
|
196 | |||
197 |
void ChartTheme::decorate(QScatterSeries* |
|
197 | void ChartTheme::decorate(QScatterSeries *series, int index) | |
198 | { |
|
198 | { | |
199 | QPen pen; |
|
199 | QPen pen; | |
200 | QBrush brush; |
|
200 | QBrush brush; | |
@@ -211,7 +211,7 void ChartTheme::decorate(QScatterSeries* series, int index) | |||||
211 | } |
|
211 | } | |
212 | } |
|
212 | } | |
213 |
|
213 | |||
214 |
void ChartTheme::decorate(QPieSeries* |
|
214 | void ChartTheme::decorate(QPieSeries *series, int index) | |
215 | { |
|
215 | { | |
216 |
|
216 | |||
217 | for (int i(0); i < series->slices().count(); i++) { |
|
217 | for (int i(0); i < series->slices().count(); i++) { | |
@@ -252,7 +252,7 void ChartTheme::decorate(QPieSeries* series, int index) | |||||
252 | } |
|
252 | } | |
253 | } |
|
253 | } | |
254 |
|
254 | |||
255 |
void ChartTheme::decorate(QSplineSeries* |
|
255 | void ChartTheme::decorate(QSplineSeries *series, int index) | |
256 | { |
|
256 | { | |
257 | QPen pen; |
|
257 | QPen pen; | |
258 | if(pen == series->pen() || m_force){ |
|
258 | if(pen == series->pen() || m_force){ | |
@@ -262,7 +262,7 void ChartTheme::decorate(QSplineSeries* series, int index) | |||||
262 | } |
|
262 | } | |
263 | } |
|
263 | } | |
264 |
|
264 | |||
265 |
void ChartTheme::decorate(QChartAxis* |
|
265 | void ChartTheme::decorate(QChartAxis *axis,bool axisX) | |
266 | { |
|
266 | { | |
267 | QPen pen; |
|
267 | QPen pen; | |
268 | QBrush brush; |
|
268 | QBrush brush; | |
@@ -338,7 +338,7 void ChartTheme::generateSeriesGradients() | |||||
338 |
|
338 | |||
339 | QColor ChartTheme::colorAt(const QColor &start, const QColor &end, qreal pos) |
|
339 | QColor ChartTheme::colorAt(const QColor &start, const QColor &end, qreal pos) | |
340 | { |
|
340 | { | |
341 | Q_ASSERT(pos >=0.0 && pos <= 1.0); |
|
341 | Q_ASSERT(pos >= 0.0 && pos <= 1.0); | |
342 | qreal r = start.redF() + ((end.redF() - start.redF()) * pos); |
|
342 | qreal r = start.redF() + ((end.redF() - start.redF()) * pos); | |
343 | qreal g = start.greenF() + ((end.greenF() - start.greenF()) * pos); |
|
343 | qreal g = start.greenF() + ((end.greenF() - start.greenF()) * pos); | |
344 | qreal b = start.blueF() + ((end.blueF() - start.blueF()) * pos); |
|
344 | qreal b = start.blueF() + ((end.blueF() - start.blueF()) * pos); | |
@@ -349,7 +349,7 QColor ChartTheme::colorAt(const QColor &start, const QColor &end, qreal pos) | |||||
349 |
|
349 | |||
350 | QColor ChartTheme::colorAt(const QGradient &gradient, qreal pos) |
|
350 | QColor ChartTheme::colorAt(const QGradient &gradient, qreal pos) | |
351 | { |
|
351 | { | |
352 | Q_ASSERT(pos >=0 && pos <= 1.0); |
|
352 | Q_ASSERT(pos >= 0 && pos <= 1.0); | |
353 |
|
353 | |||
354 | // another possibility: |
|
354 | // another possibility: | |
355 | // http://stackoverflow.com/questions/3306786/get-intermediate-color-from-a-gradient |
|
355 | // http://stackoverflow.com/questions/3306786/get-intermediate-color-from-a-gradient | |
@@ -359,7 +359,7 QColor ChartTheme::colorAt(const QGradient &gradient, qreal pos) | |||||
359 |
|
359 | |||
360 | // find previous stop relative to position |
|
360 | // find previous stop relative to position | |
361 | QGradientStop prev = stops.first(); |
|
361 | QGradientStop prev = stops.first(); | |
362 | for (int i=0; i<count; i++) { |
|
362 | for (int i = 0; i < count; i++) { | |
363 | QGradientStop stop = stops.at(i); |
|
363 | QGradientStop stop = stops.at(i); | |
364 | if (pos > stop.first) |
|
364 | if (pos > stop.first) | |
365 | prev = stop; |
|
365 | prev = stop; | |
@@ -373,7 +373,7 QColor ChartTheme::colorAt(const QGradient &gradient, qreal pos) | |||||
373 |
|
373 | |||
374 | // find next stop relative to position |
|
374 | // find next stop relative to position | |
375 | QGradientStop next = stops.last(); |
|
375 | QGradientStop next = stops.last(); | |
376 | for (int i=count-1; i>=0; i--) { |
|
376 | for (int i = count - 1; i >= 0; i--) { | |
377 | QGradientStop stop = stops.at(i); |
|
377 | QGradientStop stop = stops.at(i); | |
378 | if (pos < stop.first) |
|
378 | if (pos < stop.first) | |
379 | next = stop; |
|
379 | next = stop; |
@@ -60,17 +60,17 public: | |||||
60 | protected: |
|
60 | protected: | |
61 | explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeLight); |
|
61 | explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeLight); | |
62 | public: |
|
62 | public: | |
63 |
static ChartTheme* |
|
63 | static ChartTheme *createTheme(QChart::ChartTheme theme); | |
64 | QChart::ChartTheme id() const {return m_id;} |
|
64 | QChart::ChartTheme id() const {return m_id;} | |
65 |
void decorate(QChart* |
|
65 | void decorate(QChart *chart); | |
66 |
void decorate(QLegend* |
|
66 | void decorate(QLegend *legend); | |
67 |
void decorate(QBarSeries* |
|
67 | void decorate(QBarSeries *series, int index); | |
68 |
void decorate(QLineSeries* |
|
68 | void decorate(QLineSeries *series, int index); | |
69 |
void decorate(QAreaSeries* |
|
69 | void decorate(QAreaSeries *series, int index); | |
70 |
void decorate(QScatterSeries* |
|
70 | void decorate(QScatterSeries *series, int index); | |
71 |
void decorate(QPieSeries* |
|
71 | void decorate(QPieSeries *series, int index); | |
72 |
void decorate(QSplineSeries* |
|
72 | void decorate(QSplineSeries *series, int index); | |
73 |
void decorate(QChartAxis* |
|
73 | void decorate(QChartAxis *axis, bool axisX); | |
74 | void setForced(bool enabled); |
|
74 | void setForced(bool enabled); | |
75 | bool isForced() { return m_force; } |
|
75 | bool isForced() { return m_force; } | |
76 |
|
76 |
General Comments 0
You need to be logged in to leave comments.
Login now