@@ -1,53 +1,62 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef AXISANIMATION_H |
|
22 | 31 | #define AXISANIMATION_H |
|
23 | 32 | |
|
24 | 33 | #include "chartanimation_p.h" |
|
25 | 34 | #include <QPointF> |
|
26 | 35 | |
|
27 | 36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | 37 | |
|
29 | 38 | class ChartAxis; |
|
30 | 39 | |
|
31 | 40 | class AxisAnimation: public ChartAnimation |
|
32 | 41 | { |
|
33 | 42 | public: |
|
34 | 43 | enum Animation { DefaultAnimation, ZoomOutAnimation, ZoomInAnimation, MoveForwardAnimation, MoveBackwordAnimation}; |
|
35 | 44 | AxisAnimation(ChartAxis *axis); |
|
36 | 45 | ~AxisAnimation(); |
|
37 | 46 | void setAnimationType(Animation type); |
|
38 | 47 | void setAnimationPoint(const QPointF& point); |
|
39 | 48 | void setValues(QVector<qreal> &oldLayout, QVector<qreal> &newLayout); |
|
40 | 49 | protected: |
|
41 | 50 | QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress ) const; |
|
42 | 51 | void updateCurrentValue(const QVariant &value ); |
|
43 | 52 | private: |
|
44 | 53 | ChartAxis *m_axis; |
|
45 | 54 | Animation m_type; |
|
46 | 55 | QPointF m_point; |
|
47 | 56 | }; |
|
48 | 57 | |
|
49 | 58 | QTCOMMERCIALCHART_END_NAMESPACE |
|
50 | 59 | |
|
51 | 60 | |
|
52 | 61 | |
|
53 | 62 | #endif /* AXISITEM_H_ */ |
@@ -1,54 +1,63 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef BARANIMATION_P_H |
|
22 | 31 | #define BARANIMATION_P_H |
|
23 | 32 | |
|
24 | 33 | #include "chartanimation_p.h" |
|
25 | 34 | #include "barchartitem_p.h" |
|
26 | 35 | |
|
27 | 36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | 37 | |
|
29 | 38 | class BarChartItem; |
|
30 | 39 | class QBarSet; |
|
31 | 40 | class BarSetAnimation; |
|
32 | 41 | |
|
33 | 42 | class BarAnimation : public ChartAnimation |
|
34 | 43 | { |
|
35 | 44 | Q_OBJECT |
|
36 | 45 | |
|
37 | 46 | public: |
|
38 | 47 | BarAnimation(BarChartItem *item); |
|
39 | 48 | ~BarAnimation(); |
|
40 | 49 | |
|
41 | 50 | public: // from QVariantAnimation |
|
42 | 51 | virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const; |
|
43 | 52 | virtual void updateCurrentValue(const QVariant &value); |
|
44 | 53 | |
|
45 | 54 | public Q_SLOTS: |
|
46 | 55 | |
|
47 | 56 | private: |
|
48 | 57 | BarChartItem *m_item; |
|
49 | 58 | QHash<QBarSet *, BarSetAnimation *> m_animations; |
|
50 | 59 | }; |
|
51 | 60 | |
|
52 | 61 | QTCOMMERCIALCHART_END_NAMESPACE |
|
53 | 62 | |
|
54 | 63 | #endif |
@@ -1,42 +1,51 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef CHARTANIMATION_H |
|
22 | 31 | #define CHARTANIMATION_H |
|
23 | 32 | |
|
24 | 33 | #include "qchartglobal.h" |
|
25 | 34 | #include <QVariantAnimation> |
|
26 | 35 | |
|
27 | 36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | 37 | |
|
29 | 38 | const static int ChartAnimationDuration = 1000; |
|
30 | 39 | |
|
31 | 40 | class ChartAnimation: public QVariantAnimation |
|
32 | 41 | { |
|
33 | 42 | Q_OBJECT |
|
34 | 43 | public: |
|
35 | 44 | ChartAnimation(QObject *parent = 0):QVariantAnimation(parent){}; |
|
36 | 45 | }; |
|
37 | 46 | |
|
38 | 47 | QTCOMMERCIALCHART_END_NAMESPACE |
|
39 | 48 | |
|
40 | 49 | |
|
41 | 50 | |
|
42 | 51 | #endif /* AXISITEM_H_ */ |
@@ -1,64 +1,73 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef CHARTANIMATOR_P_H |
|
22 | 31 | #define CHARTANIMATOR_P_H |
|
23 | 32 | |
|
24 | 33 | #include "qchartglobal.h" |
|
25 | 34 | #include "chartanimation_p.h" |
|
26 | 35 | #include "piechartitem_p.h" |
|
27 | 36 | #include "barchartitem_p.h" |
|
28 | 37 | #include <QPointF> |
|
29 | 38 | |
|
30 | 39 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
31 | 40 | |
|
32 | 41 | class ChartItem; |
|
33 | 42 | class ChartAxis; |
|
34 | 43 | class AreaChartItem; |
|
35 | 44 | class SplineChartItem; |
|
36 | 45 | class ScatterChartItem; |
|
37 | 46 | class LineChartItem; |
|
38 | 47 | class XYChartItem; |
|
39 | 48 | class XYAnimation; |
|
40 | 49 | |
|
41 | 50 | class ChartAnimator : public QObject |
|
42 | 51 | { |
|
43 | 52 | Q_OBJECT |
|
44 | 53 | public: |
|
45 | 54 | ChartAnimator(QObject *parent = 0); |
|
46 | 55 | virtual ~ChartAnimator(); |
|
47 | 56 | |
|
48 | 57 | void addAnimation(PieChartItem *item); |
|
49 | 58 | void addAnimation(BarChartItem *item); |
|
50 | 59 | void removeAnimation(Chart *item); |
|
51 | 60 | |
|
52 | 61 | void addAnimation(PieChartItem *item, PieSliceItem *sliceItem, const PieSliceData &sliceData, bool isEmpty); |
|
53 | 62 | void removeAnimation(PieChartItem *item, PieSliceItem *sliceItem); |
|
54 | 63 | void updateAnimation(PieChartItem *item, PieSliceItem *sliceItem, const PieSliceData &sliceData); |
|
55 | 64 | |
|
56 | 65 | void updateLayout(BarChartItem *item, const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout); |
|
57 | 66 | |
|
58 | 67 | private: |
|
59 | 68 | QMap<Chart *, ChartAnimation *> m_animations; |
|
60 | 69 | }; |
|
61 | 70 | |
|
62 | 71 | QTCOMMERCIALCHART_END_NAMESPACE |
|
63 | 72 | |
|
64 | 73 | #endif |
@@ -1,53 +1,62 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef PIEANIMATION_P_H |
|
22 | 31 | #define PIEANIMATION_P_H |
|
23 | 32 | |
|
24 | 33 | #include "chartanimation_p.h" |
|
25 | 34 | #include "piechartitem_p.h" |
|
26 | 35 | #include "piesliceanimation_p.h" |
|
27 | 36 | |
|
28 | 37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | 38 | |
|
30 | 39 | class PieChartItem; |
|
31 | 40 | |
|
32 | 41 | class PieAnimation : public ChartAnimation |
|
33 | 42 | { |
|
34 | 43 | Q_OBJECT |
|
35 | 44 | |
|
36 | 45 | public: |
|
37 | 46 | PieAnimation(PieChartItem *item); |
|
38 | 47 | ~PieAnimation(); |
|
39 | 48 | void updateValue(PieSliceItem *sliceItem, const PieSliceData &newValue); |
|
40 | 49 | void addSlice(PieSliceItem *sliceItem, const PieSliceData &endValue, bool startupAnimation); |
|
41 | 50 | void removeSlice(PieSliceItem *sliceItem); |
|
42 | 51 | |
|
43 | 52 | public: // from QVariantAnimation |
|
44 | 53 | void updateCurrentValue(const QVariant &value); |
|
45 | 54 | |
|
46 | 55 | private: |
|
47 | 56 | PieChartItem *m_item; |
|
48 | 57 | QHash<PieSliceItem *, PieSliceAnimation *> m_animations; |
|
49 | 58 | }; |
|
50 | 59 | |
|
51 | 60 | QTCOMMERCIALCHART_END_NAMESPACE |
|
52 | 61 | |
|
53 | 62 | #endif |
@@ -1,51 +1,60 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef PIESLICEANIMATION_P_H |
|
22 | 31 | #define PIESLICEANIMATION_P_H |
|
23 | 32 | |
|
24 | 33 | #include <QVariantAnimation> |
|
25 | 34 | #include "piesliceitem_p.h" |
|
26 | 35 | |
|
27 | 36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | 37 | |
|
29 | 38 | class PieChartItem; |
|
30 | 39 | |
|
31 | 40 | class PieSliceAnimation : public QVariantAnimation |
|
32 | 41 | { |
|
33 | 42 | public: |
|
34 | 43 | PieSliceAnimation(PieSliceItem *sliceItem); |
|
35 | 44 | ~PieSliceAnimation(); |
|
36 | 45 | void setValue(const PieSliceData &startValue, const PieSliceData &endValue); |
|
37 | 46 | void updateValue(const PieSliceData &endValue); |
|
38 | 47 | PieSliceData currentSliceValue(); |
|
39 | 48 | |
|
40 | 49 | protected: |
|
41 | 50 | QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const; |
|
42 | 51 | void updateCurrentValue(const QVariant &value); |
|
43 | 52 | |
|
44 | 53 | private: |
|
45 | 54 | PieSliceItem *m_sliceItem; |
|
46 | 55 | PieSliceData m_currentValue; |
|
47 | 56 | }; |
|
48 | 57 | |
|
49 | 58 | QTCOMMERCIALCHART_END_NAMESPACE |
|
50 | 59 | |
|
51 | 60 | #endif |
@@ -1,52 +1,61 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef SPLINEANIMATION_P_H |
|
22 | 31 | #define SPLINEANIMATION_P_H |
|
23 | 32 | #include "xyanimation_p.h" |
|
24 | 33 | #include <QPointF> |
|
25 | 34 | |
|
26 | 35 | typedef QPair<QVector<QPointF >, QVector<QPointF > > SplineVector; |
|
27 | 36 | |
|
28 | 37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | 38 | |
|
30 | 39 | class SplineChartItem; |
|
31 | 40 | |
|
32 | 41 | class SplineAnimation : public XYAnimation |
|
33 | 42 | { |
|
34 | 43 | public: |
|
35 | 44 | SplineAnimation(SplineChartItem *item); |
|
36 | 45 | ~SplineAnimation(); |
|
37 | 46 | void setup(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, QVector<QPointF> &oldContorlPoints, QVector<QPointF> &newControlPoints, int index = -1); |
|
38 | 47 | |
|
39 | 48 | protected: |
|
40 | 49 | QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const; |
|
41 | 50 | void updateCurrentValue(const QVariant &value); |
|
42 | 51 | void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); |
|
43 | 52 | |
|
44 | 53 | private: |
|
45 | 54 | SplineVector m_oldSpline; |
|
46 | 55 | SplineVector m_newSpline; |
|
47 | 56 | SplineChartItem *m_item; |
|
48 | 57 | }; |
|
49 | 58 | |
|
50 | 59 | QTCOMMERCIALCHART_END_NAMESPACE |
|
51 | 60 | |
|
52 | 61 | #endif |
@@ -1,57 +1,66 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef XYANIMATION_P_H |
|
22 | 31 | #define XYANIMATION_P_H |
|
23 | 32 | |
|
24 | 33 | #include "chartanimation_p.h" |
|
25 | 34 | #include <QPointF> |
|
26 | 35 | |
|
27 | 36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | 37 | |
|
29 | 38 | class XYChart; |
|
30 | 39 | |
|
31 | 40 | class XYAnimation : public ChartAnimation |
|
32 | 41 | { |
|
33 | 42 | protected: |
|
34 | 43 | enum Animation { AddPointAnimation, RemovePointAnimation, ReplacePointAnimation, NewAnimation }; |
|
35 | 44 | public: |
|
36 | 45 | XYAnimation(XYChart *item); |
|
37 | 46 | ~XYAnimation(); |
|
38 | 47 | void setup(const QVector<QPointF> &oldPoints, const QVector<QPointF> &newPoints,int index = -1); |
|
39 | 48 | Animation animationType() const { return m_type; }; |
|
40 | 49 | |
|
41 | 50 | protected: |
|
42 | 51 | QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress ) const; |
|
43 | 52 | void updateCurrentValue (const QVariant &value ); |
|
44 | 53 | void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); |
|
45 | 54 | protected: |
|
46 | 55 | Animation m_type; |
|
47 | 56 | bool m_dirty; |
|
48 | 57 | int m_index; |
|
49 | 58 | private: |
|
50 | 59 | XYChart *m_item; |
|
51 | 60 | QVector<QPointF> m_oldPoints; |
|
52 | 61 | QVector<QPointF> m_newPoints; |
|
53 | 62 | }; |
|
54 | 63 | |
|
55 | 64 | QTCOMMERCIALCHART_END_NAMESPACE |
|
56 | 65 | |
|
57 | 66 | #endif |
@@ -1,94 +1,103 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef AREACHARTITEM_H |
|
22 | 31 | #define AREACHARTITEM_H |
|
23 | 32 | |
|
24 | 33 | #include "qchartglobal.h" |
|
25 | 34 | #include "linechartitem_p.h" |
|
26 | 35 | #include <QPen> |
|
27 | 36 | |
|
28 | 37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | 38 | |
|
30 | 39 | class QAreaSeries; |
|
31 | 40 | class AreaChartItem; |
|
32 | 41 | |
|
33 | 42 | class AreaChartItem : public ChartItem |
|
34 | 43 | { |
|
35 | 44 | Q_OBJECT |
|
36 | 45 | public: |
|
37 | 46 | AreaChartItem(QAreaSeries *areaSeries, ChartPresenter *presenter); |
|
38 | 47 | ~AreaChartItem(); |
|
39 | 48 | |
|
40 | 49 | //from QGraphicsItem |
|
41 | 50 | QRectF boundingRect() const; |
|
42 | 51 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
43 | 52 | QPainterPath shape() const; |
|
44 | 53 | |
|
45 | 54 | LineChartItem* upperLineItem() const { return m_upper; } |
|
46 | 55 | LineChartItem* lowerLineItem() const { return m_lower; } |
|
47 | 56 | |
|
48 | 57 | void updatePath(); |
|
49 | 58 | |
|
50 | 59 | protected: |
|
51 | 60 | void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
52 | 61 | |
|
53 | 62 | Q_SIGNALS: |
|
54 | 63 | void clicked(const QPointF &point); |
|
55 | 64 | |
|
56 | 65 | public Q_SLOTS: |
|
57 | 66 | void handleUpdated(); |
|
58 | 67 | void handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY); |
|
59 | 68 | void handleGeometryChanged(const QRectF &size); |
|
60 | 69 | |
|
61 | 70 | private: |
|
62 | 71 | QAreaSeries* m_series; |
|
63 | 72 | LineChartItem* m_upper; |
|
64 | 73 | LineChartItem* m_lower; |
|
65 | 74 | QPainterPath m_path; |
|
66 | 75 | QRectF m_rect; |
|
67 | 76 | QRectF m_clipRect; |
|
68 | 77 | QPen m_linePen; |
|
69 | 78 | QPen m_pointPen; |
|
70 | 79 | QBrush m_brush; |
|
71 | 80 | bool m_pointsVisible; |
|
72 | 81 | |
|
73 | 82 | }; |
|
74 | 83 | |
|
75 | 84 | class AreaBoundItem : public LineChartItem |
|
76 | 85 | { |
|
77 | 86 | public: |
|
78 | 87 | AreaBoundItem(AreaChartItem *item,QLineSeries *lineSeries,ChartPresenter* presenter) : LineChartItem(lineSeries, 0), m_item(item) { |
|
79 | 88 | setPresenter(presenter); |
|
80 | 89 | } |
|
81 | 90 | ~AreaBoundItem() {} |
|
82 | 91 | |
|
83 | 92 | void updateGeometry() { |
|
84 | 93 | LineChartItem::updateGeometry(); |
|
85 | 94 | m_item->updatePath(); |
|
86 | 95 | } |
|
87 | 96 | |
|
88 | 97 | private: |
|
89 | 98 | AreaChartItem* m_item; |
|
90 | 99 | }; |
|
91 | 100 | |
|
92 | 101 | QTCOMMERCIALCHART_END_NAMESPACE |
|
93 | 102 | |
|
94 | 103 | #endif |
@@ -1,148 +1,157 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef CHARTAXIS_H |
|
22 | 31 | #define CHARTAXIS_H |
|
23 | 32 | |
|
24 | 33 | #include "qchartglobal.h" |
|
25 | 34 | #include "chart_p.h" |
|
26 | 35 | #include "axisanimation_p.h" |
|
27 | 36 | #include <QGraphicsItem> |
|
28 | 37 | |
|
29 | 38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | 39 | |
|
31 | 40 | class QAxis; |
|
32 | 41 | class ChartPresenter; |
|
33 | 42 | |
|
34 | 43 | class ChartAxis : public Chart |
|
35 | 44 | { |
|
36 | 45 | Q_OBJECT |
|
37 | 46 | public: |
|
38 | 47 | enum AxisType{ X_AXIS,Y_AXIS }; |
|
39 | 48 | |
|
40 | 49 | ChartAxis(QAxis *axis, ChartPresenter *presenter); |
|
41 | 50 | ~ChartAxis(); |
|
42 | 51 | |
|
43 | 52 | virtual AxisType axisType() const = 0; |
|
44 | 53 | |
|
45 | 54 | void setAxisOpacity(qreal opacity); |
|
46 | 55 | qreal axisOpacity() const; |
|
47 | 56 | |
|
48 | 57 | void setGridOpacity(qreal opacity); |
|
49 | 58 | qreal gridOpacity() const; |
|
50 | 59 | |
|
51 | 60 | void setLabelsOpacity(qreal opacity); |
|
52 | 61 | qreal labelsOpacity() const; |
|
53 | 62 | |
|
54 | 63 | void setShadesOpacity(qreal opacity); |
|
55 | 64 | qreal shadesOpacity() const; |
|
56 | 65 | |
|
57 | 66 | void setLabelsAngle(int angle); |
|
58 | 67 | int labelsAngle()const { return m_labelsAngle; } |
|
59 | 68 | |
|
60 | 69 | void setShadesBrush(const QBrush &brush); |
|
61 | 70 | void setShadesPen(const QPen &pen); |
|
62 | 71 | |
|
63 | 72 | void setAxisPen(const QPen &pen); |
|
64 | 73 | void setGridPen(const QPen &pen); |
|
65 | 74 | |
|
66 | 75 | void setLabelsPen(const QPen &pen); |
|
67 | 76 | void setLabelsBrush(const QBrush &brush); |
|
68 | 77 | void setLabelsFont(const QFont &font); |
|
69 | 78 | |
|
70 | 79 | void setLayout(QVector<qreal> &layout); |
|
71 | 80 | QVector<qreal> layout() const { return m_layoutVector; } |
|
72 | 81 | |
|
73 | 82 | void setAnimation(AxisAnimation* animation); |
|
74 | 83 | ChartAnimation* animation() const { return m_animation; }; |
|
75 | 84 | |
|
76 | 85 | QRectF geometry() const { return m_rect; } |
|
77 | 86 | |
|
78 | 87 | protected: |
|
79 | 88 | virtual void updateGeometry() = 0; |
|
80 | 89 | virtual QVector<qreal> calculateLayout() const = 0; |
|
81 | 90 | bool createLabels(QStringList &labels,qreal min, qreal max,int ticks) const; |
|
82 | 91 | |
|
83 | 92 | public Q_SLOTS: |
|
84 | 93 | void handleAxisUpdated(); |
|
85 | 94 | void handleAxisCategoriesUpdated(); |
|
86 | 95 | void handleRangeChanged(qreal min , qreal max,int tickCount); |
|
87 | 96 | void handleGeometryChanged(const QRectF &size); |
|
88 | 97 | |
|
89 | 98 | private: |
|
90 | 99 | inline bool isEmpty(); |
|
91 | 100 | void createItems(int count); |
|
92 | 101 | void deleteItems(int count); |
|
93 | 102 | void updateLayout(QVector<qreal> &layout); |
|
94 | 103 | void axisSelected(); |
|
95 | 104 | |
|
96 | 105 | protected: |
|
97 | 106 | QAxis* m_chartAxis; |
|
98 | 107 | QRectF m_rect; |
|
99 | 108 | int m_labelsAngle; |
|
100 | 109 | QScopedPointer<QGraphicsItemGroup> m_grid; |
|
101 | 110 | QScopedPointer<QGraphicsItemGroup> m_shades; |
|
102 | 111 | QScopedPointer<QGraphicsItemGroup> m_labels; |
|
103 | 112 | QScopedPointer<QGraphicsItemGroup> m_axis; |
|
104 | 113 | QVector<qreal> m_layoutVector; |
|
105 | 114 | qreal m_min; |
|
106 | 115 | qreal m_max; |
|
107 | 116 | int m_ticksCount; |
|
108 | 117 | AxisAnimation *m_animation; |
|
109 | 118 | |
|
110 | 119 | friend class AxisAnimation; |
|
111 | 120 | friend class AxisItem; |
|
112 | 121 | |
|
113 | 122 | }; |
|
114 | 123 | |
|
115 | 124 | class AxisItem: public QGraphicsLineItem |
|
116 | 125 | { |
|
117 | 126 | |
|
118 | 127 | public: |
|
119 | 128 | explicit AxisItem(ChartAxis *axis, QGraphicsItem *parent = 0) : QGraphicsLineItem(parent), m_axis(axis) {} |
|
120 | 129 | |
|
121 | 130 | protected: |
|
122 | 131 | void mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
123 | 132 | { |
|
124 | 133 | Q_UNUSED(event) |
|
125 | 134 | m_axis->axisSelected(); |
|
126 | 135 | } |
|
127 | 136 | |
|
128 | 137 | QRectF boundingRect() const |
|
129 | 138 | { |
|
130 | 139 | return shape().boundingRect(); |
|
131 | 140 | } |
|
132 | 141 | |
|
133 | 142 | QPainterPath shape() const |
|
134 | 143 | { |
|
135 | 144 | QPainterPath path = QGraphicsLineItem::shape(); |
|
136 | 145 | QRectF rect = path.boundingRect(); |
|
137 | 146 | path.addRect(rect.adjusted(0,0,m_axis->axisType()!=ChartAxis::X_AXIS?8:0,m_axis->axisType()!=ChartAxis::Y_AXIS?8:0)); |
|
138 | 147 | return path; |
|
139 | 148 | } |
|
140 | 149 | |
|
141 | 150 | private: |
|
142 | 151 | ChartAxis* m_axis; |
|
143 | 152 | |
|
144 | 153 | }; |
|
145 | 154 | |
|
146 | 155 | QTCOMMERCIALCHART_END_NAMESPACE |
|
147 | 156 | |
|
148 | 157 | #endif /* AXISITEM_H_ */ |
@@ -1,46 +1,55 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef CHARTAXISX_H |
|
22 | 31 | #define CHARTAXISX_H |
|
23 | 32 | |
|
24 | 33 | #include "chartaxis_p.h" |
|
25 | 34 | |
|
26 | 35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | 36 | |
|
28 | 37 | class QAxis; |
|
29 | 38 | class ChartPresenter; |
|
30 | 39 | |
|
31 | 40 | class ChartAxisX : public ChartAxis |
|
32 | 41 | { |
|
33 | 42 | public: |
|
34 | 43 | ChartAxisX(QAxis *axis, ChartPresenter *presenter); |
|
35 | 44 | ~ChartAxisX(); |
|
36 | 45 | |
|
37 | 46 | AxisType axisType() const { return X_AXIS;} |
|
38 | 47 | |
|
39 | 48 | protected: |
|
40 | 49 | QVector<qreal> calculateLayout() const; |
|
41 | 50 | void updateGeometry(); |
|
42 | 51 | }; |
|
43 | 52 | |
|
44 | 53 | QTCOMMERCIALCHART_END_NAMESPACE |
|
45 | 54 | |
|
46 | 55 | #endif /* AXISITEM_H_ */ |
@@ -1,46 +1,55 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef CHARTAXISY_H |
|
22 | 31 | #define CHARTAXISY_H |
|
23 | 32 | |
|
24 | 33 | #include "chartaxis_p.h" |
|
25 | 34 | |
|
26 | 35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | 36 | |
|
28 | 37 | class QAxis; |
|
29 | 38 | class ChartPresenter; |
|
30 | 39 | |
|
31 | 40 | class ChartAxisY : public ChartAxis |
|
32 | 41 | { |
|
33 | 42 | public: |
|
34 | 43 | ChartAxisY(QAxis *axis, ChartPresenter *presenter); |
|
35 | 44 | ~ChartAxisY(); |
|
36 | 45 | |
|
37 | 46 | AxisType axisType() const { return Y_AXIS;} |
|
38 | 47 | |
|
39 | 48 | protected: |
|
40 | 49 | QVector<qreal> calculateLayout() const; |
|
41 | 50 | void updateGeometry(); |
|
42 | 51 | }; |
|
43 | 52 | |
|
44 | 53 | QTCOMMERCIALCHART_END_NAMESPACE |
|
45 | 54 | |
|
46 | 55 | #endif /* AXISITEM_H_ */ |
@@ -1,61 +1,70 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef CHART_H |
|
22 | 31 | #define CHART_H |
|
23 | 32 | |
|
24 | 33 | #include "qchartglobal.h" |
|
25 | 34 | #include <QObject> |
|
26 | 35 | #include <QRect> |
|
27 | 36 | |
|
28 | 37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | 38 | |
|
30 | 39 | class ChartAnimator; |
|
31 | 40 | class ChartPresenter; |
|
32 | 41 | class ChartAnimation; |
|
33 | 42 | class Domain; |
|
34 | 43 | |
|
35 | 44 | class Chart: public QObject |
|
36 | 45 | { |
|
37 | 46 | Q_OBJECT |
|
38 | 47 | public: |
|
39 | 48 | explicit Chart(ChartPresenter *presenter); |
|
40 | 49 | |
|
41 | 50 | public Q_SLOTS: |
|
42 | 51 | virtual void handleGeometryChanged(const QRectF& rect); |
|
43 | 52 | virtual void handleDomainChanged(qreal minX,qreal maxX,qreal minY,qreal maxY); |
|
44 | 53 | |
|
45 | 54 | void setAnimator(ChartAnimator* animator); |
|
46 | 55 | ChartAnimator* animator() const; |
|
47 | 56 | void setPresenter(ChartPresenter *presenter); |
|
48 | 57 | ChartPresenter* presenter() const; |
|
49 | 58 | void setDomain(Domain *domain); |
|
50 | 59 | Domain* domain() const; |
|
51 | 60 | virtual ChartAnimation* animation() const { return 0; }; |
|
52 | 61 | |
|
53 | 62 | private: |
|
54 | 63 | ChartAnimator* m_animator; |
|
55 | 64 | ChartPresenter* m_presenter; |
|
56 | 65 | Domain* m_domain; |
|
57 | 66 | }; |
|
58 | 67 | |
|
59 | 68 | QTCOMMERCIALCHART_END_NAMESPACE |
|
60 | 69 | |
|
61 | 70 | #endif |
@@ -1,57 +1,66 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef CHARTBACKGROUND_H |
|
22 | 31 | #define CHARTBACKGROUND_H |
|
23 | 32 | |
|
24 | 33 | #include "qchartglobal.h" |
|
25 | 34 | #include <QGraphicsRectItem> |
|
26 | 35 | |
|
27 | 36 | class QGraphicsDropShadowEffect; |
|
28 | 37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | 38 | |
|
30 | 39 | class ChartBackground: public QGraphicsRectItem |
|
31 | 40 | { |
|
32 | 41 | public: |
|
33 | 42 | ChartBackground(QGraphicsItem *parent =0); |
|
34 | 43 | ~ChartBackground(); |
|
35 | 44 | |
|
36 | 45 | void setDimeter(int dimater); |
|
37 | 46 | int diameter() const; |
|
38 | 47 | void setDropShadowEnabled(bool enabled); |
|
39 | 48 | bool isDropShadowEnabled() {return m_dropShadow != 0;} |
|
40 | 49 | |
|
41 | 50 | protected: |
|
42 | 51 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
43 | 52 | |
|
44 | 53 | |
|
45 | 54 | private: |
|
46 | 55 | int roundness(qreal size) const; |
|
47 | 56 | |
|
48 | 57 | private: |
|
49 | 58 | int m_diameter; |
|
50 | 59 | QGraphicsDropShadowEffect *m_dropShadow; |
|
51 | 60 | }; |
|
52 | 61 | |
|
53 | 62 | QTCOMMERCIALCHART_END_NAMESPACE |
|
54 | 63 | |
|
55 | 64 | #endif /* CHARTBACKGROUND_H_ */ |
|
56 | 65 | |
|
57 | 66 |
@@ -1,77 +1,86 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef CHARTCONFIG_H |
|
22 | 31 | #define CHARTCONFIG_H |
|
23 | 32 | |
|
24 | 33 | #include "qchartglobal.h" |
|
25 | 34 | |
|
26 | 35 | #ifdef Q_CC_MSVC |
|
27 | 36 | // There is a problem with jom.exe currently. It does not seem to understand QMAKE_EXTRA_TARGETS properly. |
|
28 | 37 | // This is the case at least with shadow builds. |
|
29 | 38 | // http://qt-project.org/wiki/jom |
|
30 | 39 | #undef DEVELOPMENT_BUILD |
|
31 | 40 | #endif |
|
32 | 41 | |
|
33 | 42 | #ifndef DEVELOPMENT_BUILD |
|
34 | 43 | const char *buildTime = __TIME__" "__DATE__; |
|
35 | 44 | const char *gitHead = "unknown"; |
|
36 | 45 | #else |
|
37 | 46 | #include "qchartversion_p.h" |
|
38 | 47 | #endif |
|
39 | 48 | |
|
40 | 49 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
41 | 50 | |
|
42 | 51 | class ChartConfig { |
|
43 | 52 | |
|
44 | 53 | private: |
|
45 | 54 | ChartConfig(){ |
|
46 | 55 | #if defined(DEVELOPMENT_BUILD) && !defined(QT_NO_DEBUG) |
|
47 | 56 | qDebug()<<"buildTime" << buildTime; |
|
48 | 57 | qDebug()<<"gitHead" << gitHead; |
|
49 | 58 | #endif |
|
50 | 59 | m_instance = this; |
|
51 | 60 | } |
|
52 | 61 | public: |
|
53 | 62 | static ChartConfig* instance(){ |
|
54 | 63 | if(!m_instance){ |
|
55 | 64 | m_instance= new ChartConfig(); |
|
56 | 65 | } |
|
57 | 66 | return m_instance; |
|
58 | 67 | } |
|
59 | 68 | |
|
60 | 69 | QString compilationTime(){ |
|
61 | 70 | return buildTime; |
|
62 | 71 | } |
|
63 | 72 | |
|
64 | 73 | QString compilationHead(){ |
|
65 | 74 | return gitHead; |
|
66 | 75 | } |
|
67 | 76 | |
|
68 | 77 | private: |
|
69 | 78 | static ChartConfig* m_instance; |
|
70 | 79 | }; |
|
71 | 80 | |
|
72 | 81 | |
|
73 | 82 | ChartConfig* ChartConfig::m_instance=0; |
|
74 | 83 | |
|
75 | 84 | QTCOMMERCIALCHART_END_NAMESPACE |
|
76 | 85 | |
|
77 | 86 | #endif |
@@ -1,39 +1,48 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef CHARTITEM_H |
|
22 | 31 | #define CHARTITEM_H |
|
23 | 32 | |
|
24 | 33 | #include "chart_p.h" |
|
25 | 34 | #include "chartpresenter_p.h" |
|
26 | 35 | #include <QGraphicsItem> |
|
27 | 36 | |
|
28 | 37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | 38 | |
|
30 | 39 | class ChartItem : public QGraphicsItem, public Chart |
|
31 | 40 | { |
|
32 | 41 | enum ChartItemTypes{ AXIS_ITEM = UserType + 1, XYLINE_ITEM }; |
|
33 | 42 | public: |
|
34 | 43 | ChartItem(ChartPresenter *presenter) : QGraphicsItem(presenter ? presenter->rootItem() : 0), Chart(presenter) {} |
|
35 | 44 | }; |
|
36 | 45 | |
|
37 | 46 | QTCOMMERCIALCHART_END_NAMESPACE |
|
38 | 47 | |
|
39 | 48 | #endif /* CHARTITEM_H_ */ |
@@ -1,145 +1,154 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef CHARTPRESENTER_H |
|
22 | 31 | #define CHARTPRESENTER_H |
|
23 | 32 | |
|
24 | 33 | #include "qchartglobal.h" |
|
25 | 34 | #include "qchart.h" //becouse of QChart::ChartThemeId //TODO |
|
26 | 35 | #include <QRectF> |
|
27 | 36 | |
|
28 | 37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | 38 | |
|
30 | 39 | class Chart; |
|
31 | 40 | class QAbstractSeries; |
|
32 | 41 | class ChartDataSet; |
|
33 | 42 | class Domain; |
|
34 | 43 | class ChartAxis; |
|
35 | 44 | class ChartTheme; |
|
36 | 45 | class ChartAnimator; |
|
37 | 46 | class ChartBackground; |
|
38 | 47 | class ChartAnimation; |
|
39 | 48 | |
|
40 | 49 | class ChartPresenter: public QObject |
|
41 | 50 | { |
|
42 | 51 | Q_OBJECT |
|
43 | 52 | public: |
|
44 | 53 | enum ZValues { |
|
45 | 54 | BackgroundZValue = -1, |
|
46 | 55 | ShadesZValue, |
|
47 | 56 | GridZValue, |
|
48 | 57 | SeriesZValue, |
|
49 | 58 | LineChartZValue = SeriesZValue, |
|
50 | 59 | BarSeriesZValue = SeriesZValue, |
|
51 | 60 | ScatterSeriesZValue = SeriesZValue, |
|
52 | 61 | PieSeriesZValue = SeriesZValue, |
|
53 | 62 | AxisZValue, |
|
54 | 63 | LegendZValue |
|
55 | 64 | }; |
|
56 | 65 | |
|
57 | 66 | enum State { |
|
58 | 67 | ShowState, |
|
59 | 68 | ScrollUpState, |
|
60 | 69 | ScrollDownState, |
|
61 | 70 | ScrollLeftState, |
|
62 | 71 | ScrollRightState, |
|
63 | 72 | ZoomInState, |
|
64 | 73 | ZoomOutState |
|
65 | 74 | }; |
|
66 | 75 | |
|
67 | 76 | ChartPresenter(QChart* chart,ChartDataSet *dataset); |
|
68 | 77 | virtual ~ChartPresenter(); |
|
69 | 78 | |
|
70 | 79 | ChartAnimator* animator() const { return m_animator; } |
|
71 | 80 | ChartTheme *chartTheme() const { return m_chartTheme; } |
|
72 | 81 | ChartDataSet *dataSet() const { return m_dataset; } |
|
73 | 82 | QGraphicsItem* rootItem() const { return m_chart; } |
|
74 | 83 | |
|
75 | 84 | void setTheme(QChart::ChartTheme theme,bool force = true); |
|
76 | 85 | QChart::ChartTheme theme(); |
|
77 | 86 | |
|
78 | 87 | void setAnimationOptions(QChart::AnimationOptions options); |
|
79 | 88 | QChart::AnimationOptions animationOptions() const; |
|
80 | 89 | |
|
81 | 90 | void zoomIn(qreal factor); |
|
82 | 91 | void zoomIn(const QRectF& rect); |
|
83 | 92 | void zoomOut(qreal factor); |
|
84 | 93 | void scroll(qreal dx,qreal dy); |
|
85 | 94 | |
|
86 | 95 | void setGeometry(const QRectF& rect); |
|
87 | 96 | QRectF chartGeometry() const { return m_chartRect; } |
|
88 | 97 | |
|
89 | 98 | void setMinimumMarginHeight(ChartAxis* axis, qreal height); |
|
90 | 99 | void setMinimumMarginWidth(ChartAxis* axis, qreal width); |
|
91 | 100 | qreal minimumLeftMargin() const { return m_minLeftMargin; } |
|
92 | 101 | qreal minimumBottomMargin() const { return m_minBottomMargin; } |
|
93 | 102 | |
|
94 | 103 | void startAnimation(ChartAnimation* animation); |
|
95 | 104 | State state() const { return m_state; } |
|
96 | 105 | QPointF statePoint() const { return m_statePoint; } |
|
97 | 106 | public: //TODO: fix me |
|
98 | 107 | void resetAllElements(); |
|
99 | 108 | void createChartBackgroundItem(); |
|
100 | 109 | void createChartTitleItem(); |
|
101 | 110 | QRectF margins() const { return m_chartMargins;} |
|
102 | 111 | |
|
103 | 112 | public Q_SLOTS: |
|
104 | 113 | void handleSeriesAdded(QAbstractSeries* series,Domain* domain); |
|
105 | 114 | void handleSeriesRemoved(QAbstractSeries* series); |
|
106 | 115 | void handleAxisAdded(QAxis* axis,Domain* domain); |
|
107 | 116 | void handleAxisRemoved(QAxis* axis); |
|
108 | 117 | void updateLayout(); |
|
109 | 118 | |
|
110 | 119 | private Q_SLOTS: |
|
111 | 120 | void handleAnimationFinished(); |
|
112 | 121 | |
|
113 | 122 | Q_SIGNALS: |
|
114 | 123 | void geometryChanged(const QRectF& rect); |
|
115 | 124 | void animationsFinished(); |
|
116 | 125 | |
|
117 | 126 | private: |
|
118 | 127 | QChart* m_chart; |
|
119 | 128 | ChartAnimator* m_animator; |
|
120 | 129 | ChartDataSet* m_dataset; |
|
121 | 130 | ChartTheme *m_chartTheme; |
|
122 | 131 | QMap<QAbstractSeries *, Chart *> m_chartItems; |
|
123 | 132 | QMap<QAxis *, ChartAxis *> m_axisItems; |
|
124 | 133 | QRectF m_rect; |
|
125 | 134 | QRectF m_chartRect; |
|
126 | 135 | QChart::AnimationOptions m_options; |
|
127 | 136 | qreal m_minLeftMargin; |
|
128 | 137 | qreal m_minBottomMargin; |
|
129 | 138 | State m_state; |
|
130 | 139 | QPointF m_statePoint; |
|
131 | 140 | QList<ChartAnimation*> m_animations; |
|
132 | 141 | |
|
133 | 142 | public: //TODO: fixme |
|
134 | 143 | ChartBackground* m_backgroundItem; |
|
135 | 144 | QGraphicsSimpleTextItem* m_titleItem; |
|
136 | 145 | int m_marginBig; |
|
137 | 146 | int m_marginSmall; |
|
138 | 147 | int m_marginTiny; |
|
139 | 148 | QRectF m_chartMargins; |
|
140 | 149 | QRectF m_legendMargins; |
|
141 | 150 | }; |
|
142 | 151 | |
|
143 | 152 | QTCOMMERCIALCHART_END_NAMESPACE |
|
144 | 153 | |
|
145 | 154 | #endif /* CHARTPRESENTER_H_ */ |
@@ -1,102 +1,111 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef CHARTTHEME_H |
|
22 | 31 | #define CHARTTHEME_H |
|
23 | 32 | |
|
24 | 33 | #include "qchartglobal.h" |
|
25 | 34 | #include "qchart.h" |
|
26 | 35 | #include <QColor> |
|
27 | 36 | #include <QGradientStops> |
|
28 | 37 | |
|
29 | 38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | 39 | |
|
31 | 40 | class ChartItem; |
|
32 | 41 | class LineChartItem; |
|
33 | 42 | class QLineSeries; |
|
34 | 43 | class BarChartItem; |
|
35 | 44 | class QBarSeries; |
|
36 | 45 | class StackedBarChartItem; |
|
37 | 46 | class QStackedBarSeries; |
|
38 | 47 | class QPercentBarSeries; |
|
39 | 48 | class PercentBarChartItem; |
|
40 | 49 | class QScatterSeries; |
|
41 | 50 | class ScatterChartItem; |
|
42 | 51 | class PieChartItem; |
|
43 | 52 | class QPieSeries; |
|
44 | 53 | class SplineChartItem; |
|
45 | 54 | class QSplineSeries; |
|
46 | 55 | class AreaChartItem; |
|
47 | 56 | class QAreaSeries; |
|
48 | 57 | |
|
49 | 58 | class ChartTheme |
|
50 | 59 | { |
|
51 | 60 | public: |
|
52 | 61 | enum BackgroundShadesMode { |
|
53 | 62 | BackgroundShadesNone = 0, |
|
54 | 63 | BackgroundShadesVertical, |
|
55 | 64 | BackgroundShadesHorizontal, |
|
56 | 65 | BackgroundShadesBoth |
|
57 | 66 | }; |
|
58 | 67 | |
|
59 | 68 | protected: |
|
60 | 69 | explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeLight); |
|
61 | 70 | public: |
|
62 | 71 | static ChartTheme *createTheme(QChart::ChartTheme theme); |
|
63 | 72 | QChart::ChartTheme id() const {return m_id;} |
|
64 | 73 | void decorate(QChart *chart); |
|
65 | 74 | void decorate(QLegend *legend); |
|
66 | 75 | void decorate(QBarSeries *series, int index); |
|
67 | 76 | void decorate(QLineSeries *series, int index); |
|
68 | 77 | void decorate(QAreaSeries *series, int index); |
|
69 | 78 | void decorate(QScatterSeries *series, int index); |
|
70 | 79 | void decorate(QPieSeries *series, int index); |
|
71 | 80 | void decorate(QSplineSeries *series, int index); |
|
72 | 81 | void decorate(QAxis *axis, bool axisX); |
|
73 | 82 | void setForced(bool enabled); |
|
74 | 83 | bool isForced() { return m_force; } |
|
75 | 84 | |
|
76 | 85 | public: // utils |
|
77 | 86 | void generateSeriesGradients(); |
|
78 | 87 | static QColor colorAt(const QColor &start, const QColor &end, qreal pos); |
|
79 | 88 | static QColor colorAt(const QGradient &gradient, qreal pos); |
|
80 | 89 | |
|
81 | 90 | protected: |
|
82 | 91 | QChart::ChartTheme m_id; |
|
83 | 92 | QList<QColor> m_seriesColors; |
|
84 | 93 | QList<QGradient> m_seriesGradients; |
|
85 | 94 | QLinearGradient m_chartBackgroundGradient; |
|
86 | 95 | |
|
87 | 96 | QFont m_masterFont; |
|
88 | 97 | QFont m_labelFont; |
|
89 | 98 | QBrush m_titleBrush; |
|
90 | 99 | QPen m_axisLinePen; |
|
91 | 100 | QBrush m_axisLabelBrush; |
|
92 | 101 | QPen m_backgroundShadesPen; |
|
93 | 102 | QBrush m_backgroundShadesBrush; |
|
94 | 103 | BackgroundShadesMode m_backgroundShades; |
|
95 | 104 | bool m_backgroundDropShadowEnabled; |
|
96 | 105 | QPen m_gridLinePen; |
|
97 | 106 | bool m_force; |
|
98 | 107 | }; |
|
99 | 108 | |
|
100 | 109 | QTCOMMERCIALCHART_END_NAMESPACE |
|
101 | 110 | |
|
102 | 111 | #endif // CHARTTHEME_H |
@@ -1,93 +1,102 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef DOMAIN_H |
|
22 | 31 | #define DOMAIN_H |
|
23 | 32 | #include "qchartglobal.h" |
|
24 | 33 | #include <QRectF> |
|
25 | 34 | #include <QSizeF> |
|
26 | 35 | #include <QDebug> |
|
27 | 36 | |
|
28 | 37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | 38 | |
|
30 | 39 | class QTCOMMERCIALCHART_AUTOTEST_EXPORT Domain: public QObject { |
|
31 | 40 | Q_OBJECT |
|
32 | 41 | public: |
|
33 | 42 | explicit Domain(QObject* object=0); |
|
34 | 43 | virtual ~Domain(); |
|
35 | 44 | |
|
36 | 45 | void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY); |
|
37 | 46 | void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY, int tickXCount, int tickYCount); |
|
38 | 47 | void setRangeX(qreal min, qreal max); |
|
39 | 48 | void setRangeX(qreal min, qreal max, int tickCount); |
|
40 | 49 | void setRangeY(qreal min, qreal max); |
|
41 | 50 | void setRangeY(qreal min, qreal max, int tickCount); |
|
42 | 51 | void setMinX(qreal min); |
|
43 | 52 | void setMaxX(qreal max); |
|
44 | 53 | void setMinY(qreal min); |
|
45 | 54 | void setMaxY(qreal max); |
|
46 | 55 | |
|
47 | 56 | qreal minX() const { return m_minX; } |
|
48 | 57 | qreal maxX() const { return m_maxX; } |
|
49 | 58 | qreal minY() const { return m_minY; } |
|
50 | 59 | qreal maxY() const { return m_maxY; } |
|
51 | 60 | |
|
52 | 61 | qreal spanX() const; |
|
53 | 62 | qreal spanY() const; |
|
54 | 63 | bool isEmpty() const; |
|
55 | 64 | |
|
56 | 65 | int tickXCount() const {return m_tickXCount;} |
|
57 | 66 | int tickYCount() const {return m_tickYCount;} |
|
58 | 67 | |
|
59 | 68 | friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const Domain &domain1, const Domain &domain2); |
|
60 | 69 | friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const Domain &domain1, const Domain &domain2); |
|
61 | 70 | friend QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const Domain &domain); |
|
62 | 71 | |
|
63 | 72 | void zoomIn(const QRectF& rect, const QSizeF& size); |
|
64 | 73 | void zoomOut(const QRectF& rect, const QSizeF& size); |
|
65 | 74 | void move(qreal dx,qreal dy,const QSizeF& size); |
|
66 | 75 | |
|
67 | 76 | Q_SIGNALS: |
|
68 | 77 | void domainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY); |
|
69 | 78 | void rangeXChanged(qreal min, qreal max, int tickXCount); |
|
70 | 79 | void rangeYChanged(qreal min, qreal max, int tickYCount); |
|
71 | 80 | |
|
72 | 81 | public Q_SLOTS: |
|
73 | 82 | void handleAxisXChanged(qreal min,qreal max,int tickXCount = 5,bool niceNumbers = false); |
|
74 | 83 | void handleAxisYChanged(qreal min,qreal max,int tickYCount = 5,bool niceNumbers = false); |
|
75 | 84 | |
|
76 | 85 | private: |
|
77 | 86 | void looseNiceNumbers(qreal &min, qreal &max, int &ticksCount) const; |
|
78 | 87 | qreal niceNumber(qreal x,bool celing) const; |
|
79 | 88 | |
|
80 | 89 | private: |
|
81 | 90 | qreal m_minX; |
|
82 | 91 | qreal m_maxX; |
|
83 | 92 | qreal m_minY; |
|
84 | 93 | qreal m_maxY; |
|
85 | 94 | int m_tickXCount; |
|
86 | 95 | int m_tickYCount; |
|
87 | 96 | bool m_niceXNumbers; |
|
88 | 97 | bool m_niceYNumbers; |
|
89 | 98 | }; |
|
90 | 99 | |
|
91 | 100 | QTCOMMERCIALCHART_END_NAMESPACE |
|
92 | 101 | |
|
93 | 102 | #endif |
@@ -1,125 +1,134 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef LEGENDMARKER_P_H |
|
22 | 31 | #define LEGENDMARKER_P_H |
|
23 | 32 | |
|
24 | 33 | #include "qchartglobal.h" |
|
25 | 34 | #include <QGraphicsObject> |
|
26 | 35 | #include <QBrush> |
|
27 | 36 | #include <QPen> |
|
28 | 37 | #include <QGraphicsSimpleTextItem> |
|
29 | 38 | |
|
30 | 39 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
31 | 40 | |
|
32 | 41 | class QAbstractSeries; |
|
33 | 42 | class QAreaSeries; |
|
34 | 43 | class QXYSeries; |
|
35 | 44 | class QBarSet; |
|
36 | 45 | class QBarSeries; |
|
37 | 46 | class QPieSlice; |
|
38 | 47 | class QLegend; |
|
39 | 48 | class QPieSeries; |
|
40 | 49 | |
|
41 | 50 | class LegendMarker : public QGraphicsObject |
|
42 | 51 | { |
|
43 | 52 | Q_OBJECT |
|
44 | 53 | |
|
45 | 54 | public: |
|
46 | 55 | explicit LegendMarker(QAbstractSeries *m_series, QLegend *parent); |
|
47 | 56 | |
|
48 | 57 | void setPen(const QPen &pen); |
|
49 | 58 | QPen pen() const; |
|
50 | 59 | void setBrush(const QBrush &brush); |
|
51 | 60 | QBrush brush() const; |
|
52 | 61 | |
|
53 | 62 | void setSize(const QSize& size); |
|
54 | 63 | |
|
55 | 64 | void setLabel(const QString label); |
|
56 | 65 | QString label() const; |
|
57 | 66 | |
|
58 | 67 | QAbstractSeries *series() const { return m_series;} |
|
59 | 68 | |
|
60 | 69 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); |
|
61 | 70 | |
|
62 | 71 | QRectF boundingRect() const; |
|
63 | 72 | |
|
64 | 73 | void updateLayout(); |
|
65 | 74 | |
|
66 | 75 | protected: |
|
67 | 76 | // From QGraphicsObject |
|
68 | 77 | void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
69 | 78 | |
|
70 | 79 | public Q_SLOTS: |
|
71 | 80 | virtual void updated() = 0; |
|
72 | 81 | |
|
73 | 82 | protected: |
|
74 | 83 | QAbstractSeries *m_series; |
|
75 | 84 | QRectF m_markerRect; |
|
76 | 85 | QRectF m_boundingRect; |
|
77 | 86 | QLegend* m_legend; |
|
78 | 87 | QGraphicsSimpleTextItem *m_textItem; |
|
79 | 88 | QGraphicsRectItem *m_rectItem; |
|
80 | 89 | |
|
81 | 90 | }; |
|
82 | 91 | |
|
83 | 92 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
84 | 93 | class XYLegendMarker : public LegendMarker |
|
85 | 94 | { |
|
86 | 95 | public: |
|
87 | 96 | XYLegendMarker(QXYSeries *series, QLegend *legend); |
|
88 | 97 | protected: |
|
89 | 98 | void updated(); |
|
90 | 99 | private: |
|
91 | 100 | QXYSeries *m_series; |
|
92 | 101 | }; |
|
93 | 102 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
94 | 103 | class AreaLegendMarker : public LegendMarker |
|
95 | 104 | { |
|
96 | 105 | public: |
|
97 | 106 | AreaLegendMarker(QAreaSeries *series, QLegend *legend); |
|
98 | 107 | protected: |
|
99 | 108 | void updated(); |
|
100 | 109 | private: |
|
101 | 110 | QAreaSeries *m_series; |
|
102 | 111 | }; |
|
103 | 112 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
104 | 113 | class BarLegendMarker : public LegendMarker |
|
105 | 114 | { |
|
106 | 115 | public: |
|
107 | 116 | BarLegendMarker(QBarSeries *barseries, QBarSet *barset,QLegend *legend); |
|
108 | 117 | protected: |
|
109 | 118 | void updated(); |
|
110 | 119 | private: |
|
111 | 120 | QBarSet *m_barset; |
|
112 | 121 | }; |
|
113 | 122 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
114 | 123 | class PieLegendMarker : public LegendMarker |
|
115 | 124 | { |
|
116 | 125 | public: |
|
117 | 126 | PieLegendMarker(QPieSeries *pieSeries, QPieSlice *pieslice, QLegend *legend); |
|
118 | 127 | protected: |
|
119 | 128 | void updated(); |
|
120 | 129 | private: |
|
121 | 130 | QPieSlice *m_pieslice; |
|
122 | 131 | }; |
|
123 | 132 | |
|
124 | 133 | QTCOMMERCIALCHART_END_NAMESPACE |
|
125 | 134 | #endif // LEGENDMARKER_P_H |
@@ -1,64 +1,73 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef LINECHARTITEM_H |
|
22 | 31 | #define LINECHARTITEM_H |
|
23 | 32 | |
|
24 | 33 | #include "qchartglobal.h" |
|
25 | 34 | #include "xychart_p.h" |
|
26 | 35 | #include <QPen> |
|
27 | 36 | |
|
28 | 37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | 38 | |
|
30 | 39 | class QLineSeries; |
|
31 | 40 | class ChartPresenter; |
|
32 | 41 | |
|
33 | 42 | class LineChartItem : public XYChart , public QGraphicsItem |
|
34 | 43 | { |
|
35 | 44 | Q_OBJECT |
|
36 | 45 | Q_INTERFACES(QGraphicsItem) |
|
37 | 46 | public: |
|
38 | 47 | explicit LineChartItem(QLineSeries *series,ChartPresenter *presenter); |
|
39 | 48 | ~LineChartItem() {}; |
|
40 | 49 | |
|
41 | 50 | //from QGraphicsItem |
|
42 | 51 | QRectF boundingRect() const; |
|
43 | 52 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
44 | 53 | QPainterPath shape() const; |
|
45 | 54 | |
|
46 | 55 | public Q_SLOTS: |
|
47 | 56 | void handleUpdated(); |
|
48 | 57 | protected: |
|
49 | 58 | void updateGeometry(); |
|
50 | 59 | void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
51 | 60 | |
|
52 | 61 | private: |
|
53 | 62 | QLineSeries* m_series; |
|
54 | 63 | QPainterPath m_path; |
|
55 | 64 | QRectF m_rect; |
|
56 | 65 | QPen m_linePen; |
|
57 | 66 | QPen m_pointPen; |
|
58 | 67 | bool m_pointsVisible; |
|
59 | 68 | |
|
60 | 69 | }; |
|
61 | 70 | |
|
62 | 71 | QTCOMMERCIALCHART_END_NAMESPACE |
|
63 | 72 | |
|
64 | 73 | #endif |
@@ -1,70 +1,79 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef PIECHARTITEM_H |
|
22 | 31 | #define PIECHARTITEM_H |
|
23 | 32 | |
|
24 | 33 | #include "qpieseries.h" |
|
25 | 34 | #include "chartitem_p.h" |
|
26 | 35 | #include "piesliceitem_p.h" |
|
27 | 36 | |
|
28 | 37 | class QGraphicsItem; |
|
29 | 38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | 39 | class QPieSlice; |
|
31 | 40 | class ChartPresenter; |
|
32 | 41 | |
|
33 | 42 | class PieChartItem : public ChartItem |
|
34 | 43 | { |
|
35 | 44 | Q_OBJECT |
|
36 | 45 | |
|
37 | 46 | public: |
|
38 | 47 | explicit PieChartItem(QPieSeries *series, ChartPresenter *presenter); |
|
39 | 48 | ~PieChartItem(); |
|
40 | 49 | |
|
41 | 50 | // from QGraphicsItem |
|
42 | 51 | QRectF boundingRect() const { return m_rect; } |
|
43 | 52 | void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) {} |
|
44 | 53 | |
|
45 | 54 | public Q_SLOTS: |
|
46 | 55 | // from Chart |
|
47 | 56 | virtual void handleGeometryChanged(const QRectF &rect); |
|
48 | 57 | virtual void handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY); |
|
49 | 58 | virtual void rangeXChanged(qreal min, qreal max, int tickXCount); |
|
50 | 59 | virtual void rangeYChanged(qreal min, qreal max, int tickYCount); |
|
51 | 60 | |
|
52 | 61 | void updateLayout(); |
|
53 | 62 | void handleSlicesAdded(QList<QPieSlice*> slices); |
|
54 | 63 | void handleSlicesRemoved(QList<QPieSlice*> slices); |
|
55 | 64 | void handleSliceChanged(); |
|
56 | 65 | |
|
57 | 66 | private: |
|
58 | 67 | PieSliceData updateSliceGeometry(QPieSlice *slice); |
|
59 | 68 | |
|
60 | 69 | private: |
|
61 | 70 | QHash<QPieSlice*, PieSliceItem*> m_sliceItems; |
|
62 | 71 | QPieSeries *m_series; |
|
63 | 72 | QRectF m_rect; |
|
64 | 73 | QPointF m_pieCenter; |
|
65 | 74 | qreal m_pieRadius; |
|
66 | 75 | }; |
|
67 | 76 | |
|
68 | 77 | QTCOMMERCIALCHART_END_NAMESPACE |
|
69 | 78 | |
|
70 | 79 | #endif // PIECHARTITEM_H |
@@ -1,130 +1,139 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef PIESLICEDATA_P_H |
|
22 | 31 | #define PIESLICEDATA_P_H |
|
23 | 32 | |
|
24 | 33 | #include "qchartglobal.h" |
|
25 | 34 | #include "qpieslice.h" |
|
26 | 35 | #include <QPen> |
|
27 | 36 | #include <QBrush> |
|
28 | 37 | |
|
29 | 38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | 39 | |
|
31 | 40 | template <class T> |
|
32 | 41 | class Themed : public T |
|
33 | 42 | { |
|
34 | 43 | public: |
|
35 | 44 | Themed():m_isThemed(true) {} |
|
36 | 45 | |
|
37 | 46 | inline T &operator=(const T &other) { return T::operator =(other); } |
|
38 | 47 | |
|
39 | 48 | inline bool operator!=(const T &other) const { return T::operator !=(other); } |
|
40 | 49 | inline bool operator!=(const Themed &other) const |
|
41 | 50 | { |
|
42 | 51 | if (T::operator !=(other)) |
|
43 | 52 | return true; |
|
44 | 53 | |
|
45 | 54 | if (m_isThemed != other.m_isThemed) |
|
46 | 55 | return true; |
|
47 | 56 | |
|
48 | 57 | return false; |
|
49 | 58 | } |
|
50 | 59 | |
|
51 | 60 | inline void setThemed(bool state) { m_isThemed = state; } |
|
52 | 61 | inline bool isThemed() const { return m_isThemed; } |
|
53 | 62 | |
|
54 | 63 | private: |
|
55 | 64 | bool m_isThemed; |
|
56 | 65 | }; |
|
57 | 66 | |
|
58 | 67 | class PieSliceData |
|
59 | 68 | { |
|
60 | 69 | public: |
|
61 | 70 | PieSliceData() |
|
62 | 71 | { |
|
63 | 72 | m_value = 0; |
|
64 | 73 | |
|
65 | 74 | m_isExploded = false; |
|
66 | 75 | m_explodeDistanceFactor = 0.15; |
|
67 | 76 | |
|
68 | 77 | m_isLabelVisible = false; |
|
69 | 78 | m_labelArmLengthFactor = 0.15; |
|
70 | 79 | |
|
71 | 80 | m_percentage = 0; |
|
72 | 81 | m_radius = 0; |
|
73 | 82 | m_startAngle = 0; |
|
74 | 83 | m_angleSpan = 0; |
|
75 | 84 | } |
|
76 | 85 | |
|
77 | 86 | bool operator!=(const PieSliceData &other) const |
|
78 | 87 | { |
|
79 | 88 | if (!qFuzzyIsNull(m_value - other.m_value)) |
|
80 | 89 | return true; |
|
81 | 90 | |
|
82 | 91 | if (m_slicePen != other.m_slicePen || |
|
83 | 92 | m_sliceBrush != other.m_sliceBrush) |
|
84 | 93 | return true; |
|
85 | 94 | |
|
86 | 95 | if (m_isExploded != other.m_isExploded || |
|
87 | 96 | !qFuzzyIsNull(m_explodeDistanceFactor - other.m_explodeDistanceFactor)) |
|
88 | 97 | return true; |
|
89 | 98 | |
|
90 | 99 | if (m_isLabelVisible != other.m_isLabelVisible || |
|
91 | 100 | m_labelText != other.m_labelText || |
|
92 | 101 | m_labelFont != other.m_labelFont || |
|
93 | 102 | !qFuzzyIsNull(m_labelArmLengthFactor - other.m_labelArmLengthFactor) || |
|
94 | 103 | m_labelBrush != other.m_labelBrush) |
|
95 | 104 | return true; |
|
96 | 105 | |
|
97 | 106 | if (!qFuzzyIsNull(m_percentage - other.m_percentage) || |
|
98 | 107 | m_center != other.m_center || |
|
99 | 108 | !qFuzzyIsNull(m_radius - other.m_radius) || |
|
100 | 109 | !qFuzzyIsNull(m_startAngle - other.m_startAngle) || |
|
101 | 110 | !qFuzzyIsNull(m_angleSpan - other.m_angleSpan)) |
|
102 | 111 | return true; |
|
103 | 112 | |
|
104 | 113 | return false; |
|
105 | 114 | } |
|
106 | 115 | |
|
107 | 116 | qreal m_value; |
|
108 | 117 | |
|
109 | 118 | Themed<QPen> m_slicePen; |
|
110 | 119 | Themed<QBrush> m_sliceBrush; |
|
111 | 120 | |
|
112 | 121 | bool m_isExploded; |
|
113 | 122 | qreal m_explodeDistanceFactor; |
|
114 | 123 | |
|
115 | 124 | bool m_isLabelVisible; |
|
116 | 125 | QString m_labelText; |
|
117 | 126 | Themed<QFont> m_labelFont; |
|
118 | 127 | qreal m_labelArmLengthFactor; |
|
119 | 128 | Themed<QBrush> m_labelBrush; |
|
120 | 129 | |
|
121 | 130 | qreal m_percentage; |
|
122 | 131 | QPointF m_center; |
|
123 | 132 | qreal m_radius; |
|
124 | 133 | qreal m_startAngle; |
|
125 | 134 | qreal m_angleSpan; |
|
126 | 135 | }; |
|
127 | 136 | |
|
128 | 137 | QTCOMMERCIALCHART_END_NAMESPACE |
|
129 | 138 | |
|
130 | 139 | #endif // PIESLICEDATA_P_H |
@@ -1,80 +1,89 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef PIESLICEITEM_H |
|
22 | 31 | #define PIESLICEITEM_H |
|
23 | 32 | |
|
24 | 33 | #include "qchartglobal.h" |
|
25 | 34 | #include "charttheme_p.h" |
|
26 | 35 | #include "qpieseries.h" |
|
27 | 36 | #include "pieslicedata_p.h" |
|
28 | 37 | #include <QGraphicsItem> |
|
29 | 38 | #include <QRectF> |
|
30 | 39 | #include <QColor> |
|
31 | 40 | #include <QPen> |
|
32 | 41 | |
|
33 | 42 | #define PIESLICE_LABEL_GAP 5 |
|
34 | 43 | |
|
35 | 44 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
36 | 45 | class PieChartItem; |
|
37 | 46 | class PieSliceLabel; |
|
38 | 47 | class QPieSlice; |
|
39 | 48 | |
|
40 | 49 | class PieSliceItem : public QGraphicsObject |
|
41 | 50 | { |
|
42 | 51 | Q_OBJECT |
|
43 | 52 | |
|
44 | 53 | public: |
|
45 | 54 | PieSliceItem(QGraphicsItem* parent = 0); |
|
46 | 55 | ~PieSliceItem(); |
|
47 | 56 | |
|
48 | 57 | // from QGraphicsItem |
|
49 | 58 | QRectF boundingRect() const; |
|
50 | 59 | QPainterPath shape() const; |
|
51 | 60 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
52 | 61 | void hoverEnterEvent(QGraphicsSceneHoverEvent *event); |
|
53 | 62 | void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); |
|
54 | 63 | void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
55 | 64 | |
|
56 | 65 | void setLayout(const PieSliceData &sliceData); |
|
57 | 66 | static QPointF sliceCenter(QPointF point, qreal radius, QPieSlice *slice); |
|
58 | 67 | |
|
59 | 68 | Q_SIGNALS: |
|
60 | 69 | void clicked(Qt::MouseButtons buttons); |
|
61 | 70 | void hovered(bool state); |
|
62 | 71 | |
|
63 | 72 | private: |
|
64 | 73 | void updateGeometry(); |
|
65 | 74 | QPainterPath slicePath(QPointF center, qreal radius, qreal startAngle, qreal angleSpan, qreal *centerAngle, QPointF *armStart); |
|
66 | 75 | QPainterPath labelArmPath(QPointF start, qreal angle, qreal length, qreal textWidth, QPointF *textStart); |
|
67 | 76 | QRectF labelTextRect(QFont font, QString text); |
|
68 | 77 | |
|
69 | 78 | private: |
|
70 | 79 | PieSliceData m_data; |
|
71 | 80 | QRectF m_boundingRect; |
|
72 | 81 | QPainterPath m_slicePath; |
|
73 | 82 | QPainterPath m_labelArmPath; |
|
74 | 83 | QRectF m_labelTextRect; |
|
75 | 84 | bool m_hovered; |
|
76 | 85 | }; |
|
77 | 86 | |
|
78 | 87 | QTCOMMERCIALCHART_END_NAMESPACE |
|
79 | 88 | |
|
80 | 89 | #endif // PIESLICEITEM_H |
@@ -1,142 +1,151 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef SCATTERCHARTITEM_H |
|
22 | 31 | #define SCATTERCHARTITEM_H |
|
23 | 32 | |
|
24 | 33 | #include "qchartglobal.h" |
|
25 | 34 | #include "xychart_p.h" |
|
26 | 35 | #include <QGraphicsEllipseItem> |
|
27 | 36 | #include <QPen> |
|
28 | 37 | |
|
29 | 38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | 39 | |
|
31 | 40 | class QScatterSeries; |
|
32 | 41 | class Marker; |
|
33 | 42 | |
|
34 | 43 | class ScatterChartItem : public XYChart, public QGraphicsItem |
|
35 | 44 | { |
|
36 | 45 | Q_OBJECT |
|
37 | 46 | Q_INTERFACES(QGraphicsItem) |
|
38 | 47 | public: |
|
39 | 48 | explicit ScatterChartItem(QScatterSeries *series, ChartPresenter *presenter); |
|
40 | 49 | |
|
41 | 50 | public: |
|
42 | 51 | //from QGraphicsItem |
|
43 | 52 | QRectF boundingRect() const; |
|
44 | 53 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
45 | 54 | |
|
46 | 55 | void setPen(const QPen &pen); |
|
47 | 56 | void setBrush(const QBrush &brush); |
|
48 | 57 | |
|
49 | 58 | void markerSelected(Marker *item); |
|
50 | 59 | |
|
51 | 60 | public Q_SLOTS: |
|
52 | 61 | void handleUpdated(); |
|
53 | 62 | |
|
54 | 63 | private: |
|
55 | 64 | void createPoints(int count); |
|
56 | 65 | void deletePoints(int count); |
|
57 | 66 | |
|
58 | 67 | protected: |
|
59 | 68 | void updateGeometry(); |
|
60 | 69 | void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
61 | 70 | |
|
62 | 71 | private: |
|
63 | 72 | QScatterSeries *m_series; |
|
64 | 73 | QGraphicsItemGroup m_items; |
|
65 | 74 | bool m_visible; |
|
66 | 75 | int m_shape; |
|
67 | 76 | int m_size; |
|
68 | 77 | QRectF m_rect; |
|
69 | 78 | }; |
|
70 | 79 | |
|
71 | 80 | |
|
72 | 81 | class Marker: public QAbstractGraphicsShapeItem |
|
73 | 82 | { |
|
74 | 83 | |
|
75 | 84 | public: |
|
76 | 85 | |
|
77 | 86 | Marker(QAbstractGraphicsShapeItem *item , ScatterChartItem *parent) : QAbstractGraphicsShapeItem(0) ,m_item(item), m_parent(parent) |
|
78 | 87 | { |
|
79 | 88 | } |
|
80 | 89 | |
|
81 | 90 | ~Marker() |
|
82 | 91 | { |
|
83 | 92 | delete m_item; |
|
84 | 93 | } |
|
85 | 94 | |
|
86 | 95 | void setPoint(const QPointF& point) |
|
87 | 96 | { |
|
88 | 97 | m_point=point; |
|
89 | 98 | } |
|
90 | 99 | |
|
91 | 100 | QPointF point() const |
|
92 | 101 | { |
|
93 | 102 | return m_point; |
|
94 | 103 | } |
|
95 | 104 | |
|
96 | 105 | QPainterPath shape() const |
|
97 | 106 | { |
|
98 | 107 | return m_item->shape(); |
|
99 | 108 | } |
|
100 | 109 | |
|
101 | 110 | QRectF boundingRect() const |
|
102 | 111 | { |
|
103 | 112 | return m_item->boundingRect(); |
|
104 | 113 | } |
|
105 | 114 | |
|
106 | 115 | bool contains(const QPointF &point) const |
|
107 | 116 | { |
|
108 | 117 | return m_item->contains(point); |
|
109 | 118 | } |
|
110 | 119 | |
|
111 | 120 | void setPen(const QPen &pen) |
|
112 | 121 | { |
|
113 | 122 | m_item->setPen(pen); |
|
114 | 123 | } |
|
115 | 124 | |
|
116 | 125 | void setBrush(const QBrush &brush) |
|
117 | 126 | { |
|
118 | 127 | m_item->setBrush(brush); |
|
119 | 128 | } |
|
120 | 129 | |
|
121 | 130 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
|
122 | 131 | { |
|
123 | 132 | m_item->paint(painter,option,widget); |
|
124 | 133 | } |
|
125 | 134 | |
|
126 | 135 | protected: |
|
127 | 136 | |
|
128 | 137 | void mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
129 | 138 | { |
|
130 | 139 | Q_UNUSED(event) |
|
131 | 140 | m_parent->markerSelected(this); |
|
132 | 141 | } |
|
133 | 142 | |
|
134 | 143 | private: |
|
135 | 144 | QAbstractGraphicsShapeItem* m_item; |
|
136 | 145 | ScatterChartItem* m_parent; |
|
137 | 146 | QPointF m_point; |
|
138 | 147 | }; |
|
139 | 148 | |
|
140 | 149 | QTCOMMERCIALCHART_END_NAMESPACE |
|
141 | 150 | |
|
142 | 151 | #endif // SCATTERPRESENTER_H |
@@ -1,74 +1,83 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef SPLINECHARTITEM_P_H |
|
22 | 31 | #define SPLINECHARTITEM_P_H |
|
23 | 32 | |
|
24 | 33 | #include "qsplineseries.h" |
|
25 | 34 | #include "xychart_p.h" |
|
26 | 35 | #include "splineanimation_p.h" |
|
27 | 36 | |
|
28 | 37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | 38 | |
|
30 | 39 | class SplineChartItem : public XYChart, public QGraphicsItem |
|
31 | 40 | { |
|
32 | 41 | Q_OBJECT |
|
33 | 42 | Q_INTERFACES(QGraphicsItem) |
|
34 | 43 | public: |
|
35 | 44 | SplineChartItem(QSplineSeries *series, ChartPresenter *presenter); |
|
36 | 45 | |
|
37 | 46 | //from QGraphicsItem |
|
38 | 47 | QRectF boundingRect() const; |
|
39 | 48 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
40 | 49 | QPainterPath shape() const; |
|
41 | 50 | |
|
42 | 51 | void setControlGeometryPoints(QVector<QPointF>& points); |
|
43 | 52 | QVector<QPointF> controlGeometryPoints() const; |
|
44 | 53 | |
|
45 | 54 | void setAnimation(SplineAnimation* animation); |
|
46 | 55 | ChartAnimation* animation() const { return m_animation; } |
|
47 | 56 | |
|
48 | 57 | public Q_SLOTS: |
|
49 | 58 | void handleUpdated(); |
|
50 | 59 | |
|
51 | 60 | protected: |
|
52 | 61 | void updateGeometry(); |
|
53 | 62 | void updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints,int index); |
|
54 | 63 | void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
55 | 64 | |
|
56 | 65 | private: |
|
57 | 66 | QPointF calculateGeometryControlPoint(int index) const; |
|
58 | 67 | |
|
59 | 68 | private: |
|
60 | 69 | QSplineSeries *m_series; |
|
61 | 70 | QPainterPath m_path; |
|
62 | 71 | QRectF m_rect; |
|
63 | 72 | QPen m_linePen; |
|
64 | 73 | QPen m_pointPen; |
|
65 | 74 | bool m_pointsVisible; |
|
66 | 75 | QVector<QPointF> m_controlPoints; |
|
67 | 76 | SplineAnimation* m_animation; |
|
68 | 77 | |
|
69 | 78 | friend class SplineAnimation; |
|
70 | 79 | }; |
|
71 | 80 | |
|
72 | 81 | QTCOMMERCIALCHART_END_NAMESPACE |
|
73 | 82 | |
|
74 | 83 | #endif // SPLINECHARTITEM_P_H |
@@ -1,61 +1,70 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef CHARTTHEMEBLUECERULEAN_P_H |
|
22 | 31 | #define CHARTTHEMEBLUECERULEAN_P_H |
|
23 | 32 | |
|
24 | 33 | #include "charttheme_p.h" |
|
25 | 34 | |
|
26 | 35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | 36 | |
|
28 | 37 | class ChartThemeBlueCerulean: public ChartTheme |
|
29 | 38 | { |
|
30 | 39 | public: |
|
31 | 40 | ChartThemeBlueCerulean() : ChartTheme(QChart::ChartThemeBlueCerulean) |
|
32 | 41 | { |
|
33 | 42 | // Series colors |
|
34 | 43 | m_seriesColors << QRgb(0xc7e85b); |
|
35 | 44 | m_seriesColors << QRgb(0x1cb54f); |
|
36 | 45 | m_seriesColors << QRgb(0x5cbf9b); |
|
37 | 46 | m_seriesColors << QRgb(0x009fbf); |
|
38 | 47 | m_seriesColors << QRgb(0xee7392); |
|
39 | 48 | generateSeriesGradients(); |
|
40 | 49 | |
|
41 | 50 | // Background |
|
42 | 51 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); |
|
43 | 52 | backgroundGradient.setColorAt(0.0, QRgb(0x056189)); |
|
44 | 53 | backgroundGradient.setColorAt(1.0, QRgb(0x101a31)); |
|
45 | 54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
46 | 55 | m_chartBackgroundGradient = backgroundGradient; |
|
47 | 56 | |
|
48 | 57 | // Axes and other |
|
49 | 58 | m_titleBrush = QBrush(QRgb(0xffffff)); |
|
50 | 59 | m_axisLinePen = QPen(QRgb(0xd6d6d6)); |
|
51 | 60 | m_axisLinePen.setWidth(2); |
|
52 | 61 | m_axisLabelBrush = QBrush(QRgb(0xffffff)); |
|
53 | 62 | m_gridLinePen = QPen(QRgb(0x84a2b0)); |
|
54 | 63 | m_gridLinePen.setWidth(1); |
|
55 | 64 | m_backgroundShades = BackgroundShadesNone; |
|
56 | 65 | } |
|
57 | 66 | }; |
|
58 | 67 | |
|
59 | 68 | QTCOMMERCIALCHART_END_NAMESPACE |
|
60 | 69 | |
|
61 | 70 | #endif |
@@ -1,62 +1,71 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef CHARTTHEMEBLUEICY_P_H |
|
22 | 31 | #define CHARTTHEMEBLUEICY_P_H |
|
23 | 32 | |
|
24 | 33 | #include "charttheme_p.h" |
|
25 | 34 | |
|
26 | 35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | 36 | |
|
28 | 37 | class ChartThemeBlueIcy: public ChartTheme |
|
29 | 38 | { |
|
30 | 39 | public: |
|
31 | 40 | ChartThemeBlueIcy() : ChartTheme(QChart::ChartThemeBlueIcy) |
|
32 | 41 | { |
|
33 | 42 | // Series colors |
|
34 | 43 | m_seriesColors << QRgb(0x3daeda); |
|
35 | 44 | m_seriesColors << QRgb(0x2685bf); |
|
36 | 45 | m_seriesColors << QRgb(0x0c2673); |
|
37 | 46 | m_seriesColors << QRgb(0x5f3dba); |
|
38 | 47 | m_seriesColors << QRgb(0x2fa3b4); |
|
39 | 48 | generateSeriesGradients(); |
|
40 | 49 | |
|
41 | 50 | // Background |
|
42 | 51 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); |
|
43 | 52 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
44 | 53 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
45 | 54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
46 | 55 | m_chartBackgroundGradient = backgroundGradient; |
|
47 | 56 | m_backgroundDropShadowEnabled = true; |
|
48 | 57 | |
|
49 | 58 | // Axes and other |
|
50 | 59 | m_titleBrush = QBrush(QRgb(0x404044)); |
|
51 | 60 | m_axisLinePen = QPen(QRgb(0xd6d6d6)); |
|
52 | 61 | m_axisLinePen.setWidth(2); |
|
53 | 62 | m_axisLabelBrush = QBrush(QRgb(0x404044)); |
|
54 | 63 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
55 | 64 | m_gridLinePen.setWidth(1); |
|
56 | 65 | m_backgroundShades = BackgroundShadesNone; |
|
57 | 66 | } |
|
58 | 67 | }; |
|
59 | 68 | |
|
60 | 69 | QTCOMMERCIALCHART_END_NAMESPACE |
|
61 | 70 | |
|
62 | 71 | #endif |
@@ -1,61 +1,70 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef CHARTTHEMEBLUENCS_P_H |
|
22 | 31 | #define CHARTTHEMEBLUENCS_P_H |
|
23 | 32 | |
|
24 | 33 | #include "charttheme_p.h" |
|
25 | 34 | |
|
26 | 35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | 36 | |
|
28 | 37 | class ChartThemeBlueNcs: public ChartTheme |
|
29 | 38 | { |
|
30 | 39 | public: |
|
31 | 40 | ChartThemeBlueNcs() : ChartTheme(QChart::ChartThemeBlueNcs) |
|
32 | 41 | { |
|
33 | 42 | // Series colors |
|
34 | 43 | m_seriesColors << QRgb(0x1db0da); |
|
35 | 44 | m_seriesColors << QRgb(0x1341a6); |
|
36 | 45 | m_seriesColors << QRgb(0x88d41e); |
|
37 | 46 | m_seriesColors << QRgb(0xff8e1a); |
|
38 | 47 | m_seriesColors << QRgb(0x398ca3); |
|
39 | 48 | generateSeriesGradients(); |
|
40 | 49 | |
|
41 | 50 | // Background |
|
42 | 51 | QLinearGradient backgroundGradient; |
|
43 | 52 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
44 | 53 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
45 | 54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
46 | 55 | m_chartBackgroundGradient = backgroundGradient; |
|
47 | 56 | |
|
48 | 57 | // Axes and other |
|
49 | 58 | m_titleBrush = QBrush(QRgb(0x404044)); |
|
50 | 59 | m_axisLinePen = QPen(QRgb(0xd6d6d6)); |
|
51 | 60 | m_axisLinePen.setWidth(2); |
|
52 | 61 | m_axisLabelBrush = QBrush(QRgb(0x404044)); |
|
53 | 62 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
54 | 63 | m_gridLinePen.setWidth(1); |
|
55 | 64 | m_backgroundShades = BackgroundShadesNone; |
|
56 | 65 | } |
|
57 | 66 | }; |
|
58 | 67 | |
|
59 | 68 | QTCOMMERCIALCHART_END_NAMESPACE |
|
60 | 69 | |
|
61 | 70 | #endif |
@@ -1,61 +1,70 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef CHARTTHEMEBROWNSAND_P_H |
|
22 | 31 | #define CHARTTHEMEBROWNSAND_P_H |
|
23 | 32 | |
|
24 | 33 | #include "charttheme_p.h" |
|
25 | 34 | |
|
26 | 35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | 36 | |
|
28 | 37 | class ChartThemeBrownSand: public ChartTheme |
|
29 | 38 | { |
|
30 | 39 | public: |
|
31 | 40 | ChartThemeBrownSand() : ChartTheme(QChart::ChartThemeBrownSand) |
|
32 | 41 | { |
|
33 | 42 | // Series colors |
|
34 | 43 | m_seriesColors << QRgb(0xb39b72); |
|
35 | 44 | m_seriesColors << QRgb(0xb3b376); |
|
36 | 45 | m_seriesColors << QRgb(0xc35660); |
|
37 | 46 | m_seriesColors << QRgb(0x536780); |
|
38 | 47 | m_seriesColors << QRgb(0x494345); |
|
39 | 48 | generateSeriesGradients(); |
|
40 | 49 | |
|
41 | 50 | // Background |
|
42 | 51 | QLinearGradient backgroundGradient; |
|
43 | 52 | backgroundGradient.setColorAt(0.0, QRgb(0xf3ece0)); |
|
44 | 53 | backgroundGradient.setColorAt(1.0, QRgb(0xf3ece0)); |
|
45 | 54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
46 | 55 | m_chartBackgroundGradient = backgroundGradient; |
|
47 | 56 | |
|
48 | 57 | // Axes and other |
|
49 | 58 | m_titleBrush = QBrush(QRgb(0x404044)); |
|
50 | 59 | m_axisLinePen = QPen(QRgb(0xb5b0a7)); |
|
51 | 60 | m_axisLinePen.setWidth(2); |
|
52 | 61 | m_axisLabelBrush = QBrush(QRgb(0x404044)); |
|
53 | 62 | m_gridLinePen = QPen(QRgb(0xd4cec3)); |
|
54 | 63 | m_gridLinePen.setWidth(1); |
|
55 | 64 | m_backgroundShades = BackgroundShadesNone; |
|
56 | 65 | } |
|
57 | 66 | }; |
|
58 | 67 | |
|
59 | 68 | QTCOMMERCIALCHART_END_NAMESPACE |
|
60 | 69 | |
|
61 | 70 | #endif |
@@ -1,61 +1,70 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef CHARTTHEMEDARK_P_H |
|
22 | 31 | #define CHARTTHEMEDARK_P_H |
|
23 | 32 | |
|
24 | 33 | #include "charttheme_p.h" |
|
25 | 34 | |
|
26 | 35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | 36 | |
|
28 | 37 | class ChartThemeDark : public ChartTheme |
|
29 | 38 | { |
|
30 | 39 | public: |
|
31 | 40 | ChartThemeDark() : ChartTheme(QChart::ChartThemeDark) |
|
32 | 41 | { |
|
33 | 42 | // Series colors |
|
34 | 43 | m_seriesColors << QRgb(0x38ad6b); |
|
35 | 44 | m_seriesColors << QRgb(0x3c84a7); |
|
36 | 45 | m_seriesColors << QRgb(0xeb8817); |
|
37 | 46 | m_seriesColors << QRgb(0x7b7f8c); |
|
38 | 47 | m_seriesColors << QRgb(0xbf593e); |
|
39 | 48 | generateSeriesGradients(); |
|
40 | 49 | |
|
41 | 50 | // Background |
|
42 | 51 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); |
|
43 | 52 | backgroundGradient.setColorAt(0.0, QRgb(0x2e303a)); |
|
44 | 53 | backgroundGradient.setColorAt(1.0, QRgb(0x121218)); |
|
45 | 54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
46 | 55 | m_chartBackgroundGradient = backgroundGradient; |
|
47 | 56 | |
|
48 | 57 | // Axes and other |
|
49 | 58 | m_titleBrush = QBrush(QRgb(0xffffff)); |
|
50 | 59 | m_axisLinePen = QPen(QRgb(0x86878c)); |
|
51 | 60 | m_axisLinePen.setWidth(2); |
|
52 | 61 | m_axisLabelBrush = QBrush(QRgb(0xffffff)); |
|
53 | 62 | m_gridLinePen = QPen(QRgb(0x86878c)); |
|
54 | 63 | m_gridLinePen.setWidth(1); |
|
55 | 64 | m_backgroundShades = BackgroundShadesNone; |
|
56 | 65 | } |
|
57 | 66 | }; |
|
58 | 67 | |
|
59 | 68 | QTCOMMERCIALCHART_END_NAMESPACE |
|
60 | 69 | |
|
61 | 70 | #endif |
@@ -1,63 +1,72 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef CHARTTHEMEHIGHCONTRAST_P_H |
|
22 | 31 | #define CHARTTHEMEHIGHCONTRAST_P_H |
|
23 | 32 | |
|
24 | 33 | #include "charttheme_p.h" |
|
25 | 34 | |
|
26 | 35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | 36 | |
|
28 | 37 | class ChartThemeHighContrast : public ChartTheme |
|
29 | 38 | { |
|
30 | 39 | public: |
|
31 | 40 | ChartThemeHighContrast() : ChartTheme(QChart::ChartThemeHighContrast) |
|
32 | 41 | { |
|
33 | 42 | // Series colors |
|
34 | 43 | m_seriesColors << QRgb(0x202020); |
|
35 | 44 | m_seriesColors << QRgb(0x596a74); |
|
36 | 45 | m_seriesColors << QRgb(0xffab03); |
|
37 | 46 | m_seriesColors << QRgb(0x038e9b); |
|
38 | 47 | m_seriesColors << QRgb(0xff4a41); |
|
39 | 48 | generateSeriesGradients(); |
|
40 | 49 | |
|
41 | 50 | // Background |
|
42 | 51 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); |
|
43 | 52 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
44 | 53 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
45 | 54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
46 | 55 | m_chartBackgroundGradient = backgroundGradient; |
|
47 | 56 | m_backgroundDropShadowEnabled = true; |
|
48 | 57 | |
|
49 | 58 | // Axes and other |
|
50 | 59 | m_titleBrush = QBrush(QRgb(0x181818)); |
|
51 | 60 | m_axisLinePen = QPen(QRgb(0x8c8c8c)); |
|
52 | 61 | m_axisLinePen.setWidth(2); |
|
53 | 62 | m_axisLabelBrush = QBrush(QRgb(0x181818)); |
|
54 | 63 | m_gridLinePen = QPen(QRgb(0x8c8c8c)); |
|
55 | 64 | m_gridLinePen.setWidth(1); |
|
56 | 65 | m_backgroundShadesBrush = QBrush(QRgb(0xffeecd)); |
|
57 | 66 | m_backgroundShades = BackgroundShadesHorizontal; |
|
58 | 67 | } |
|
59 | 68 | }; |
|
60 | 69 | |
|
61 | 70 | QTCOMMERCIALCHART_END_NAMESPACE |
|
62 | 71 | |
|
63 | 72 | #endif |
@@ -1,62 +1,71 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef CHARTTHEMELIGHT_P_H |
|
22 | 31 | #define CHARTTHEMELIGHT_P_H |
|
23 | 32 | |
|
24 | 33 | #include "charttheme_p.h" |
|
25 | 34 | |
|
26 | 35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | 36 | |
|
28 | 37 | class ChartThemeLight: public ChartTheme |
|
29 | 38 | { |
|
30 | 39 | public: |
|
31 | 40 | ChartThemeLight() : ChartTheme(QChart::ChartThemeLight) |
|
32 | 41 | { |
|
33 | 42 | // Series colors |
|
34 | 43 | m_seriesColors << QRgb(0x209fdf); |
|
35 | 44 | m_seriesColors << QRgb(0x99ca53); |
|
36 | 45 | m_seriesColors << QRgb(0xf6a625); |
|
37 | 46 | m_seriesColors << QRgb(0x6d5fd5); |
|
38 | 47 | m_seriesColors << QRgb(0xbf593e); |
|
39 | 48 | generateSeriesGradients(); |
|
40 | 49 | |
|
41 | 50 | // Background |
|
42 | 51 | QLinearGradient backgroundGradient; |
|
43 | 52 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
44 | 53 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
45 | 54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
46 | 55 | m_chartBackgroundGradient = backgroundGradient; |
|
47 | 56 | // There is a performance issue in the drop shadow implementation, so disabled for now |
|
48 | 57 | // m_backgroundDropShadowEnabled = true; |
|
49 | 58 | |
|
50 | 59 | // Axes and other |
|
51 | 60 | m_axisLinePen = QPen(0xd6d6d6); |
|
52 | 61 | m_axisLinePen.setWidth(1); |
|
53 | 62 | m_axisLabelBrush = QBrush(QRgb(0x404044)); |
|
54 | 63 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
55 | 64 | m_gridLinePen.setWidth(1); |
|
56 | 65 | m_backgroundShades = BackgroundShadesNone; |
|
57 | 66 | } |
|
58 | 67 | }; |
|
59 | 68 | |
|
60 | 69 | QTCOMMERCIALCHART_END_NAMESPACE |
|
61 | 70 | |
|
62 | 71 | #endif |
@@ -1,171 +1,180 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef CHARTTHEMESYSTEM_P_H |
|
22 | 31 | #define CHARTTHEMESYSTEM_P_H |
|
23 | 32 | |
|
24 | 33 | #include "charttheme_p.h" |
|
25 | 34 | #ifdef Q_OS_WIN |
|
26 | 35 | #include <windows.h> |
|
27 | 36 | #include <stdio.h> |
|
28 | 37 | #endif |
|
29 | 38 | |
|
30 | 39 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
31 | 40 | |
|
32 | 41 | class ChartThemeSystem: public ChartTheme |
|
33 | 42 | { |
|
34 | 43 | public: |
|
35 | 44 | // System theme not used at the moment (the user is not able to select this theme) |
|
36 | 45 | ChartThemeSystem() : ChartTheme(QChart::ChartThemeLight /*QChart::ChartThemeSystem*/) |
|
37 | 46 | { |
|
38 | 47 | #ifdef Q_OS_WIN |
|
39 | 48 | // TODO: use theme specific window frame color as a series base color (it would give more |
|
40 | 49 | // variation to the base colors in addition to the blue and black used now) |
|
41 | 50 | // TODO: COLOR_WINDOWTEXT for text color? |
|
42 | 51 | // TODO: COLOR_INFOTEXT for tooltip text color? |
|
43 | 52 | // TODO: COLOR_INFOBK for tooltip background color? |
|
44 | 53 | |
|
45 | 54 | // First series base color from COLOR_HIGHLIGHT |
|
46 | 55 | DWORD colorHighlight; |
|
47 | 56 | colorHighlight = GetSysColor(COLOR_HIGHLIGHT); |
|
48 | 57 | m_seriesColors.append(QColor(GetRValue(colorHighlight), |
|
49 | 58 | GetGValue(colorHighlight), |
|
50 | 59 | GetBValue(colorHighlight))); |
|
51 | 60 | |
|
52 | 61 | // Second series base color from COLOR_WINDOWFRAME |
|
53 | 62 | DWORD colorWindowFrame; |
|
54 | 63 | colorWindowFrame = GetSysColor(COLOR_WINDOWFRAME); |
|
55 | 64 | m_seriesColors.append(QColor(GetRValue(colorWindowFrame), |
|
56 | 65 | GetGValue(colorWindowFrame), |
|
57 | 66 | GetBValue(colorWindowFrame))); |
|
58 | 67 | |
|
59 | 68 | // Third series base color from the middle of the COLOR_ACTIVECAPTION / |
|
60 | 69 | // COLOR_GRADIENTACTIVECAPTION gradient |
|
61 | 70 | DWORD colorGradientActiveCaptionLeft; |
|
62 | 71 | colorGradientActiveCaptionLeft = GetSysColor(COLOR_ACTIVECAPTION); |
|
63 | 72 | DWORD colorGradientActiveCaptionRight; |
|
64 | 73 | colorGradientActiveCaptionRight = GetSysColor(COLOR_GRADIENTACTIVECAPTION); |
|
65 | 74 | QLinearGradient g; |
|
66 | 75 | QColor start = QColor(GetRValue(colorGradientActiveCaptionLeft), |
|
67 | 76 | GetGValue(colorGradientActiveCaptionLeft), |
|
68 | 77 | GetBValue(colorGradientActiveCaptionLeft)); |
|
69 | 78 | g.setColorAt(0.0, start); |
|
70 | 79 | QColor end = QColor(GetRValue(colorGradientActiveCaptionRight), |
|
71 | 80 | GetGValue(colorGradientActiveCaptionRight), |
|
72 | 81 | GetBValue(colorGradientActiveCaptionRight)); |
|
73 | 82 | g.setColorAt(1.0, end); |
|
74 | 83 | m_seriesColors.append(colorAt(g, 0.5)); |
|
75 | 84 | |
|
76 | 85 | // Generate gradients from the base colors |
|
77 | 86 | generateSeriesGradients(); |
|
78 | 87 | |
|
79 | 88 | // Background fill color from COLOR_WINDOW |
|
80 | 89 | QLinearGradient backgroundGradient; |
|
81 | 90 | DWORD colorWindow; |
|
82 | 91 | colorWindow = GetSysColor(COLOR_WINDOW); |
|
83 | 92 | backgroundGradient.setColorAt(0.0, QColor(GetRValue(colorWindow), |
|
84 | 93 | GetGValue(colorWindow), |
|
85 | 94 | GetBValue(colorWindow))); |
|
86 | 95 | backgroundGradient.setColorAt(1.0, QColor(GetRValue(colorWindow), |
|
87 | 96 | GetGValue(colorWindow), |
|
88 | 97 | GetBValue(colorWindow))); |
|
89 | 98 | // Axes and other |
|
90 | 99 | m_axisLinePen = QPen(0xd6d6d6); |
|
91 | 100 | m_axisLinePen.setWidth(1); |
|
92 | 101 | m_axisLabelBrush = QBrush(QRgb(0x404044)); |
|
93 | 102 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
94 | 103 | m_gridLinePen.setWidth(1); |
|
95 | 104 | m_backgroundShades = BackgroundShadesNone; |
|
96 | 105 | |
|
97 | 106 | #elif defined(Q_OS_LINUX) |
|
98 | 107 | // TODO: replace this dummy theme with linux specific theme |
|
99 | 108 | m_seriesColors << QRgb(0x60a6e6); |
|
100 | 109 | m_seriesColors << QRgb(0x92ca66); |
|
101 | 110 | m_seriesColors << QRgb(0xeba85f); |
|
102 | 111 | m_seriesColors << QRgb(0xfc5751); |
|
103 | 112 | generateSeriesGradients(); |
|
104 | 113 | |
|
105 | 114 | // Background |
|
106 | 115 | QLinearGradient backgroundGradient; |
|
107 | 116 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
108 | 117 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
109 | 118 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
110 | 119 | m_chartBackgroundGradient = backgroundGradient; |
|
111 | 120 | |
|
112 | 121 | // Axes and other |
|
113 | 122 | m_axisLinePen = QPen(0xd6d6d6); |
|
114 | 123 | m_axisLinePen.setWidth(1); |
|
115 | 124 | m_axisLabelBrush = QBrush(QRgb(0x404044)); |
|
116 | 125 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
117 | 126 | m_gridLinePen.setWidth(1); |
|
118 | 127 | m_backgroundShades = BackgroundShadesNone; |
|
119 | 128 | |
|
120 | 129 | #elif defined(Q_OS_MAC) |
|
121 | 130 | // TODO: replace this dummy theme with OSX specific theme |
|
122 | 131 | m_seriesColors << QRgb(0x60a6e6); |
|
123 | 132 | m_seriesColors << QRgb(0x92ca66); |
|
124 | 133 | m_seriesColors << QRgb(0xeba85f); |
|
125 | 134 | m_seriesColors << QRgb(0xfc5751); |
|
126 | 135 | generateSeriesGradients(); |
|
127 | 136 | |
|
128 | 137 | // Background |
|
129 | 138 | QLinearGradient backgroundGradient; |
|
130 | 139 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
131 | 140 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
132 | 141 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
133 | 142 | m_chartBackgroundGradient = backgroundGradient; |
|
134 | 143 | |
|
135 | 144 | // Axes and other |
|
136 | 145 | m_axisLinePen = QPen(0xd6d6d6); |
|
137 | 146 | m_axisLinePen.setWidth(1); |
|
138 | 147 | m_axisLabelBrush = QBrush(QRgb(0x404044)); |
|
139 | 148 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
140 | 149 | m_gridLinePen.setWidth(1); |
|
141 | 150 | m_backgroundShades = BackgroundShadesNone; |
|
142 | 151 | |
|
143 | 152 | #else |
|
144 | 153 | // TODO: replace this dummy theme with generic (not OS specific) theme |
|
145 | 154 | m_seriesColors << QRgb(0x60a6e6); |
|
146 | 155 | m_seriesColors << QRgb(0x92ca66); |
|
147 | 156 | m_seriesColors << QRgb(0xeba85f); |
|
148 | 157 | m_seriesColors << QRgb(0xfc5751); |
|
149 | 158 | generateSeriesGradients(); |
|
150 | 159 | |
|
151 | 160 | // Background |
|
152 | 161 | QLinearGradient backgroundGradient; |
|
153 | 162 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
154 | 163 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
155 | 164 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
156 | 165 | m_chartBackgroundGradient = backgroundGradient; |
|
157 | 166 | |
|
158 | 167 | // Axes and other |
|
159 | 168 | m_axisLinePen = QPen(0xd6d6d6); |
|
160 | 169 | m_axisLinePen.setWidth(1); |
|
161 | 170 | m_axisLabelBrush = QBrush(QRgb(0x404044)); |
|
162 | 171 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
163 | 172 | m_gridLinePen.setWidth(1); |
|
164 | 173 | m_backgroundShades = BackgroundShadesNone; |
|
165 | 174 | #endif |
|
166 | 175 | } |
|
167 | 176 | }; |
|
168 | 177 | |
|
169 | 178 | QTCOMMERCIALCHART_END_NAMESPACE |
|
170 | 179 | |
|
171 | 180 | #endif // CHARTTHEMESYSTEM_P_H |
@@ -1,96 +1,105 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
21 | 30 | #ifndef XYCHARTITEM_H |
|
22 | 31 | #define XYCHARTITEM_H |
|
23 | 32 | |
|
24 | 33 | #include "qchartglobal.h" |
|
25 | 34 | #include "chartitem_p.h" |
|
26 | 35 | #include "xyanimation_p.h" |
|
27 | 36 | #include <QPen> |
|
28 | 37 | |
|
29 | 38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | 39 | |
|
31 | 40 | class ChartPresenter; |
|
32 | 41 | class QXYSeries; |
|
33 | 42 | |
|
34 | 43 | class XYChart : public Chart |
|
35 | 44 | { |
|
36 | 45 | Q_OBJECT |
|
37 | 46 | public: |
|
38 | 47 | explicit XYChart(QXYSeries *series, ChartPresenter *presenter); |
|
39 | 48 | ~XYChart(){}; |
|
40 | 49 | |
|
41 | 50 | void setGeometryPoints(const QVector<QPointF>& points); |
|
42 | 51 | QVector<QPointF> geometryPoints() const { return m_points; } |
|
43 | 52 | |
|
44 | 53 | void setClipRect(const QRectF &rect); |
|
45 | 54 | QRectF clipRect() const { return m_clipRect; } |
|
46 | 55 | |
|
47 | 56 | QSizeF size() const { return m_size; } |
|
48 | 57 | QPointF origin() const { return m_origin; } |
|
49 | 58 | |
|
50 | 59 | void setAnimation(XYAnimation* animation); |
|
51 | 60 | ChartAnimation* animation() const { return m_animation; } |
|
52 | 61 | virtual void updateGeometry() = 0; |
|
53 | 62 | |
|
54 | 63 | bool isDirty() const { return m_dirty; } |
|
55 | 64 | void setDirty(bool dirty); |
|
56 | 65 | |
|
57 | 66 | public Q_SLOTS: |
|
58 | 67 | void handlePointAdded(int index); |
|
59 | 68 | void handlePointRemoved(int index); |
|
60 | 69 | void handlePointReplaced(int index); |
|
61 | 70 | void handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY); |
|
62 | 71 | void handleGeometryChanged(const QRectF &size); |
|
63 | 72 | |
|
64 | 73 | Q_SIGNALS: |
|
65 | 74 | void clicked(const QPointF& point); |
|
66 | 75 | |
|
67 | 76 | protected: |
|
68 | 77 | virtual void updateChart(QVector<QPointF> &oldPoints,QVector<QPointF> &newPoints,int index = -1); |
|
69 | 78 | QPointF calculateGeometryPoint(const QPointF &point) const; |
|
70 | 79 | QPointF calculateGeometryPoint(int index) const; |
|
71 | 80 | QPointF calculateDomainPoint(const QPointF &point) const; |
|
72 | 81 | QVector<QPointF> calculateGeometryPoints() const; |
|
73 | 82 | |
|
74 | 83 | private: |
|
75 | 84 | inline bool isEmpty(); |
|
76 | 85 | |
|
77 | 86 | private: |
|
78 | 87 | qreal m_minX; |
|
79 | 88 | qreal m_maxX; |
|
80 | 89 | qreal m_minY; |
|
81 | 90 | qreal m_maxY; |
|
82 | 91 | QXYSeries* m_series; |
|
83 | 92 | QSizeF m_size; |
|
84 | 93 | QPointF m_origin; |
|
85 | 94 | QRectF m_clipRect; |
|
86 | 95 | QVector<QPointF> m_points; |
|
87 | 96 | XYAnimation* m_animation; |
|
88 | 97 | bool m_dirty; |
|
89 | 98 | |
|
90 | 99 | friend class AreaChartItem; |
|
91 | 100 | |
|
92 | 101 | }; |
|
93 | 102 | |
|
94 | 103 | QTCOMMERCIALCHART_END_NAMESPACE |
|
95 | 104 | |
|
96 | 105 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now