##// END OF EJS Templates
Updated private header warning...
Titta Heikkala -
r2807:a9a78a1d08bc
parent child
Show More
@@ -1,60 +1,60
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef AXISANIMATION_H
28 #ifndef AXISANIMATION_H
29 #define AXISANIMATION_H
29 #define AXISANIMATION_H
30
30
31 #include <private/chartanimation_p.h>
31 #include <private/chartanimation_p.h>
32 #include <QtCore/QPointF>
32 #include <QtCore/QPointF>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class ChartAxisElement;
36 class ChartAxisElement;
37
37
38 class AxisAnimation: public ChartAnimation
38 class AxisAnimation: public ChartAnimation
39 {
39 {
40 public:
40 public:
41 enum Animation { DefaultAnimation, ZoomOutAnimation, ZoomInAnimation, MoveForwardAnimation, MoveBackwordAnimation};
41 enum Animation { DefaultAnimation, ZoomOutAnimation, ZoomInAnimation, MoveForwardAnimation, MoveBackwordAnimation};
42 AxisAnimation(ChartAxisElement *axis, int duration, QEasingCurve &curve);
42 AxisAnimation(ChartAxisElement *axis, int duration, QEasingCurve &curve);
43 ~AxisAnimation();
43 ~AxisAnimation();
44 void setAnimationType(Animation type);
44 void setAnimationType(Animation type);
45 void setAnimationPoint(const QPointF &point);
45 void setAnimationPoint(const QPointF &point);
46 void setValues(QVector<qreal> &oldLayout, QVector<qreal> &newLayout);
46 void setValues(QVector<qreal> &oldLayout, QVector<qreal> &newLayout);
47 protected:
47 protected:
48 QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const;
48 QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const;
49 void updateCurrentValue(const QVariant &value);
49 void updateCurrentValue(const QVariant &value);
50 private:
50 private:
51 ChartAxisElement *m_axis;
51 ChartAxisElement *m_axis;
52 Animation m_type;
52 Animation m_type;
53 QPointF m_point;
53 QPointF m_point;
54 };
54 };
55
55
56 QT_CHARTS_END_NAMESPACE
56 QT_CHARTS_END_NAMESPACE
57
57
58
58
59
59
60 #endif /* AXISANIMATION_H */
60 #endif /* AXISANIMATION_H */
@@ -1,57 +1,57
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef BARANIMATION_P_H
28 #ifndef BARANIMATION_P_H
29 #define BARANIMATION_P_H
29 #define BARANIMATION_P_H
30
30
31 #include <private/chartanimation_p.h>
31 #include <private/chartanimation_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class AbstractBarChartItem;
35 class AbstractBarChartItem;
36
36
37 class BarAnimation : public ChartAnimation
37 class BarAnimation : public ChartAnimation
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40
40
41 public:
41 public:
42 BarAnimation(AbstractBarChartItem *item, int duration, QEasingCurve &curve);
42 BarAnimation(AbstractBarChartItem *item, int duration, QEasingCurve &curve);
43 ~BarAnimation();
43 ~BarAnimation();
44
44
45 public: // from QVariantAnimation
45 public: // from QVariantAnimation
46 virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const;
46 virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const;
47 virtual void updateCurrentValue(const QVariant &value);
47 virtual void updateCurrentValue(const QVariant &value);
48
48
49 void setup(const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout);
49 void setup(const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout);
50
50
51 protected:
51 protected:
52 AbstractBarChartItem *m_item;
52 AbstractBarChartItem *m_item;
53 };
53 };
54
54
55 QT_CHARTS_END_NAMESPACE
55 QT_CHARTS_END_NAMESPACE
56
56
57 #endif // BARANIMATION_P_H
57 #endif // BARANIMATION_P_H
@@ -1,64 +1,64
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef BOXPLOTANIMATION_P_H
28 #ifndef BOXPLOTANIMATION_P_H
29 #define BOXPLOTANIMATION_P_H
29 #define BOXPLOTANIMATION_P_H
30
30
31 #include <private/chartanimation_p.h>
31 #include <private/chartanimation_p.h>
32 #include <private/boxwhiskers_p.h>
32 #include <private/boxwhiskers_p.h>
33 #include <private/boxwhiskersdata_p.h>
33 #include <private/boxwhiskersdata_p.h>
34 #include <private/boxwhiskersanimation_p.h>
34 #include <private/boxwhiskersanimation_p.h>
35
35
36 QT_CHARTS_BEGIN_NAMESPACE
36 QT_CHARTS_BEGIN_NAMESPACE
37
37
38 class BoxPlotChartItem;
38 class BoxPlotChartItem;
39
39
40 class BoxPlotAnimation : public QObject
40 class BoxPlotAnimation : public QObject
41 {
41 {
42 Q_OBJECT
42 Q_OBJECT
43 public:
43 public:
44 BoxPlotAnimation(BoxPlotChartItem *item, int duration, QEasingCurve &curve);
44 BoxPlotAnimation(BoxPlotChartItem *item, int duration, QEasingCurve &curve);
45 ~BoxPlotAnimation();
45 ~BoxPlotAnimation();
46
46
47 void addBox(BoxWhiskers *box);
47 void addBox(BoxWhiskers *box);
48 ChartAnimation *boxAnimation(BoxWhiskers *box);
48 ChartAnimation *boxAnimation(BoxWhiskers *box);
49 ChartAnimation *boxChangeAnimation(BoxWhiskers *box);
49 ChartAnimation *boxChangeAnimation(BoxWhiskers *box);
50
50
51 void setAnimationStart(BoxWhiskers *box);
51 void setAnimationStart(BoxWhiskers *box);
52 void stopAll();
52 void stopAll();
53 void removeBoxAnimation(BoxWhiskers *box);
53 void removeBoxAnimation(BoxWhiskers *box);
54
54
55 protected:
55 protected:
56 BoxPlotChartItem *m_item;
56 BoxPlotChartItem *m_item;
57 QHash<BoxWhiskers *, BoxWhiskersAnimation *> m_animations;
57 QHash<BoxWhiskers *, BoxWhiskersAnimation *> m_animations;
58 int m_animationDuration;
58 int m_animationDuration;
59 QEasingCurve m_animationCurve;
59 QEasingCurve m_animationCurve;
60 };
60 };
61
61
62 QT_CHARTS_END_NAMESPACE
62 QT_CHARTS_END_NAMESPACE
63
63
64 #endif // BOXPLOTANIMATION_P_H
64 #endif // BOXPLOTANIMATION_P_H
@@ -1,68 +1,68
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef BOXWHISKERSANIMATION_P_H
28 #ifndef BOXWHISKERSANIMATION_P_H
29 #define BOXWHISKERSANIMATION_P_H
29 #define BOXWHISKERSANIMATION_P_H
30
30
31 #include <private/chartanimation_p.h>
31 #include <private/chartanimation_p.h>
32 #include <private/boxwhiskers_p.h>
32 #include <private/boxwhiskers_p.h>
33 #include <private/boxwhiskersdata_p.h>
33 #include <private/boxwhiskersdata_p.h>
34
34
35 QT_CHARTS_BEGIN_NAMESPACE
35 QT_CHARTS_BEGIN_NAMESPACE
36
36
37 class BoxPlotChartItem;
37 class BoxPlotChartItem;
38 class BoxPlotAnimation;
38 class BoxPlotAnimation;
39
39
40 class BoxWhiskersAnimation : public ChartAnimation
40 class BoxWhiskersAnimation : public ChartAnimation
41 {
41 {
42 Q_OBJECT
42 Q_OBJECT
43
43
44 public:
44 public:
45 BoxWhiskersAnimation(BoxWhiskers *box, BoxPlotAnimation *boxPlotAnimation, int duration,
45 BoxWhiskersAnimation(BoxWhiskers *box, BoxPlotAnimation *boxPlotAnimation, int duration,
46 QEasingCurve &curve);
46 QEasingCurve &curve);
47 ~BoxWhiskersAnimation();
47 ~BoxWhiskersAnimation();
48
48
49 public: // from QVariantAnimation
49 public: // from QVariantAnimation
50 virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const;
50 virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const;
51 virtual void updateCurrentValue(const QVariant &value);
51 virtual void updateCurrentValue(const QVariant &value);
52
52
53 void setup(const BoxWhiskersData &startData, const BoxWhiskersData &endData);
53 void setup(const BoxWhiskersData &startData, const BoxWhiskersData &endData);
54 void setEndData(const BoxWhiskersData &endData);
54 void setEndData(const BoxWhiskersData &endData);
55 void setStartData(const BoxWhiskersData &endData);
55 void setStartData(const BoxWhiskersData &endData);
56
56
57 void moveMedianLine(bool move);
57 void moveMedianLine(bool move);
58
58
59 protected:
59 protected:
60 friend class BoxPlotAnimation;
60 friend class BoxPlotAnimation;
61 BoxWhiskers *m_box;
61 BoxWhiskers *m_box;
62 bool m_changeAnimation;
62 bool m_changeAnimation;
63 BoxPlotAnimation *m_boxPlotAnimation;
63 BoxPlotAnimation *m_boxPlotAnimation;
64 };
64 };
65
65
66 QT_CHARTS_END_NAMESPACE
66 QT_CHARTS_END_NAMESPACE
67
67
68 #endif // BOXWHISKERSANIMATION_P_H
68 #endif // BOXWHISKERSANIMATION_P_H
@@ -1,55 +1,55
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTANIMATION_H
28 #ifndef CHARTANIMATION_H
29 #define CHARTANIMATION_H
29 #define CHARTANIMATION_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <QtCore/QVariantAnimation>
32 #include <QtCore/QVariantAnimation>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 const static int ChartAnimationDuration = 1000;
36 const static int ChartAnimationDuration = 1000;
37
37
38 class ChartAnimation: public QVariantAnimation
38 class ChartAnimation: public QVariantAnimation
39 {
39 {
40 Q_OBJECT
40 Q_OBJECT
41 public:
41 public:
42 ChartAnimation(QObject *parent = 0);
42 ChartAnimation(QObject *parent = 0);
43
43
44 void stopAndDestroyLater();
44 void stopAndDestroyLater();
45
45
46 public Q_SLOTS:
46 public Q_SLOTS:
47 void startChartAnimation();
47 void startChartAnimation();
48
48
49 protected:
49 protected:
50 bool m_destructing;
50 bool m_destructing;
51 };
51 };
52
52
53 QT_CHARTS_END_NAMESPACE
53 QT_CHARTS_END_NAMESPACE
54
54
55 #endif /* CHARTANIMATION_H */
55 #endif /* CHARTANIMATION_H */
@@ -1,62 +1,62
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef PIEANIMATION_P_H
28 #ifndef PIEANIMATION_P_H
29 #define PIEANIMATION_P_H
29 #define PIEANIMATION_P_H
30
30
31 #include <private/chartanimation_p.h>
31 #include <private/chartanimation_p.h>
32 #include <private/piechartitem_p.h>
32 #include <private/piechartitem_p.h>
33 #include <private/piesliceanimation_p.h>
33 #include <private/piesliceanimation_p.h>
34
34
35 QT_CHARTS_BEGIN_NAMESPACE
35 QT_CHARTS_BEGIN_NAMESPACE
36
36
37 class PieChartItem;
37 class PieChartItem;
38
38
39 class PieAnimation : public ChartAnimation
39 class PieAnimation : public ChartAnimation
40 {
40 {
41 Q_OBJECT
41 Q_OBJECT
42
42
43 public:
43 public:
44 PieAnimation(PieChartItem *item, int duration, QEasingCurve &curve);
44 PieAnimation(PieChartItem *item, int duration, QEasingCurve &curve);
45 ~PieAnimation();
45 ~PieAnimation();
46 ChartAnimation *updateValue(PieSliceItem *sliceItem, const PieSliceData &newValue);
46 ChartAnimation *updateValue(PieSliceItem *sliceItem, const PieSliceData &newValue);
47 ChartAnimation *addSlice(PieSliceItem *sliceItem, const PieSliceData &endValue, bool startupAnimation);
47 ChartAnimation *addSlice(PieSliceItem *sliceItem, const PieSliceData &endValue, bool startupAnimation);
48 ChartAnimation *removeSlice(PieSliceItem *sliceItem);
48 ChartAnimation *removeSlice(PieSliceItem *sliceItem);
49
49
50 public: // from QVariantAnimation
50 public: // from QVariantAnimation
51 void updateCurrentValue(const QVariant &value);
51 void updateCurrentValue(const QVariant &value);
52
52
53 private:
53 private:
54 PieChartItem *m_item;
54 PieChartItem *m_item;
55 QHash<PieSliceItem *, PieSliceAnimation *> m_animations;
55 QHash<PieSliceItem *, PieSliceAnimation *> m_animations;
56 int m_animationDuration;
56 int m_animationDuration;
57 QEasingCurve m_animationCurve;
57 QEasingCurve m_animationCurve;
58 };
58 };
59
59
60 QT_CHARTS_END_NAMESPACE
60 QT_CHARTS_END_NAMESPACE
61
61
62 #endif
62 #endif
@@ -1,58 +1,58
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef PIESLICEANIMATION_P_H
28 #ifndef PIESLICEANIMATION_P_H
29 #define PIESLICEANIMATION_P_H
29 #define PIESLICEANIMATION_P_H
30
30
31 #include <private/chartanimation_p.h>
31 #include <private/chartanimation_p.h>
32 #include <private/piesliceitem_p.h>
32 #include <private/piesliceitem_p.h>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class PieChartItem;
36 class PieChartItem;
37
37
38 class PieSliceAnimation : public ChartAnimation
38 class PieSliceAnimation : public ChartAnimation
39 {
39 {
40 public:
40 public:
41 PieSliceAnimation(PieSliceItem *sliceItem);
41 PieSliceAnimation(PieSliceItem *sliceItem);
42 ~PieSliceAnimation();
42 ~PieSliceAnimation();
43 void setValue(const PieSliceData &startValue, const PieSliceData &endValue);
43 void setValue(const PieSliceData &startValue, const PieSliceData &endValue);
44 void updateValue(const PieSliceData &endValue);
44 void updateValue(const PieSliceData &endValue);
45 PieSliceData currentSliceValue();
45 PieSliceData currentSliceValue();
46
46
47 protected:
47 protected:
48 QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const;
48 QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const;
49 void updateCurrentValue(const QVariant &value);
49 void updateCurrentValue(const QVariant &value);
50
50
51 private:
51 private:
52 PieSliceItem *m_sliceItem;
52 PieSliceItem *m_sliceItem;
53 PieSliceData m_currentValue;
53 PieSliceData m_currentValue;
54 };
54 };
55
55
56 QT_CHARTS_END_NAMESPACE
56 QT_CHARTS_END_NAMESPACE
57
57
58 #endif
58 #endif
@@ -1,48 +1,48
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef SCATTERANIMATION_P_H
28 #ifndef SCATTERANIMATION_P_H
29 #define SCATTERANIMATION_P_H
29 #define SCATTERANIMATION_P_H
30 #include <private/xyanimation_p.h>
30 #include <private/xyanimation_p.h>
31
31
32 QT_CHARTS_BEGIN_NAMESPACE
32 QT_CHARTS_BEGIN_NAMESPACE
33
33
34 class ScatterChartItem;
34 class ScatterChartItem;
35
35
36 class ScatterAnimation : public XYAnimation
36 class ScatterAnimation : public XYAnimation
37 {
37 {
38 public:
38 public:
39 ScatterAnimation(ScatterChartItem *item, int duration, QEasingCurve &curve);
39 ScatterAnimation(ScatterChartItem *item, int duration, QEasingCurve &curve);
40 ~ScatterAnimation();
40 ~ScatterAnimation();
41
41
42 protected:
42 protected:
43 void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
43 void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
44 };
44 };
45
45
46 QT_CHARTS_END_NAMESPACE
46 QT_CHARTS_END_NAMESPACE
47
47
48 #endif
48 #endif
@@ -1,60 +1,60
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef SPLINEANIMATION_P_H
28 #ifndef SPLINEANIMATION_P_H
29 #define SPLINEANIMATION_P_H
29 #define SPLINEANIMATION_P_H
30 #include <private/xyanimation_p.h>
30 #include <private/xyanimation_p.h>
31 #include <QtCore/QPointF>
31 #include <QtCore/QPointF>
32
32
33 typedef QPair<QVector<QPointF >, QVector<QPointF > > SplineVector;
33 typedef QPair<QVector<QPointF >, QVector<QPointF > > SplineVector;
34
34
35 QT_CHARTS_BEGIN_NAMESPACE
35 QT_CHARTS_BEGIN_NAMESPACE
36
36
37 class SplineChartItem;
37 class SplineChartItem;
38
38
39 class SplineAnimation : public XYAnimation
39 class SplineAnimation : public XYAnimation
40 {
40 {
41 public:
41 public:
42 SplineAnimation(SplineChartItem *item, int duration, QEasingCurve &curve);
42 SplineAnimation(SplineChartItem *item, int duration, QEasingCurve &curve);
43 ~SplineAnimation();
43 ~SplineAnimation();
44 void setup(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, QVector<QPointF> &oldContorlPoints, QVector<QPointF> &newControlPoints, int index = -1);
44 void setup(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, QVector<QPointF> &oldContorlPoints, QVector<QPointF> &newControlPoints, int index = -1);
45
45
46 protected:
46 protected:
47 QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const;
47 QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const;
48 void updateCurrentValue(const QVariant &value);
48 void updateCurrentValue(const QVariant &value);
49 void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
49 void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
50
50
51 private:
51 private:
52 SplineVector m_oldSpline;
52 SplineVector m_oldSpline;
53 SplineVector m_newSpline;
53 SplineVector m_newSpline;
54 SplineChartItem *m_item;
54 SplineChartItem *m_item;
55 bool m_valid;
55 bool m_valid;
56 };
56 };
57
57
58 QT_CHARTS_END_NAMESPACE
58 QT_CHARTS_END_NAMESPACE
59
59
60 #endif
60 #endif
@@ -1,65 +1,65
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef XYANIMATION_P_H
28 #ifndef XYANIMATION_P_H
29 #define XYANIMATION_P_H
29 #define XYANIMATION_P_H
30
30
31 #include <private/chartanimation_p.h>
31 #include <private/chartanimation_p.h>
32 #include <QtCore/QPointF>
32 #include <QtCore/QPointF>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class XYChart;
36 class XYChart;
37
37
38 class XYAnimation : public ChartAnimation
38 class XYAnimation : public ChartAnimation
39 {
39 {
40 protected:
40 protected:
41 enum Animation { AddPointAnimation, RemovePointAnimation, ReplacePointAnimation, NewAnimation };
41 enum Animation { AddPointAnimation, RemovePointAnimation, ReplacePointAnimation, NewAnimation };
42 public:
42 public:
43 XYAnimation(XYChart *item, int duration, QEasingCurve &curve);
43 XYAnimation(XYChart *item, int duration, QEasingCurve &curve);
44 ~XYAnimation();
44 ~XYAnimation();
45 void setup(const QVector<QPointF> &oldPoints, const QVector<QPointF> &newPoints, int index = -1);
45 void setup(const QVector<QPointF> &oldPoints, const QVector<QPointF> &newPoints, int index = -1);
46 Animation animationType() const { return m_type; };
46 Animation animationType() const { return m_type; };
47
47
48 protected:
48 protected:
49 QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const;
49 QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const;
50 void updateCurrentValue(const QVariant &value);
50 void updateCurrentValue(const QVariant &value);
51 void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
51 void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
52 XYChart *chartItem() { return m_item; }
52 XYChart *chartItem() { return m_item; }
53 protected:
53 protected:
54 Animation m_type;
54 Animation m_type;
55 bool m_dirty;
55 bool m_dirty;
56 int m_index;
56 int m_index;
57 private:
57 private:
58 XYChart *m_item;
58 XYChart *m_item;
59 QVector<QPointF> m_oldPoints;
59 QVector<QPointF> m_oldPoints;
60 QVector<QPointF> m_newPoints;
60 QVector<QPointF> m_newPoints;
61 };
61 };
62
62
63 QT_CHARTS_END_NAMESPACE
63 QT_CHARTS_END_NAMESPACE
64
64
65 #endif
65 #endif
@@ -1,132 +1,132
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef AREACHARTITEM_H
28 #ifndef AREACHARTITEM_H
29 #define AREACHARTITEM_H
29 #define AREACHARTITEM_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <private/linechartitem_p.h>
32 #include <private/linechartitem_p.h>
33 #include <QtCharts/QAreaSeries>
33 #include <QtCharts/QAreaSeries>
34 #include <QtGui/QPen>
34 #include <QtGui/QPen>
35
35
36 QT_CHARTS_BEGIN_NAMESPACE
36 QT_CHARTS_BEGIN_NAMESPACE
37
37
38 class AreaChartItem;
38 class AreaChartItem;
39
39
40 class AreaChartItem : public ChartItem
40 class AreaChartItem : public ChartItem
41 {
41 {
42 Q_OBJECT
42 Q_OBJECT
43 public:
43 public:
44 AreaChartItem(QAreaSeries *areaSeries, QGraphicsItem* item = 0);
44 AreaChartItem(QAreaSeries *areaSeries, QGraphicsItem* item = 0);
45 ~AreaChartItem();
45 ~AreaChartItem();
46
46
47 //from QGraphicsItem
47 //from QGraphicsItem
48 QRectF boundingRect() const;
48 QRectF boundingRect() const;
49 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
49 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
50 QPainterPath shape() const;
50 QPainterPath shape() const;
51
51
52 LineChartItem *upperLineItem() const { return m_upper; }
52 LineChartItem *upperLineItem() const { return m_upper; }
53 LineChartItem *lowerLineItem() const { return m_lower; }
53 LineChartItem *lowerLineItem() const { return m_lower; }
54
54
55 void updatePath();
55 void updatePath();
56
56
57 void setPresenter(ChartPresenter *presenter);
57 void setPresenter(ChartPresenter *presenter);
58 QAreaSeries *series() const { return m_series; }
58 QAreaSeries *series() const { return m_series; }
59
59
60 protected:
60 protected:
61 void mousePressEvent(QGraphicsSceneMouseEvent *event);
61 void mousePressEvent(QGraphicsSceneMouseEvent *event);
62 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
62 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
63 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
63 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
64 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
64 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
65 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
65 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
66
66
67 Q_SIGNALS:
67 Q_SIGNALS:
68 void clicked(const QPointF &point);
68 void clicked(const QPointF &point);
69 void hovered(const QPointF &point, bool state);
69 void hovered(const QPointF &point, bool state);
70 void pressed(const QPointF &point);
70 void pressed(const QPointF &point);
71 void released(const QPointF &point);
71 void released(const QPointF &point);
72 void doubleClicked(const QPointF &point);
72 void doubleClicked(const QPointF &point);
73
73
74 public Q_SLOTS:
74 public Q_SLOTS:
75 void handleUpdated();
75 void handleUpdated();
76 void handleDomainUpdated();
76 void handleDomainUpdated();
77
77
78 private:
78 private:
79 QAreaSeries *m_series;
79 QAreaSeries *m_series;
80 LineChartItem *m_upper;
80 LineChartItem *m_upper;
81 LineChartItem *m_lower;
81 LineChartItem *m_lower;
82 QPainterPath m_path;
82 QPainterPath m_path;
83 QRectF m_rect;
83 QRectF m_rect;
84 QPen m_linePen;
84 QPen m_linePen;
85 QPen m_pointPen;
85 QPen m_pointPen;
86 QBrush m_brush;
86 QBrush m_brush;
87 bool m_pointsVisible;
87 bool m_pointsVisible;
88
88
89 bool m_pointLabelsVisible;
89 bool m_pointLabelsVisible;
90 QString m_pointLabelsFormat;
90 QString m_pointLabelsFormat;
91 QFont m_pointLabelsFont;
91 QFont m_pointLabelsFont;
92 QColor m_pointLabelsColor;
92 QColor m_pointLabelsColor;
93
93
94 QPointF m_lastMousePos;
94 QPointF m_lastMousePos;
95 bool m_mousePressed;
95 bool m_mousePressed;
96
96
97 };
97 };
98
98
99 class AreaBoundItem : public LineChartItem
99 class AreaBoundItem : public LineChartItem
100 {
100 {
101 public:
101 public:
102 AreaBoundItem(AreaChartItem *area, QLineSeries *lineSeries,QGraphicsItem* item = 0)
102 AreaBoundItem(AreaChartItem *area, QLineSeries *lineSeries,QGraphicsItem* item = 0)
103 : LineChartItem(lineSeries, item), m_item(area)
103 : LineChartItem(lineSeries, item), m_item(area)
104 {
104 {
105 // We do not actually want to draw anything from LineChartItem.
105 // We do not actually want to draw anything from LineChartItem.
106 // Drawing is done in AreaChartItem only.
106 // Drawing is done in AreaChartItem only.
107 setVisible(false);
107 setVisible(false);
108 }
108 }
109 ~AreaBoundItem() {}
109 ~AreaBoundItem() {}
110
110
111 void updateGeometry()
111 void updateGeometry()
112 {
112 {
113 // Make sure the series is in a chart before trying to update
113 // Make sure the series is in a chart before trying to update
114 if (m_item->series()->chart()) {
114 if (m_item->series()->chart()) {
115 // Turn off points drawing from component line chart item, as that
115 // Turn off points drawing from component line chart item, as that
116 // messes up the fill for area series.
116 // messes up the fill for area series.
117 suppressPoints();
117 suppressPoints();
118 // Component lineseries are not necessarily themselves on the chart,
118 // Component lineseries are not necessarily themselves on the chart,
119 // so get the chart type for them from area chart.
119 // so get the chart type for them from area chart.
120 forceChartType(m_item->series()->chart()->chartType());
120 forceChartType(m_item->series()->chart()->chartType());
121 LineChartItem::updateGeometry();
121 LineChartItem::updateGeometry();
122 m_item->updatePath();
122 m_item->updatePath();
123 }
123 }
124 }
124 }
125
125
126 private:
126 private:
127 AreaChartItem *m_item;
127 AreaChartItem *m_item;
128 };
128 };
129
129
130 QT_CHARTS_END_NAMESPACE
130 QT_CHARTS_END_NAMESPACE
131
131
132 #endif
132 #endif
@@ -1,76 +1,76
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QAREASERIES_P_H
28 #ifndef QAREASERIES_P_H
29 #define QAREASERIES_P_H
29 #define QAREASERIES_P_H
30
30
31 #include <private/qabstractseries_p.h>
31 #include <private/qabstractseries_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QAreaSeries;
35 class QAreaSeries;
36 class QLineSeries;
36 class QLineSeries;
37
37
38 class QAreaSeriesPrivate: public QAbstractSeriesPrivate
38 class QAreaSeriesPrivate: public QAbstractSeriesPrivate
39 {
39 {
40 Q_OBJECT
40 Q_OBJECT
41
41
42 public:
42 public:
43 QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lowerSeries, QAreaSeries *q);
43 QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lowerSeries, QAreaSeries *q);
44
44
45 void initializeDomain();
45 void initializeDomain();
46 void initializeAxes();
46 void initializeAxes();
47 void initializeGraphics(QGraphicsItem* parent);
47 void initializeGraphics(QGraphicsItem* parent);
48 void initializeTheme(int index, ChartTheme* theme, bool forced = false);
48 void initializeTheme(int index, ChartTheme* theme, bool forced = false);
49 void initializeAnimations(QChart::AnimationOptions options, int duration,
49 void initializeAnimations(QChart::AnimationOptions options, int duration,
50 QEasingCurve &curve);
50 QEasingCurve &curve);
51
51
52 QList<QLegendMarker *> createLegendMarkers(QLegend *legend);
52 QList<QLegendMarker *> createLegendMarkers(QLegend *legend);
53
53
54 QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
54 QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
55 QAbstractAxis* createDefaultAxis(Qt::Orientation) const;
55 QAbstractAxis* createDefaultAxis(Qt::Orientation) const;
56
56
57 Q_SIGNALS:
57 Q_SIGNALS:
58 void updated();
58 void updated();
59
59
60 protected:
60 protected:
61 QBrush m_brush;
61 QBrush m_brush;
62 QPen m_pen;
62 QPen m_pen;
63 QLineSeries *m_upperSeries;
63 QLineSeries *m_upperSeries;
64 QLineSeries *m_lowerSeries;
64 QLineSeries *m_lowerSeries;
65 bool m_pointsVisible;
65 bool m_pointsVisible;
66 QString m_pointLabelsFormat;
66 QString m_pointLabelsFormat;
67 bool m_pointLabelsVisible;
67 bool m_pointLabelsVisible;
68 QFont m_pointLabelsFont;
68 QFont m_pointLabelsFont;
69 QColor m_pointLabelsColor;
69 QColor m_pointLabelsColor;
70 private:
70 private:
71 Q_DECLARE_PUBLIC(QAreaSeries);
71 Q_DECLARE_PUBLIC(QAreaSeries);
72 };
72 };
73
73
74 QT_CHARTS_END_NAMESPACE
74 QT_CHARTS_END_NAMESPACE
75
75
76 #endif
76 #endif
@@ -1,60 +1,60
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTBARCATEGORYAXISX_H
28 #ifndef CHARTBARCATEGORYAXISX_H
29 #define CHARTBARCATEGORYAXISX_H
29 #define CHARTBARCATEGORYAXISX_H
30
30
31 #include <private/horizontalaxis_p.h>
31 #include <private/horizontalaxis_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class ChartPresenter;
35 class ChartPresenter;
36 class QBarCategoryAxis;
36 class QBarCategoryAxis;
37
37
38 class ChartBarCategoryAxisX : public HorizontalAxis
38 class ChartBarCategoryAxisX : public HorizontalAxis
39 {
39 {
40 Q_OBJECT
40 Q_OBJECT
41 public:
41 public:
42 ChartBarCategoryAxisX(QBarCategoryAxis *axis, QGraphicsItem* item = 0);
42 ChartBarCategoryAxisX(QBarCategoryAxis *axis, QGraphicsItem* item = 0);
43 ~ChartBarCategoryAxisX();
43 ~ChartBarCategoryAxisX();
44
44
45 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
45 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
46 protected:
46 protected:
47 QVector<qreal> calculateLayout() const;
47 QVector<qreal> calculateLayout() const;
48 void updateGeometry();
48 void updateGeometry();
49 private:
49 private:
50 QStringList createCategoryLabels(const QVector<qreal>& layout) const;
50 QStringList createCategoryLabels(const QVector<qreal>& layout) const;
51 public Q_SLOTS:
51 public Q_SLOTS:
52 void handleCategoriesChanged();
52 void handleCategoriesChanged();
53
53
54 private:
54 private:
55 QBarCategoryAxis *m_categoriesAxis;
55 QBarCategoryAxis *m_categoriesAxis;
56 };
56 };
57
57
58 QT_CHARTS_END_NAMESPACE
58 QT_CHARTS_END_NAMESPACE
59
59
60 #endif /* CHARTBARCATEGORYAXISX_H */
60 #endif /* CHARTBARCATEGORYAXISX_H */
@@ -1,59 +1,59
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTBARCATEGORYAXISY_H
28 #ifndef CHARTBARCATEGORYAXISY_H
29 #define CHARTBARCATEGORYAXISY_H
29 #define CHARTBARCATEGORYAXISY_H
30
30
31 #include <private/verticalaxis_p.h>
31 #include <private/verticalaxis_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QBarCategoryAxis;
35 class QBarCategoryAxis;
36 class ChartPresenter;
36 class ChartPresenter;
37
37
38 class ChartBarCategoryAxisY : public VerticalAxis
38 class ChartBarCategoryAxisY : public VerticalAxis
39 {
39 {
40 Q_OBJECT
40 Q_OBJECT
41 public:
41 public:
42 ChartBarCategoryAxisY(QBarCategoryAxis *axis, QGraphicsItem* item = 0);
42 ChartBarCategoryAxisY(QBarCategoryAxis *axis, QGraphicsItem* item = 0);
43 ~ChartBarCategoryAxisY();
43 ~ChartBarCategoryAxisY();
44
44
45 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
45 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
46 protected:
46 protected:
47 QVector<qreal> calculateLayout() const;
47 QVector<qreal> calculateLayout() const;
48 void updateGeometry();
48 void updateGeometry();
49 private:
49 private:
50 QStringList createCategoryLabels(const QVector<qreal>& layout) const;
50 QStringList createCategoryLabels(const QVector<qreal>& layout) const;
51 public Q_SLOTS:
51 public Q_SLOTS:
52 void handleCategoriesChanged();
52 void handleCategoriesChanged();
53 private:
53 private:
54 QBarCategoryAxis *m_categoriesAxis;
54 QBarCategoryAxis *m_categoriesAxis;
55 };
55 };
56
56
57 QT_CHARTS_END_NAMESPACE
57 QT_CHARTS_END_NAMESPACE
58
58
59 #endif /* CHARTBARCATEGORYAXISY_H */
59 #endif /* CHARTBARCATEGORYAXISY_H */
@@ -1,79 +1,79
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QBARCATEGORYAXIS_P_H
28 #ifndef QBARCATEGORYAXIS_P_H
29 #define QBARCATEGORYAXIS_P_H
29 #define QBARCATEGORYAXIS_P_H
30
30
31 #include <QtCharts/QBarCategoryAxis>
31 #include <QtCharts/QBarCategoryAxis>
32 #include <private/qabstractaxis_p.h>
32 #include <private/qabstractaxis_p.h>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class AbstractDomain;
36 class AbstractDomain;
37
37
38 class QBarCategoryAxisPrivate : public QAbstractAxisPrivate
38 class QBarCategoryAxisPrivate : public QAbstractAxisPrivate
39 {
39 {
40 Q_OBJECT
40 Q_OBJECT
41
41
42 public:
42 public:
43 QBarCategoryAxisPrivate(QBarCategoryAxis *q);
43 QBarCategoryAxisPrivate(QBarCategoryAxis *q);
44 ~QBarCategoryAxisPrivate();
44 ~QBarCategoryAxisPrivate();
45
45
46 public:
46 public:
47 void initializeGraphics(QGraphicsItem* parent);
47 void initializeGraphics(QGraphicsItem* parent);
48 void initializeDomain(AbstractDomain *domain);
48 void initializeDomain(AbstractDomain *domain);
49 void updateCategoryDomain();
49 void updateCategoryDomain();
50
50
51 //interface for manipulating range form base class
51 //interface for manipulating range form base class
52 void setRange(const QVariant &min, const QVariant &max);
52 void setRange(const QVariant &min, const QVariant &max);
53 void setMin(const QVariant &min);
53 void setMin(const QVariant &min);
54 void setMax(const QVariant &max);
54 void setMax(const QVariant &max);
55
55
56 //interface manipulating range form domain
56 //interface manipulating range form domain
57 qreal min() { return m_min; }
57 qreal min() { return m_min; }
58 qreal max() { return m_max; }
58 qreal max() { return m_max; }
59 void setRange(qreal min,qreal max);
59 void setRange(qreal min,qreal max);
60
60
61 private:
61 private:
62 //range handling
62 //range handling
63 void setRange(const QString &minCategory, const QString &maxCategory);
63 void setRange(const QString &minCategory, const QString &maxCategory);
64
64
65 private:
65 private:
66 QStringList m_categories;
66 QStringList m_categories;
67 QString m_minCategory;
67 QString m_minCategory;
68 QString m_maxCategory;
68 QString m_maxCategory;
69 qreal m_min;
69 qreal m_min;
70 qreal m_max;
70 qreal m_max;
71 int m_count;
71 int m_count;
72
72
73 private:
73 private:
74 Q_DECLARE_PUBLIC(QBarCategoryAxis);
74 Q_DECLARE_PUBLIC(QBarCategoryAxis);
75 };
75 };
76
76
77 QT_CHARTS_END_NAMESPACE
77 QT_CHARTS_END_NAMESPACE
78
78
79 #endif // QBARCATEGORYAXIS_P_H
79 #endif // QBARCATEGORYAXIS_P_H
@@ -1,80 +1,80
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CARTESIANCHARTAXIS_H
28 #ifndef CARTESIANCHARTAXIS_H
29 #define CARTESIANCHARTAXIS_H
29 #define CARTESIANCHARTAXIS_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <private/chartaxiselement_p.h>
32 #include <private/chartaxiselement_p.h>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class QAbstractAxis;
36 class QAbstractAxis;
37
37
38 class CartesianChartAxis : public ChartAxisElement
38 class CartesianChartAxis : public ChartAxisElement
39 {
39 {
40 Q_OBJECT
40 Q_OBJECT
41 Q_INTERFACES(QGraphicsLayoutItem)
41 Q_INTERFACES(QGraphicsLayoutItem)
42 public:
42 public:
43
43
44 CartesianChartAxis(QAbstractAxis *axis, QGraphicsItem *item = 0, bool intervalAxis = false);
44 CartesianChartAxis(QAbstractAxis *axis, QGraphicsItem *item = 0, bool intervalAxis = false);
45 ~CartesianChartAxis();
45 ~CartesianChartAxis();
46
46
47 void setGeometry(const QRectF &axis, const QRectF &grid);
47 void setGeometry(const QRectF &axis, const QRectF &grid);
48 QRectF gridGeometry() const { return m_gridRect; }
48 QRectF gridGeometry() const { return m_gridRect; }
49 bool isEmpty();
49 bool isEmpty();
50
50
51 virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
51 virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
52
52
53 protected:
53 protected:
54 void setGeometry(const QRectF &size) { Q_UNUSED(size);}
54 void setGeometry(const QRectF &size) { Q_UNUSED(size);}
55 virtual void updateGeometry() = 0;
55 virtual void updateGeometry() = 0;
56 void updateLayout(QVector<qreal> &layout);
56 void updateLayout(QVector<qreal> &layout);
57
57
58 public Q_SLOTS:
58 public Q_SLOTS:
59 virtual void handleArrowPenChanged(const QPen &pen);
59 virtual void handleArrowPenChanged(const QPen &pen);
60 virtual void handleGridPenChanged(const QPen &pen);
60 virtual void handleGridPenChanged(const QPen &pen);
61 virtual void handleShadesBrushChanged(const QBrush &brush);
61 virtual void handleShadesBrushChanged(const QBrush &brush);
62 virtual void handleShadesPenChanged(const QPen &pen);
62 virtual void handleShadesPenChanged(const QPen &pen);
63 virtual void handleMinorArrowPenChanged(const QPen &pen);
63 virtual void handleMinorArrowPenChanged(const QPen &pen);
64 virtual void handleMinorGridPenChanged(const QPen &pen);
64 virtual void handleMinorGridPenChanged(const QPen &pen);
65
65
66 private:
66 private:
67 void createItems(int count);
67 void createItems(int count);
68 void deleteItems(int count);
68 void deleteItems(int count);
69 void updateMinorTickItems();
69 void updateMinorTickItems();
70
70
71 private:
71 private:
72 QRectF m_gridRect;
72 QRectF m_gridRect;
73
73
74 friend class AxisAnimation;
74 friend class AxisAnimation;
75 friend class LineArrowItem;
75 friend class LineArrowItem;
76 };
76 };
77
77
78 QT_CHARTS_END_NAMESPACE
78 QT_CHARTS_END_NAMESPACE
79
79
80 #endif /* CARTESIANCHARTAXIS_H */
80 #endif /* CARTESIANCHARTAXIS_H */
@@ -1,59 +1,59
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTCATEGORYAXISX_H
28 #ifndef CHARTCATEGORYAXISX_H
29 #define CHARTCATEGORYAXISX_H
29 #define CHARTCATEGORYAXISX_H
30
30
31 #include <private/horizontalaxis_p.h>
31 #include <private/horizontalaxis_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QCategoryAxis;
35 class QCategoryAxis;
36
36
37 class ChartCategoryAxisX : public HorizontalAxis
37 class ChartCategoryAxisX : public HorizontalAxis
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40 public:
40 public:
41 ChartCategoryAxisX(QCategoryAxis *axis, QGraphicsItem* item = 0);
41 ChartCategoryAxisX(QCategoryAxis *axis, QGraphicsItem* item = 0);
42 ~ChartCategoryAxisX();
42 ~ChartCategoryAxisX();
43
43
44 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
44 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
45
45
46 public Q_SLOTS:
46 public Q_SLOTS:
47 void handleCategoriesChanged();
47 void handleCategoriesChanged();
48
48
49 protected:
49 protected:
50 QVector<qreal> calculateLayout() const;
50 QVector<qreal> calculateLayout() const;
51 void updateGeometry();
51 void updateGeometry();
52
52
53 private:
53 private:
54 QCategoryAxis *m_axis;
54 QCategoryAxis *m_axis;
55 };
55 };
56
56
57 QT_CHARTS_END_NAMESPACE
57 QT_CHARTS_END_NAMESPACE
58
58
59 #endif /* CHARTCATEGORYAXISX_H */
59 #endif /* CHARTCATEGORYAXISX_H */
@@ -1,59 +1,59
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTCATEGORYAXISY_H
28 #ifndef CHARTCATEGORYAXISY_H
29 #define CHARTCATEGORYAXISY_H
29 #define CHARTCATEGORYAXISY_H
30
30
31 #include <private/verticalaxis_p.h>
31 #include <private/verticalaxis_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QCategoryAxis;
35 class QCategoryAxis;
36
36
37 class ChartCategoryAxisY : public VerticalAxis
37 class ChartCategoryAxisY : public VerticalAxis
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40 public:
40 public:
41 ChartCategoryAxisY(QCategoryAxis *axis, QGraphicsItem* item = 0);
41 ChartCategoryAxisY(QCategoryAxis *axis, QGraphicsItem* item = 0);
42 ~ChartCategoryAxisY();
42 ~ChartCategoryAxisY();
43
43
44 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
44 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
45
45
46 public Q_SLOTS:
46 public Q_SLOTS:
47 void handleCategoriesChanged();
47 void handleCategoriesChanged();
48
48
49 protected:
49 protected:
50 QVector<qreal> calculateLayout() const;
50 QVector<qreal> calculateLayout() const;
51 void updateGeometry();
51 void updateGeometry();
52
52
53 private:
53 private:
54 QCategoryAxis *m_axis;
54 QCategoryAxis *m_axis;
55 };
55 };
56
56
57 QT_CHARTS_END_NAMESPACE
57 QT_CHARTS_END_NAMESPACE
58
58
59 #endif /* CHARTCATEGORYAXISY_H */
59 #endif /* CHARTCATEGORYAXISY_H */
@@ -1,54 +1,54
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef POLARCHARTCATEGORYAXISANGULAR_P_H
28 #ifndef POLARCHARTCATEGORYAXISANGULAR_P_H
29 #define POLARCHARTCATEGORYAXISANGULAR_P_H
29 #define POLARCHARTCATEGORYAXISANGULAR_P_H
30
30
31 #include <private/polarchartaxisangular_p.h>
31 #include <private/polarchartaxisangular_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QCategoryAxis;
35 class QCategoryAxis;
36
36
37 class PolarChartCategoryAxisAngular : public PolarChartAxisAngular
37 class PolarChartCategoryAxisAngular : public PolarChartAxisAngular
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40
40
41 public:
41 public:
42 PolarChartCategoryAxisAngular(QCategoryAxis *axis, QGraphicsItem *item);
42 PolarChartCategoryAxisAngular(QCategoryAxis *axis, QGraphicsItem *item);
43 ~PolarChartCategoryAxisAngular();
43 ~PolarChartCategoryAxisAngular();
44
44
45 virtual QVector<qreal> calculateLayout() const;
45 virtual QVector<qreal> calculateLayout() const;
46 virtual void createAxisLabels(const QVector<qreal> &layout);
46 virtual void createAxisLabels(const QVector<qreal> &layout);
47
47
48 public Q_SLOTS:
48 public Q_SLOTS:
49 void handleCategoriesChanged();
49 void handleCategoriesChanged();
50 };
50 };
51
51
52 QT_CHARTS_END_NAMESPACE
52 QT_CHARTS_END_NAMESPACE
53
53
54 #endif // POLARCHARTCATEGORYAXISANGULAR_P_H
54 #endif // POLARCHARTCATEGORYAXISANGULAR_P_H
@@ -1,54 +1,54
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef POLARCHARTCATEGORYAXISRADIAL_P_H
28 #ifndef POLARCHARTCATEGORYAXISRADIAL_P_H
29 #define POLARCHARTCATEGORYAXISRADIAL_P_H
29 #define POLARCHARTCATEGORYAXISRADIAL_P_H
30
30
31 #include <private/polarchartaxisradial_p.h>
31 #include <private/polarchartaxisradial_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QCategoryAxis;
35 class QCategoryAxis;
36
36
37 class PolarChartCategoryAxisRadial : public PolarChartAxisRadial
37 class PolarChartCategoryAxisRadial : public PolarChartAxisRadial
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40
40
41 public:
41 public:
42 PolarChartCategoryAxisRadial(QCategoryAxis *axis, QGraphicsItem *item);
42 PolarChartCategoryAxisRadial(QCategoryAxis *axis, QGraphicsItem *item);
43 ~PolarChartCategoryAxisRadial();
43 ~PolarChartCategoryAxisRadial();
44
44
45 virtual QVector<qreal> calculateLayout() const;
45 virtual QVector<qreal> calculateLayout() const;
46 virtual void createAxisLabels(const QVector<qreal> &layout);
46 virtual void createAxisLabels(const QVector<qreal> &layout);
47
47
48 public Q_SLOTS:
48 public Q_SLOTS:
49 void handleCategoriesChanged();
49 void handleCategoriesChanged();
50 };
50 };
51
51
52 QT_CHARTS_END_NAMESPACE
52 QT_CHARTS_END_NAMESPACE
53
53
54 #endif // POLARCHARTCATEGORYAXISRADIAL_P_H
54 #endif // POLARCHARTCATEGORYAXISRADIAL_P_H
@@ -1,61 +1,61
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QCATEGORYAXIS_P_H
28 #ifndef QCATEGORYAXIS_P_H
29 #define QCATEGORYAXIS_P_H
29 #define QCATEGORYAXIS_P_H
30
30
31 #include <QtCharts/QCategoryAxis>
31 #include <QtCharts/QCategoryAxis>
32 #include <private/qvalueaxis_p.h>
32 #include <private/qvalueaxis_p.h>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 typedef QPair<qreal, qreal> Range;
36 typedef QPair<qreal, qreal> Range;
37
37
38 class QCategoryAxisPrivate : public QValueAxisPrivate
38 class QCategoryAxisPrivate : public QValueAxisPrivate
39 {
39 {
40 Q_OBJECT
40 Q_OBJECT
41
41
42 public:
42 public:
43 QCategoryAxisPrivate(QCategoryAxis *q);
43 QCategoryAxisPrivate(QCategoryAxis *q);
44 ~QCategoryAxisPrivate();
44 ~QCategoryAxisPrivate();
45
45
46 void initializeGraphics(QGraphicsItem* parent);
46 void initializeGraphics(QGraphicsItem* parent);
47 int ticksCount() const;
47 int ticksCount() const;
48
48
49 private:
49 private:
50 QMap<QString , Range> m_categoriesMap;
50 QMap<QString , Range> m_categoriesMap;
51 QStringList m_categories;
51 QStringList m_categories;
52 qreal m_categoryMinimum;
52 qreal m_categoryMinimum;
53 QCategoryAxis::AxisLabelsPosition m_labelsPosition;
53 QCategoryAxis::AxisLabelsPosition m_labelsPosition;
54
54
55 private:
55 private:
56 Q_DECLARE_PUBLIC(QCategoryAxis)
56 Q_DECLARE_PUBLIC(QCategoryAxis)
57 };
57 };
58
58
59 QT_CHARTS_END_NAMESPACE
59 QT_CHARTS_END_NAMESPACE
60
60
61 #endif // QCATEGORYAXIS_P_H
61 #endif // QCATEGORYAXIS_P_H
@@ -1,163 +1,163
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTAXISELEMENT_H
28 #ifndef CHARTAXISELEMENT_H
29 #define CHARTAXISELEMENT_H
29 #define CHARTAXISELEMENT_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <private/chartelement_p.h>
32 #include <private/chartelement_p.h>
33 #include <private/axisanimation_p.h>
33 #include <private/axisanimation_p.h>
34 #include <QtWidgets/QGraphicsItem>
34 #include <QtWidgets/QGraphicsItem>
35 #include <QtWidgets/QGraphicsLayoutItem>
35 #include <QtWidgets/QGraphicsLayoutItem>
36 #include <QtGui/QFont>
36 #include <QtGui/QFont>
37
37
38 QT_CHARTS_BEGIN_NAMESPACE
38 QT_CHARTS_BEGIN_NAMESPACE
39
39
40 class ChartPresenter;
40 class ChartPresenter;
41 class QAbstractAxis;
41 class QAbstractAxis;
42
42
43 class ChartAxisElement : public ChartElement, public QGraphicsLayoutItem
43 class ChartAxisElement : public ChartElement, public QGraphicsLayoutItem
44 {
44 {
45 Q_OBJECT
45 Q_OBJECT
46
46
47 using QGraphicsLayoutItem::setGeometry;
47 using QGraphicsLayoutItem::setGeometry;
48 public:
48 public:
49 ChartAxisElement(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis = false);
49 ChartAxisElement(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis = false);
50 ~ChartAxisElement();
50 ~ChartAxisElement();
51
51
52 virtual QRectF gridGeometry() const = 0;
52 virtual QRectF gridGeometry() const = 0;
53 virtual void setGeometry(const QRectF &axis, const QRectF &grid) = 0;
53 virtual void setGeometry(const QRectF &axis, const QRectF &grid) = 0;
54 virtual bool isEmpty() = 0;
54 virtual bool isEmpty() = 0;
55
55
56 void setAnimation(AxisAnimation *animation) { m_animation = animation; }
56 void setAnimation(AxisAnimation *animation) { m_animation = animation; }
57 AxisAnimation *animation() const { return m_animation; }
57 AxisAnimation *animation() const { return m_animation; }
58
58
59 QAbstractAxis *axis() const { return m_axis; }
59 QAbstractAxis *axis() const { return m_axis; }
60 void setLayout(QVector<qreal> &layout) { m_layout = layout; }
60 void setLayout(QVector<qreal> &layout) { m_layout = layout; }
61 QVector<qreal> &layout() { return m_layout; } // Modifiable reference
61 QVector<qreal> &layout() { return m_layout; } // Modifiable reference
62 inline qreal labelPadding() const { return qreal(4.0); }
62 inline qreal labelPadding() const { return qreal(4.0); }
63 inline qreal titlePadding() const { return qreal(2.0); }
63 inline qreal titlePadding() const { return qreal(2.0); }
64 void setLabels(const QStringList &labels) { m_labelsList = labels; }
64 void setLabels(const QStringList &labels) { m_labelsList = labels; }
65 QStringList labels() const { return m_labelsList; }
65 QStringList labels() const { return m_labelsList; }
66
66
67 qreal min() const;
67 qreal min() const;
68 qreal max() const;
68 qreal max() const;
69
69
70 QRectF axisGeometry() const { return m_axisRect; }
70 QRectF axisGeometry() const { return m_axisRect; }
71 void setAxisGeometry(const QRectF &axisGeometry) { m_axisRect = axisGeometry; }
71 void setAxisGeometry(const QRectF &axisGeometry) { m_axisRect = axisGeometry; }
72
72
73 void axisSelected();
73 void axisSelected();
74
74
75 //this flag indicates that axis is used to show intervals it means labels are in between ticks
75 //this flag indicates that axis is used to show intervals it means labels are in between ticks
76 bool intervalAxis() const { return m_intervalAxis; }
76 bool intervalAxis() const { return m_intervalAxis; }
77
77
78 QStringList createValueLabels(qreal max, qreal min, int ticks, const QString &format) const;
78 QStringList createValueLabels(qreal max, qreal min, int ticks, const QString &format) const;
79 QStringList createLogValueLabels(qreal min, qreal max, qreal base, int ticks,
79 QStringList createLogValueLabels(qreal min, qreal max, qreal base, int ticks,
80 const QString &format) const;
80 const QString &format) const;
81 QStringList createDateTimeLabels(qreal max, qreal min, int ticks, const QString &format) const;
81 QStringList createDateTimeLabels(qreal max, qreal min, int ticks, const QString &format) const;
82
82
83 // from QGraphicsLayoutItem
83 // from QGraphicsLayoutItem
84 QRectF boundingRect() const
84 QRectF boundingRect() const
85 {
85 {
86 return QRectF();
86 return QRectF();
87 }
87 }
88
88
89 // from QGraphicsLayoutItem
89 // from QGraphicsLayoutItem
90 void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*)
90 void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*)
91 {
91 {
92 }
92 }
93
93
94 protected:
94 protected:
95 virtual QVector<qreal> calculateLayout() const = 0;
95 virtual QVector<qreal> calculateLayout() const = 0;
96 virtual void updateLayout(QVector<qreal> &layout) = 0;
96 virtual void updateLayout(QVector<qreal> &layout) = 0;
97
97
98 QList<QGraphicsItem *> gridItems() { return m_grid->childItems(); }
98 QList<QGraphicsItem *> gridItems() { return m_grid->childItems(); }
99 QList<QGraphicsItem *> minorGridItems() { return m_minorGrid->childItems(); }
99 QList<QGraphicsItem *> minorGridItems() { return m_minorGrid->childItems(); }
100 QList<QGraphicsItem *> labelItems() { return m_labels->childItems(); }
100 QList<QGraphicsItem *> labelItems() { return m_labels->childItems(); }
101 QList<QGraphicsItem *> shadeItems() { return m_shades->childItems(); }
101 QList<QGraphicsItem *> shadeItems() { return m_shades->childItems(); }
102 QList<QGraphicsItem *> arrowItems() { return m_arrow->childItems(); }
102 QList<QGraphicsItem *> arrowItems() { return m_arrow->childItems(); }
103 QList<QGraphicsItem *> minorArrowItems() { return m_minorArrow->childItems(); }
103 QList<QGraphicsItem *> minorArrowItems() { return m_minorArrow->childItems(); }
104 QGraphicsTextItem *titleItem() const { return m_title.data(); }
104 QGraphicsTextItem *titleItem() const { return m_title.data(); }
105 QGraphicsItemGroup *gridGroup() { return m_grid.data(); }
105 QGraphicsItemGroup *gridGroup() { return m_grid.data(); }
106 QGraphicsItemGroup *minorGridGroup() { return m_minorGrid.data(); }
106 QGraphicsItemGroup *minorGridGroup() { return m_minorGrid.data(); }
107 QGraphicsItemGroup *labelGroup() { return m_labels.data(); }
107 QGraphicsItemGroup *labelGroup() { return m_labels.data(); }
108 QGraphicsItemGroup *shadeGroup() { return m_shades.data(); }
108 QGraphicsItemGroup *shadeGroup() { return m_shades.data(); }
109 QGraphicsItemGroup *arrowGroup() { return m_arrow.data(); }
109 QGraphicsItemGroup *arrowGroup() { return m_arrow.data(); }
110 QGraphicsItemGroup *minorArrowGroup() { return m_minorArrow.data(); }
110 QGraphicsItemGroup *minorArrowGroup() { return m_minorArrow.data(); }
111
111
112 public Q_SLOTS:
112 public Q_SLOTS:
113 void handleVisibleChanged(bool visible);
113 void handleVisibleChanged(bool visible);
114 void handleArrowVisibleChanged(bool visible);
114 void handleArrowVisibleChanged(bool visible);
115 void handleGridVisibleChanged(bool visible);
115 void handleGridVisibleChanged(bool visible);
116 void handleLabelsVisibleChanged(bool visible);
116 void handleLabelsVisibleChanged(bool visible);
117 void handleShadesVisibleChanged(bool visible);
117 void handleShadesVisibleChanged(bool visible);
118 void handleLabelsAngleChanged(int angle);
118 void handleLabelsAngleChanged(int angle);
119 virtual void handleShadesBrushChanged(const QBrush &brush) = 0;
119 virtual void handleShadesBrushChanged(const QBrush &brush) = 0;
120 virtual void handleShadesPenChanged(const QPen &pen) = 0;
120 virtual void handleShadesPenChanged(const QPen &pen) = 0;
121 virtual void handleArrowPenChanged(const QPen &pen) = 0;
121 virtual void handleArrowPenChanged(const QPen &pen) = 0;
122 virtual void handleGridPenChanged(const QPen &pen) = 0;
122 virtual void handleGridPenChanged(const QPen &pen) = 0;
123 virtual void handleMinorArrowPenChanged(const QPen &pen) = 0;
123 virtual void handleMinorArrowPenChanged(const QPen &pen) = 0;
124 virtual void handleMinorGridPenChanged(const QPen &pen) = 0;
124 virtual void handleMinorGridPenChanged(const QPen &pen) = 0;
125 void handleLabelsBrushChanged(const QBrush &brush);
125 void handleLabelsBrushChanged(const QBrush &brush);
126 void handleLabelsFontChanged(const QFont &font);
126 void handleLabelsFontChanged(const QFont &font);
127 void handleTitleBrushChanged(const QBrush &brush);
127 void handleTitleBrushChanged(const QBrush &brush);
128 void handleTitleFontChanged(const QFont &font);
128 void handleTitleFontChanged(const QFont &font);
129 void handleTitleTextChanged(const QString &title);
129 void handleTitleTextChanged(const QString &title);
130 void handleTitleVisibleChanged(bool visible);
130 void handleTitleVisibleChanged(bool visible);
131 void handleRangeChanged(qreal min, qreal max);
131 void handleRangeChanged(qreal min, qreal max);
132 void handleReverseChanged(bool reverse);
132 void handleReverseChanged(bool reverse);
133 void handleMinorArrowVisibleChanged(bool visible);
133 void handleMinorArrowVisibleChanged(bool visible);
134 void handleMinorGridVisibleChanged(bool visible);
134 void handleMinorGridVisibleChanged(bool visible);
135 void handleLabelsPositionChanged();
135 void handleLabelsPositionChanged();
136
136
137 Q_SIGNALS:
137 Q_SIGNALS:
138 void clicked();
138 void clicked();
139
139
140 private:
140 private:
141 void connectSlots();
141 void connectSlots();
142 QString formatLabel(const QString &formatSpec, const QByteArray &array,
142 QString formatLabel(const QString &formatSpec, const QByteArray &array,
143 qreal value, int precision, const QString &preStr,
143 qreal value, int precision, const QString &preStr,
144 const QString &postStr) const;
144 const QString &postStr) const;
145
145
146 QAbstractAxis *m_axis;
146 QAbstractAxis *m_axis;
147 AxisAnimation *m_animation;
147 AxisAnimation *m_animation;
148 QVector<qreal> m_layout;
148 QVector<qreal> m_layout;
149 QStringList m_labelsList;
149 QStringList m_labelsList;
150 QRectF m_axisRect;
150 QRectF m_axisRect;
151 QScopedPointer<QGraphicsItemGroup> m_grid;
151 QScopedPointer<QGraphicsItemGroup> m_grid;
152 QScopedPointer<QGraphicsItemGroup> m_arrow;
152 QScopedPointer<QGraphicsItemGroup> m_arrow;
153 QScopedPointer<QGraphicsItemGroup> m_minorGrid;
153 QScopedPointer<QGraphicsItemGroup> m_minorGrid;
154 QScopedPointer<QGraphicsItemGroup> m_minorArrow;
154 QScopedPointer<QGraphicsItemGroup> m_minorArrow;
155 QScopedPointer<QGraphicsItemGroup> m_shades;
155 QScopedPointer<QGraphicsItemGroup> m_shades;
156 QScopedPointer<QGraphicsItemGroup> m_labels;
156 QScopedPointer<QGraphicsItemGroup> m_labels;
157 QScopedPointer<QGraphicsTextItem> m_title;
157 QScopedPointer<QGraphicsTextItem> m_title;
158 bool m_intervalAxis;
158 bool m_intervalAxis;
159 };
159 };
160
160
161 QT_CHARTS_END_NAMESPACE
161 QT_CHARTS_END_NAMESPACE
162
162
163 #endif /* CHARTAXISELEMENT_H */
163 #endif /* CHARTAXISELEMENT_H */
@@ -1,58 +1,58
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTDATETIMEAXISX_H
28 #ifndef CHARTDATETIMEAXISX_H
29 #define CHARTDATETIMEAXISX_H
29 #define CHARTDATETIMEAXISX_H
30
30
31 #include <private/horizontalaxis_p.h>
31 #include <private/horizontalaxis_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QDateTimeAxis;
35 class QDateTimeAxis;
36
36
37 class ChartDateTimeAxisX : public HorizontalAxis
37 class ChartDateTimeAxisX : public HorizontalAxis
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40 public:
40 public:
41 ChartDateTimeAxisX(QDateTimeAxis *axis, QGraphicsItem* item = 0);
41 ChartDateTimeAxisX(QDateTimeAxis *axis, QGraphicsItem* item = 0);
42 ~ChartDateTimeAxisX();
42 ~ChartDateTimeAxisX();
43
43
44 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
44 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
45 protected:
45 protected:
46 QVector<qreal> calculateLayout() const;
46 QVector<qreal> calculateLayout() const;
47 void updateGeometry();
47 void updateGeometry();
48 private Q_SLOTS:
48 private Q_SLOTS:
49 void handleTickCountChanged(int tick);
49 void handleTickCountChanged(int tick);
50 void handleFormatChanged(const QString &format);
50 void handleFormatChanged(const QString &format);
51
51
52 private:
52 private:
53 QDateTimeAxis *m_axis;
53 QDateTimeAxis *m_axis;
54 };
54 };
55
55
56 QT_CHARTS_END_NAMESPACE
56 QT_CHARTS_END_NAMESPACE
57
57
58 #endif /* CHARTDATETIMEAXISX_H */
58 #endif /* CHARTDATETIMEAXISX_H */
@@ -1,58 +1,58
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTDATETIMEAXISY_H
28 #ifndef CHARTDATETIMEAXISY_H
29 #define CHARTDATETIMEAXISY_H
29 #define CHARTDATETIMEAXISY_H
30
30
31 #include <private/verticalaxis_p.h>
31 #include <private/verticalaxis_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QDateTimeAxis;
35 class QDateTimeAxis;
36
36
37 class ChartDateTimeAxisY : public VerticalAxis
37 class ChartDateTimeAxisY : public VerticalAxis
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40 public:
40 public:
41 ChartDateTimeAxisY(QDateTimeAxis *axis, QGraphicsItem* item = 0);
41 ChartDateTimeAxisY(QDateTimeAxis *axis, QGraphicsItem* item = 0);
42 ~ChartDateTimeAxisY();
42 ~ChartDateTimeAxisY();
43
43
44 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
44 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
45 protected:
45 protected:
46 QVector<qreal> calculateLayout() const;
46 QVector<qreal> calculateLayout() const;
47 void updateGeometry();
47 void updateGeometry();
48 private Q_SLOTS:
48 private Q_SLOTS:
49 void handleTickCountChanged(int tick);
49 void handleTickCountChanged(int tick);
50 void handleFormatChanged(const QString &format);
50 void handleFormatChanged(const QString &format);
51
51
52 private:
52 private:
53 QDateTimeAxis *m_axis;
53 QDateTimeAxis *m_axis;
54 };
54 };
55
55
56 QT_CHARTS_END_NAMESPACE
56 QT_CHARTS_END_NAMESPACE
57
57
58 #endif /* CHARTDATETIMEAXISY_H */
58 #endif /* CHARTDATETIMEAXISY_H */
@@ -1,54 +1,54
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef POLARCHARTDATETIMEAXISANGULAR_P_H
28 #ifndef POLARCHARTDATETIMEAXISANGULAR_P_H
29 #define POLARCHARTDATETIMEAXISANGULAR_P_H
29 #define POLARCHARTDATETIMEAXISANGULAR_P_H
30
30
31 #include <private/polarchartaxisangular_p.h>
31 #include <private/polarchartaxisangular_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QDateTimeAxis;
35 class QDateTimeAxis;
36
36
37 class PolarChartDateTimeAxisAngular : public PolarChartAxisAngular
37 class PolarChartDateTimeAxisAngular : public PolarChartAxisAngular
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40 public:
40 public:
41 PolarChartDateTimeAxisAngular(QDateTimeAxis *axis, QGraphicsItem *item);
41 PolarChartDateTimeAxisAngular(QDateTimeAxis *axis, QGraphicsItem *item);
42 ~PolarChartDateTimeAxisAngular();
42 ~PolarChartDateTimeAxisAngular();
43
43
44 virtual QVector<qreal> calculateLayout() const;
44 virtual QVector<qreal> calculateLayout() const;
45 virtual void createAxisLabels(const QVector<qreal> &layout);
45 virtual void createAxisLabels(const QVector<qreal> &layout);
46
46
47 private Q_SLOTS:
47 private Q_SLOTS:
48 void handleTickCountChanged(int tick);
48 void handleTickCountChanged(int tick);
49 void handleFormatChanged(const QString &format);
49 void handleFormatChanged(const QString &format);
50 };
50 };
51
51
52 QT_CHARTS_END_NAMESPACE
52 QT_CHARTS_END_NAMESPACE
53
53
54 #endif // POLARCHARTDATETIMEAXISANGULAR_P_H
54 #endif // POLARCHARTDATETIMEAXISANGULAR_P_H
@@ -1,54 +1,54
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef POLARCHARTDATETIMEAXISRADIAL_P_H
28 #ifndef POLARCHARTDATETIMEAXISRADIAL_P_H
29 #define POLARCHARTDATETIMEAXISRADIAL_P_H
29 #define POLARCHARTDATETIMEAXISRADIAL_P_H
30
30
31 #include <private/polarchartaxisradial_p.h>
31 #include <private/polarchartaxisradial_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QDateTimeAxis;
35 class QDateTimeAxis;
36
36
37 class PolarChartDateTimeAxisRadial : public PolarChartAxisRadial
37 class PolarChartDateTimeAxisRadial : public PolarChartAxisRadial
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40 public:
40 public:
41 PolarChartDateTimeAxisRadial(QDateTimeAxis *axis, QGraphicsItem *item);
41 PolarChartDateTimeAxisRadial(QDateTimeAxis *axis, QGraphicsItem *item);
42 ~PolarChartDateTimeAxisRadial();
42 ~PolarChartDateTimeAxisRadial();
43
43
44 virtual QVector<qreal> calculateLayout() const;
44 virtual QVector<qreal> calculateLayout() const;
45 virtual void createAxisLabels(const QVector<qreal> &layout);
45 virtual void createAxisLabels(const QVector<qreal> &layout);
46
46
47 private Q_SLOTS:
47 private Q_SLOTS:
48 void handleTickCountChanged(int tick);
48 void handleTickCountChanged(int tick);
49 void handleFormatChanged(const QString &format);
49 void handleFormatChanged(const QString &format);
50 };
50 };
51
51
52 QT_CHARTS_END_NAMESPACE
52 QT_CHARTS_END_NAMESPACE
53
53
54 #endif // POLARCHARTDATETIMEAXISRADIAL_P_H
54 #endif // POLARCHARTDATETIMEAXISRADIAL_P_H
@@ -1,71 +1,71
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QDATETIMEAXIS_P_H
28 #ifndef QDATETIMEAXIS_P_H
29 #define QDATETIMEAXIS_P_H
29 #define QDATETIMEAXIS_P_H
30
30
31 #include <QtCharts/QDateTimeAxis>
31 #include <QtCharts/QDateTimeAxis>
32 #include <private/qabstractaxis_p.h>
32 #include <private/qabstractaxis_p.h>
33 #include <QtCore/QDateTime>
33 #include <QtCore/QDateTime>
34
34
35 QT_CHARTS_BEGIN_NAMESPACE
35 QT_CHARTS_BEGIN_NAMESPACE
36
36
37 class QDateTimeAxisPrivate : public QAbstractAxisPrivate
37 class QDateTimeAxisPrivate : public QAbstractAxisPrivate
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40 public:
40 public:
41 QDateTimeAxisPrivate(QDateTimeAxis *q);
41 QDateTimeAxisPrivate(QDateTimeAxis *q);
42 ~QDateTimeAxisPrivate();
42 ~QDateTimeAxisPrivate();
43
43
44 public:
44 public:
45 void initializeGraphics(QGraphicsItem* parent);
45 void initializeGraphics(QGraphicsItem* parent);
46 void initializeDomain(AbstractDomain *domain);
46 void initializeDomain(AbstractDomain *domain);
47
47
48 //interface for manipulating range form base class
48 //interface for manipulating range form base class
49 void setMin(const QVariant &min);
49 void setMin(const QVariant &min);
50 void setMax(const QVariant &max);
50 void setMax(const QVariant &max);
51 void setRange(const QVariant &min, const QVariant &max);
51 void setRange(const QVariant &min, const QVariant &max);
52
52
53 //interface manipulating range form domain
53 //interface manipulating range form domain
54 qreal min() { return m_min; }
54 qreal min() { return m_min; }
55 qreal max() { return m_max; }
55 qreal max() { return m_max; }
56 void setRange(qreal min,qreal max);
56 void setRange(qreal min,qreal max);
57
57
58 protected:
58 protected:
59 int tickCount() const;
59 int tickCount() const;
60
60
61 protected:
61 protected:
62 qreal m_min;
62 qreal m_min;
63 qreal m_max;
63 qreal m_max;
64 int m_tickCount;
64 int m_tickCount;
65 QString m_format;
65 QString m_format;
66 Q_DECLARE_PUBLIC(QDateTimeAxis)
66 Q_DECLARE_PUBLIC(QDateTimeAxis)
67 };
67 };
68
68
69 QT_CHARTS_END_NAMESPACE
69 QT_CHARTS_END_NAMESPACE
70
70
71 #endif // QDATETIMEAXIS_P_H
71 #endif // QDATETIMEAXIS_P_H
@@ -1,48 +1,48
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef HORIZONTALAXIS_P_H_
28 #ifndef HORIZONTALAXIS_P_H_
29 #define HORIZONTALAXIS_P_H_
29 #define HORIZONTALAXIS_P_H_
30
30
31 #include <private/cartesianchartaxis_p.h>
31 #include <private/cartesianchartaxis_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class HorizontalAxis : public CartesianChartAxis
35 class HorizontalAxis : public CartesianChartAxis
36 {
36 {
37 public:
37 public:
38 HorizontalAxis(QAbstractAxis *axis, QGraphicsItem *item = 0, bool intervalAxis = false);
38 HorizontalAxis(QAbstractAxis *axis, QGraphicsItem *item = 0, bool intervalAxis = false);
39 ~HorizontalAxis();
39 ~HorizontalAxis();
40 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
40 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
41 protected:
41 protected:
42 void updateGeometry();
42 void updateGeometry();
43
43
44 };
44 };
45
45
46 QT_CHARTS_END_NAMESPACE
46 QT_CHARTS_END_NAMESPACE
47
47
48 #endif
48 #endif
@@ -1,74 +1,74
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef LINEARROWITEM_P_H
28 #ifndef LINEARROWITEM_P_H
29 #define LINEARROWITEM_P_H
29 #define LINEARROWITEM_P_H
30
30
31 #include <private/chartaxiselement_p.h>
31 #include <private/chartaxiselement_p.h>
32 #include <private/qabstractaxis_p.h>
32 #include <private/qabstractaxis_p.h>
33 #include <QtWidgets/QGraphicsLineItem>
33 #include <QtWidgets/QGraphicsLineItem>
34
34
35 QT_CHARTS_BEGIN_NAMESPACE
35 QT_CHARTS_BEGIN_NAMESPACE
36
36
37 class LineArrowItem: public QGraphicsLineItem
37 class LineArrowItem: public QGraphicsLineItem
38 {
38 {
39 public:
39 public:
40 explicit LineArrowItem(ChartAxisElement *axis, QGraphicsItem *parent = 0)
40 explicit LineArrowItem(ChartAxisElement *axis, QGraphicsItem *parent = 0)
41 : QGraphicsLineItem(parent),
41 : QGraphicsLineItem(parent),
42 m_axis(axis),
42 m_axis(axis),
43 m_axisOrientation(axis->axis()->orientation())
43 m_axisOrientation(axis->axis()->orientation())
44 {
44 {
45 }
45 }
46
46
47 protected:
47 protected:
48 void mousePressEvent(QGraphicsSceneMouseEvent *event)
48 void mousePressEvent(QGraphicsSceneMouseEvent *event)
49 {
49 {
50 Q_UNUSED(event)
50 Q_UNUSED(event)
51 m_axis->axisSelected();
51 m_axis->axisSelected();
52 }
52 }
53
53
54 QRectF boundingRect() const
54 QRectF boundingRect() const
55 {
55 {
56 return shape().boundingRect();
56 return shape().boundingRect();
57 }
57 }
58
58
59 QPainterPath shape() const
59 QPainterPath shape() const
60 {
60 {
61 QPainterPath path = QGraphicsLineItem::shape();
61 QPainterPath path = QGraphicsLineItem::shape();
62 QRectF rect = path.boundingRect();
62 QRectF rect = path.boundingRect();
63 path.addRect(rect.adjusted(0, 0, m_axisOrientation != Qt::Horizontal ? 8 : 0, m_axisOrientation != Qt::Vertical ? 8 : 0));
63 path.addRect(rect.adjusted(0, 0, m_axisOrientation != Qt::Horizontal ? 8 : 0, m_axisOrientation != Qt::Vertical ? 8 : 0));
64 return path;
64 return path;
65 }
65 }
66
66
67 private:
67 private:
68 ChartAxisElement *m_axis;
68 ChartAxisElement *m_axis;
69 Qt::Orientation m_axisOrientation;
69 Qt::Orientation m_axisOrientation;
70 };
70 };
71
71
72 QT_CHARTS_END_NAMESPACE
72 QT_CHARTS_END_NAMESPACE
73
73
74 #endif /* LINEARROWITEM_P_H */
74 #endif /* LINEARROWITEM_P_H */
@@ -1,61 +1,61
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTLOGVALUEAXISX_H
28 #ifndef CHARTLOGVALUEAXISX_H
29 #define CHARTLOGVALUEAXISX_H
29 #define CHARTLOGVALUEAXISX_H
30
30
31 #include <private/horizontalaxis_p.h>
31 #include <private/horizontalaxis_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QLogValueAxis;
35 class QLogValueAxis;
36
36
37 class ChartLogValueAxisX : public HorizontalAxis
37 class ChartLogValueAxisX : public HorizontalAxis
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40
40
41 public:
41 public:
42 ChartLogValueAxisX(QLogValueAxis *axis, QGraphicsItem *item);
42 ChartLogValueAxisX(QLogValueAxis *axis, QGraphicsItem *item);
43 ~ChartLogValueAxisX();
43 ~ChartLogValueAxisX();
44
44
45 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
45 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
46
46
47 protected:
47 protected:
48 QVector<qreal> calculateLayout() const;
48 QVector<qreal> calculateLayout() const;
49 void updateGeometry();
49 void updateGeometry();
50
50
51 private Q_SLOTS:
51 private Q_SLOTS:
52 void handleBaseChanged(qreal base);
52 void handleBaseChanged(qreal base);
53 void handleLabelFormatChanged(const QString &format);
53 void handleLabelFormatChanged(const QString &format);
54
54
55 private:
55 private:
56 QLogValueAxis *m_axis;
56 QLogValueAxis *m_axis;
57 };
57 };
58
58
59 QT_CHARTS_END_NAMESPACE
59 QT_CHARTS_END_NAMESPACE
60
60
61 #endif /* CHARTLOGVALUEAXISX_H */
61 #endif /* CHARTLOGVALUEAXISX_H */
@@ -1,61 +1,61
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTLOGVALUEAXISY_H
28 #ifndef CHARTLOGVALUEAXISY_H
29 #define CHARTLOGVALUEAXISY_H
29 #define CHARTLOGVALUEAXISY_H
30
30
31 #include <private/verticalaxis_p.h>
31 #include <private/verticalaxis_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QLogValueAxis;
35 class QLogValueAxis;
36
36
37 class ChartLogValueAxisY : public VerticalAxis
37 class ChartLogValueAxisY : public VerticalAxis
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40
40
41 public:
41 public:
42 ChartLogValueAxisY(QLogValueAxis *axis, QGraphicsItem *item);
42 ChartLogValueAxisY(QLogValueAxis *axis, QGraphicsItem *item);
43 ~ChartLogValueAxisY();
43 ~ChartLogValueAxisY();
44
44
45 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
45 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
46
46
47 protected:
47 protected:
48 QVector<qreal> calculateLayout() const;
48 QVector<qreal> calculateLayout() const;
49 void updateGeometry();
49 void updateGeometry();
50
50
51 private Q_SLOTS:
51 private Q_SLOTS:
52 void handleBaseChanged(qreal base);
52 void handleBaseChanged(qreal base);
53 void handleLabelFormatChanged(const QString &format);
53 void handleLabelFormatChanged(const QString &format);
54
54
55 private:
55 private:
56 QLogValueAxis *m_axis;
56 QLogValueAxis *m_axis;
57 };
57 };
58
58
59 QT_CHARTS_END_NAMESPACE
59 QT_CHARTS_END_NAMESPACE
60
60
61 #endif /* CHARTLOGVALUEAXISY_H */
61 #endif /* CHARTLOGVALUEAXISY_H */
@@ -1,55 +1,55
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef POLARCHARTLOGVALUEAXISANGULAR_P_H
28 #ifndef POLARCHARTLOGVALUEAXISANGULAR_P_H
29 #define POLARCHARTLOGVALUEAXISANGULAR_P_H
29 #define POLARCHARTLOGVALUEAXISANGULAR_P_H
30
30
31 #include <private/polarchartaxisangular_p.h>
31 #include <private/polarchartaxisangular_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QLogValueAxis;
35 class QLogValueAxis;
36
36
37 class PolarChartLogValueAxisAngular : public PolarChartAxisAngular
37 class PolarChartLogValueAxisAngular : public PolarChartAxisAngular
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40 public:
40 public:
41 PolarChartLogValueAxisAngular(QLogValueAxis *axis, QGraphicsItem *item);
41 PolarChartLogValueAxisAngular(QLogValueAxis *axis, QGraphicsItem *item);
42 ~PolarChartLogValueAxisAngular();
42 ~PolarChartLogValueAxisAngular();
43
43
44 protected:
44 protected:
45 virtual QVector<qreal> calculateLayout() const;
45 virtual QVector<qreal> calculateLayout() const;
46 virtual void createAxisLabels(const QVector<qreal> &layout);
46 virtual void createAxisLabels(const QVector<qreal> &layout);
47
47
48 private Q_SLOTS:
48 private Q_SLOTS:
49 void handleBaseChanged(qreal base);
49 void handleBaseChanged(qreal base);
50 void handleLabelFormatChanged(const QString &format);
50 void handleLabelFormatChanged(const QString &format);
51 };
51 };
52
52
53 QT_CHARTS_END_NAMESPACE
53 QT_CHARTS_END_NAMESPACE
54
54
55 #endif // POLARCHARTLOGVALUEAXISANGULAR_P_H
55 #endif // POLARCHARTLOGVALUEAXISANGULAR_P_H
@@ -1,55 +1,55
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef POLARCHARTLOGVALUEAXISRADIAL_P_H
28 #ifndef POLARCHARTLOGVALUEAXISRADIAL_P_H
29 #define POLARCHARTLOGVALUEAXISRADIAL_P_H
29 #define POLARCHARTLOGVALUEAXISRADIAL_P_H
30
30
31 #include <private/polarchartaxisradial_p.h>
31 #include <private/polarchartaxisradial_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QLogValueAxis;
35 class QLogValueAxis;
36
36
37 class PolarChartLogValueAxisRadial : public PolarChartAxisRadial
37 class PolarChartLogValueAxisRadial : public PolarChartAxisRadial
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40 public:
40 public:
41 PolarChartLogValueAxisRadial(QLogValueAxis *axis, QGraphicsItem *item);
41 PolarChartLogValueAxisRadial(QLogValueAxis *axis, QGraphicsItem *item);
42 ~PolarChartLogValueAxisRadial();
42 ~PolarChartLogValueAxisRadial();
43
43
44 protected:
44 protected:
45 virtual QVector<qreal> calculateLayout() const;
45 virtual QVector<qreal> calculateLayout() const;
46 virtual void createAxisLabels(const QVector<qreal> &layout);
46 virtual void createAxisLabels(const QVector<qreal> &layout);
47
47
48 private Q_SLOTS:
48 private Q_SLOTS:
49 void handleBaseChanged(qreal base);
49 void handleBaseChanged(qreal base);
50 void handleLabelFormatChanged(const QString &format);
50 void handleLabelFormatChanged(const QString &format);
51 };
51 };
52
52
53 QT_CHARTS_END_NAMESPACE
53 QT_CHARTS_END_NAMESPACE
54
54
55 #endif // POLARCHARTLOGVALUEAXISRADIAL_P_H
55 #endif // POLARCHARTLOGVALUEAXISRADIAL_P_H
@@ -1,67 +1,67
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QLOGVALUEAXIS_P_H
28 #ifndef QLOGVALUEAXIS_P_H
29 #define QLOGVALUEAXIS_P_H
29 #define QLOGVALUEAXIS_P_H
30
30
31 #include <QtCharts/QLogValueAxis>
31 #include <QtCharts/QLogValueAxis>
32 #include <private/qabstractaxis_p.h>
32 #include <private/qabstractaxis_p.h>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class QLogValueAxisPrivate : public QAbstractAxisPrivate
36 class QLogValueAxisPrivate : public QAbstractAxisPrivate
37 {
37 {
38 Q_OBJECT
38 Q_OBJECT
39 public:
39 public:
40 QLogValueAxisPrivate(QLogValueAxis *q);
40 QLogValueAxisPrivate(QLogValueAxis *q);
41 ~QLogValueAxisPrivate();
41 ~QLogValueAxisPrivate();
42
42
43 public:
43 public:
44 void initializeGraphics(QGraphicsItem* parent);
44 void initializeGraphics(QGraphicsItem* parent);
45 void initializeDomain(AbstractDomain *domain);
45 void initializeDomain(AbstractDomain *domain);
46
46
47 qreal min() { return m_min; }
47 qreal min() { return m_min; }
48 qreal max() { return m_max; }
48 qreal max() { return m_max; }
49 void setRange(qreal min,qreal max);
49 void setRange(qreal min,qreal max);
50
50
51 protected:
51 protected:
52 void setMin(const QVariant &min);
52 void setMin(const QVariant &min);
53 void setMax(const QVariant &max);
53 void setMax(const QVariant &max);
54 void setRange(const QVariant &min, const QVariant &max);
54 void setRange(const QVariant &min, const QVariant &max);
55 int tickCount() const;
55 int tickCount() const;
56
56
57 protected:
57 protected:
58 qreal m_min;
58 qreal m_min;
59 qreal m_max;
59 qreal m_max;
60 qreal m_base;
60 qreal m_base;
61 QString m_format;
61 QString m_format;
62 Q_DECLARE_PUBLIC(QLogValueAxis)
62 Q_DECLARE_PUBLIC(QLogValueAxis)
63 };
63 };
64
64
65 QT_CHARTS_END_NAMESPACE
65 QT_CHARTS_END_NAMESPACE
66
66
67 #endif // QLOGVALUEAXIS_P_H
67 #endif // QLOGVALUEAXIS_P_H
@@ -1,69 +1,69
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef POLARCHARTAXIS_P_H
28 #ifndef POLARCHARTAXIS_P_H
29 #define POLARCHARTAXIS_P_H
29 #define POLARCHARTAXIS_P_H
30
30
31 #include <private/chartaxiselement_p.h>
31 #include <private/chartaxiselement_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class PolarChartAxis : public ChartAxisElement
35 class PolarChartAxis : public ChartAxisElement
36 {
36 {
37 Q_OBJECT
37 Q_OBJECT
38 Q_INTERFACES(QGraphicsLayoutItem)
38 Q_INTERFACES(QGraphicsLayoutItem)
39 public:
39 public:
40 PolarChartAxis(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis = false);
40 PolarChartAxis(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis = false);
41 ~PolarChartAxis();
41 ~PolarChartAxis();
42
42
43 void setGeometry(const QRectF &axis, const QRectF &grid);
43 void setGeometry(const QRectF &axis, const QRectF &grid);
44 virtual qreal preferredAxisRadius(const QSizeF &maxSize) = 0;
44 virtual qreal preferredAxisRadius(const QSizeF &maxSize) = 0;
45 int tickWidth() { return 3; }
45 int tickWidth() { return 3; }
46
46
47 public: // from ChartAxisElement
47 public: // from ChartAxisElement
48 QRectF gridGeometry() const;
48 QRectF gridGeometry() const;
49 bool isEmpty();
49 bool isEmpty();
50
50
51 protected:
51 protected:
52 void updateLayout(QVector<qreal> &layout);
52 void updateLayout(QVector<qreal> &layout);
53
53
54 protected: // virtual functions
54 protected: // virtual functions
55 virtual void createItems(int count) = 0;
55 virtual void createItems(int count) = 0;
56 virtual void createAxisLabels(const QVector<qreal> &layout) = 0;
56 virtual void createAxisLabels(const QVector<qreal> &layout) = 0;
57 virtual void updateMinorTickItems() = 0;
57 virtual void updateMinorTickItems() = 0;
58
58
59 public Q_SLOTS:
59 public Q_SLOTS:
60 virtual void handleShadesBrushChanged(const QBrush &brush);
60 virtual void handleShadesBrushChanged(const QBrush &brush);
61 virtual void handleShadesPenChanged(const QPen &pen);
61 virtual void handleShadesPenChanged(const QPen &pen);
62
62
63 private:
63 private:
64 void deleteItems(int count);
64 void deleteItems(int count);
65 };
65 };
66
66
67 QT_CHARTS_END_NAMESPACE
67 QT_CHARTS_END_NAMESPACE
68
68
69 #endif // POLARCHARTAXIS_P_H
69 #endif // POLARCHARTAXIS_P_H
@@ -1,64 +1,64
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef POLARCHARTAXISANGULAR_P_H
28 #ifndef POLARCHARTAXISANGULAR_P_H
29 #define POLARCHARTAXISANGULAR_P_H
29 #define POLARCHARTAXISANGULAR_P_H
30
30
31 #include <private/polarchartaxis_p.h>
31 #include <private/polarchartaxis_p.h>
32 #include <QtCharts/QValueAxis>
32 #include <QtCharts/QValueAxis>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class PolarChartAxisAngular : public PolarChartAxis
36 class PolarChartAxisAngular : public PolarChartAxis
37 {
37 {
38 Q_OBJECT
38 Q_OBJECT
39 public:
39 public:
40 PolarChartAxisAngular(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis = false);
40 PolarChartAxisAngular(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis = false);
41 ~PolarChartAxisAngular();
41 ~PolarChartAxisAngular();
42
42
43 Qt::Orientation orientation() const;
43 Qt::Orientation orientation() const;
44 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
44 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
45
45
46 virtual void updateGeometry();
46 virtual void updateGeometry();
47 virtual void createItems(int count);
47 virtual void createItems(int count);
48 virtual void updateMinorTickItems();
48 virtual void updateMinorTickItems();
49
49
50 qreal preferredAxisRadius(const QSizeF &maxSize);
50 qreal preferredAxisRadius(const QSizeF &maxSize);
51
51
52 public Q_SLOTS:
52 public Q_SLOTS:
53 virtual void handleArrowPenChanged(const QPen &pen);
53 virtual void handleArrowPenChanged(const QPen &pen);
54 virtual void handleGridPenChanged(const QPen &pen);
54 virtual void handleGridPenChanged(const QPen &pen);
55 virtual void handleMinorArrowPenChanged(const QPen &pen);
55 virtual void handleMinorArrowPenChanged(const QPen &pen);
56 virtual void handleMinorGridPenChanged(const QPen &pen);
56 virtual void handleMinorGridPenChanged(const QPen &pen);
57
57
58 private:
58 private:
59 QRectF moveLabelToPosition(qreal angularCoordinate, QPointF labelPoint, QRectF labelRect) const;
59 QRectF moveLabelToPosition(qreal angularCoordinate, QPointF labelPoint, QRectF labelRect) const;
60 };
60 };
61
61
62 QT_CHARTS_END_NAMESPACE
62 QT_CHARTS_END_NAMESPACE
63
63
64 #endif // POLARCHARTAXISANGULAR_P_H
64 #endif // POLARCHARTAXISANGULAR_P_H
@@ -1,61 +1,61
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef POLARCHARTAXISRADIAL_P_H
28 #ifndef POLARCHARTAXISRADIAL_P_H
29 #define POLARCHARTAXISRADIAL_P_H
29 #define POLARCHARTAXISRADIAL_P_H
30
30
31 #include <private/polarchartaxis_p.h>
31 #include <private/polarchartaxis_p.h>
32 #include <QtCharts/QValueAxis>
32 #include <QtCharts/QValueAxis>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class PolarChartAxisRadial : public PolarChartAxis
36 class PolarChartAxisRadial : public PolarChartAxis
37 {
37 {
38 Q_OBJECT
38 Q_OBJECT
39 public:
39 public:
40 PolarChartAxisRadial(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis = false);
40 PolarChartAxisRadial(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis = false);
41 ~PolarChartAxisRadial();
41 ~PolarChartAxisRadial();
42
42
43 Qt::Orientation orientation() const;
43 Qt::Orientation orientation() const;
44 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
44 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
45
45
46 virtual void updateGeometry();
46 virtual void updateGeometry();
47 virtual void createItems(int count);
47 virtual void createItems(int count);
48 virtual void updateMinorTickItems();
48 virtual void updateMinorTickItems();
49
49
50 qreal preferredAxisRadius(const QSizeF &maxSize);
50 qreal preferredAxisRadius(const QSizeF &maxSize);
51
51
52 public Q_SLOTS:
52 public Q_SLOTS:
53 virtual void handleArrowPenChanged(const QPen &pen);
53 virtual void handleArrowPenChanged(const QPen &pen);
54 virtual void handleGridPenChanged(const QPen &pen);
54 virtual void handleGridPenChanged(const QPen &pen);
55 virtual void handleMinorArrowPenChanged(const QPen &pen);
55 virtual void handleMinorArrowPenChanged(const QPen &pen);
56 virtual void handleMinorGridPenChanged(const QPen &pen);
56 virtual void handleMinorGridPenChanged(const QPen &pen);
57 };
57 };
58
58
59 QT_CHARTS_END_NAMESPACE
59 QT_CHARTS_END_NAMESPACE
60
60
61 #endif // POLARCHARTAXISRADIAL_P_H
61 #endif // POLARCHARTAXISRADIAL_P_H
@@ -1,133 +1,133
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QABSTRACTAXIS_P_H
28 #ifndef QABSTRACTAXIS_P_H
29 #define QABSTRACTAXIS_P_H
29 #define QABSTRACTAXIS_P_H
30
30
31 #include <QtCharts/QAbstractAxis>
31 #include <QtCharts/QAbstractAxis>
32 #include <private/chartaxiselement_p.h>
32 #include <private/chartaxiselement_p.h>
33 #include <QtCharts/QChart>
33 #include <QtCharts/QChart>
34 #include <QtCore/QDebug>
34 #include <QtCore/QDebug>
35
35
36 QT_BEGIN_NAMESPACE
36 QT_BEGIN_NAMESPACE
37 class QGraphicsItem;
37 class QGraphicsItem;
38 QT_END_NAMESPACE
38 QT_END_NAMESPACE
39
39
40 QT_CHARTS_BEGIN_NAMESPACE
40 QT_CHARTS_BEGIN_NAMESPACE
41
41
42 class ChartPresenter;
42 class ChartPresenter;
43 class AbstractDomain;
43 class AbstractDomain;
44 class QChart;
44 class QChart;
45 class QAbstractSeries;
45 class QAbstractSeries;
46 class ChartTheme;
46 class ChartTheme;
47 class ChartElement;
47 class ChartElement;
48
48
49 class QT_CHARTS_AUTOTEST_EXPORT QAbstractAxisPrivate : public QObject
49 class QT_CHARTS_AUTOTEST_EXPORT QAbstractAxisPrivate : public QObject
50 {
50 {
51 Q_OBJECT
51 Q_OBJECT
52 public:
52 public:
53 QAbstractAxisPrivate(QAbstractAxis *q);
53 QAbstractAxisPrivate(QAbstractAxis *q);
54 ~QAbstractAxisPrivate();
54 ~QAbstractAxisPrivate();
55
55
56 public:
56 public:
57 Qt::Alignment alignment() const { return m_alignment; }
57 Qt::Alignment alignment() const { return m_alignment; }
58 Qt::Orientation orientation() const { return m_orientation; }
58 Qt::Orientation orientation() const { return m_orientation; }
59 void setAlignment( Qt::Alignment alignment);
59 void setAlignment( Qt::Alignment alignment);
60
60
61 virtual void initializeDomain(AbstractDomain *domain) = 0;
61 virtual void initializeDomain(AbstractDomain *domain) = 0;
62 virtual void initializeGraphics(QGraphicsItem *parent) = 0;
62 virtual void initializeGraphics(QGraphicsItem *parent) = 0;
63 virtual void initializeTheme(ChartTheme* theme, bool forced = false);
63 virtual void initializeTheme(ChartTheme* theme, bool forced = false);
64 virtual void initializeAnimations(QChart::AnimationOptions options, int duration,
64 virtual void initializeAnimations(QChart::AnimationOptions options, int duration,
65 QEasingCurve &curve);
65 QEasingCurve &curve);
66
66
67 //interface for manipulating range form base class
67 //interface for manipulating range form base class
68 virtual void setMin(const QVariant &min) = 0;
68 virtual void setMin(const QVariant &min) = 0;
69 virtual void setMax(const QVariant &max) = 0;
69 virtual void setMax(const QVariant &max) = 0;
70 virtual void setRange(const QVariant &min, const QVariant &max) = 0;
70 virtual void setRange(const QVariant &min, const QVariant &max) = 0;
71
71
72 //interface manipulating range form domain
72 //interface manipulating range form domain
73 virtual void setRange(qreal min, qreal max) = 0;
73 virtual void setRange(qreal min, qreal max) = 0;
74 virtual qreal min() = 0;
74 virtual qreal min() = 0;
75 virtual qreal max() = 0;
75 virtual qreal max() = 0;
76
76
77 ChartAxisElement *axisItem() { return m_item.data(); }
77 ChartAxisElement *axisItem() { return m_item.data(); }
78
78
79 public Q_SLOTS:
79 public Q_SLOTS:
80 void handleRangeChanged(qreal min, qreal max);
80 void handleRangeChanged(qreal min, qreal max);
81
81
82 Q_SIGNALS:
82 Q_SIGNALS:
83 void rangeChanged(qreal min, qreal max);
83 void rangeChanged(qreal min, qreal max);
84
84
85 protected:
85 protected:
86 QAbstractAxis *q_ptr;
86 QAbstractAxis *q_ptr;
87 QChart *m_chart;
87 QChart *m_chart;
88 QScopedPointer<ChartAxisElement> m_item;
88 QScopedPointer<ChartAxisElement> m_item;
89
89
90 private:
90 private:
91 QList<QAbstractSeries*> m_series;
91 QList<QAbstractSeries*> m_series;
92
92
93 Qt::Alignment m_alignment;
93 Qt::Alignment m_alignment;
94 Qt::Orientation m_orientation;
94 Qt::Orientation m_orientation;
95
95
96 bool m_visible;
96 bool m_visible;
97
97
98 bool m_arrowVisible;
98 bool m_arrowVisible;
99 QPen m_axisPen;
99 QPen m_axisPen;
100 QBrush m_axisBrush;
100 QBrush m_axisBrush;
101
101
102 bool m_gridLineVisible;
102 bool m_gridLineVisible;
103 QPen m_gridLinePen;
103 QPen m_gridLinePen;
104 bool m_minorGridLineVisible;
104 bool m_minorGridLineVisible;
105 QPen m_minorGridLinePen;
105 QPen m_minorGridLinePen;
106
106
107 bool m_labelsVisible;
107 bool m_labelsVisible;
108 QBrush m_labelsBrush;
108 QBrush m_labelsBrush;
109 QFont m_labelsFont;
109 QFont m_labelsFont;
110 int m_labelsAngle;
110 int m_labelsAngle;
111
111
112 bool m_titleVisible;
112 bool m_titleVisible;
113 QBrush m_titleBrush;
113 QBrush m_titleBrush;
114 QFont m_titleFont;
114 QFont m_titleFont;
115 QString m_title;
115 QString m_title;
116
116
117 bool m_shadesVisible;
117 bool m_shadesVisible;
118 QPen m_shadesPen;
118 QPen m_shadesPen;
119 QBrush m_shadesBrush;
119 QBrush m_shadesBrush;
120 qreal m_shadesOpacity;
120 qreal m_shadesOpacity;
121
121
122 bool m_dirty;
122 bool m_dirty;
123
123
124 bool m_reverse;
124 bool m_reverse;
125
125
126 friend class QAbstractAxis;
126 friend class QAbstractAxis;
127 friend class ChartDataSet;
127 friend class ChartDataSet;
128 friend class ChartPresenter;
128 friend class ChartPresenter;
129 };
129 };
130
130
131 QT_CHARTS_END_NAMESPACE
131 QT_CHARTS_END_NAMESPACE
132
132
133 #endif
133 #endif
@@ -1,59 +1,59
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTVALUEAXISX_H
28 #ifndef CHARTVALUEAXISX_H
29 #define CHARTVALUEAXISX_H
29 #define CHARTVALUEAXISX_H
30
30
31 #include <private/horizontalaxis_p.h>
31 #include <private/horizontalaxis_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QValueAxis;
35 class QValueAxis;
36
36
37 class ChartValueAxisX : public HorizontalAxis
37 class ChartValueAxisX : public HorizontalAxis
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40 public:
40 public:
41 ChartValueAxisX(QValueAxis *axis, QGraphicsItem *item = 0);
41 ChartValueAxisX(QValueAxis *axis, QGraphicsItem *item = 0);
42 ~ChartValueAxisX();
42 ~ChartValueAxisX();
43
43
44 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
44 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
45 protected:
45 protected:
46 QVector<qreal> calculateLayout() const;
46 QVector<qreal> calculateLayout() const;
47 void updateGeometry();
47 void updateGeometry();
48 private Q_SLOTS:
48 private Q_SLOTS:
49 void handleTickCountChanged(int tick);
49 void handleTickCountChanged(int tick);
50 void handleMinorTickCountChanged(int tick);
50 void handleMinorTickCountChanged(int tick);
51 void handleLabelFormatChanged(const QString &format);
51 void handleLabelFormatChanged(const QString &format);
52
52
53 private:
53 private:
54 QValueAxis *m_axis;
54 QValueAxis *m_axis;
55 };
55 };
56
56
57 QT_CHARTS_END_NAMESPACE
57 QT_CHARTS_END_NAMESPACE
58
58
59 #endif /* CHARTVALUEAXISX_H */
59 #endif /* CHARTVALUEAXISX_H */
@@ -1,59 +1,59
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTVALUEAXISY_H
28 #ifndef CHARTVALUEAXISY_H
29 #define CHARTVALUEAXISY_H
29 #define CHARTVALUEAXISY_H
30
30
31 #include <private/verticalaxis_p.h>
31 #include <private/verticalaxis_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QValueAxis;
35 class QValueAxis;
36
36
37 class ChartValueAxisY : public VerticalAxis
37 class ChartValueAxisY : public VerticalAxis
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40 public:
40 public:
41 ChartValueAxisY(QValueAxis *axis, QGraphicsItem *item = 0);
41 ChartValueAxisY(QValueAxis *axis, QGraphicsItem *item = 0);
42 ~ChartValueAxisY();
42 ~ChartValueAxisY();
43
43
44 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
44 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
45 protected:
45 protected:
46 QVector<qreal> calculateLayout() const;
46 QVector<qreal> calculateLayout() const;
47 void updateGeometry();
47 void updateGeometry();
48 private Q_SLOTS:
48 private Q_SLOTS:
49 void handleTickCountChanged(int tick);
49 void handleTickCountChanged(int tick);
50 void handleMinorTickCountChanged(int tick);
50 void handleMinorTickCountChanged(int tick);
51 void handleLabelFormatChanged(const QString &format);
51 void handleLabelFormatChanged(const QString &format);
52
52
53 private:
53 private:
54 QValueAxis *m_axis;
54 QValueAxis *m_axis;
55 };
55 };
56
56
57 QT_CHARTS_END_NAMESPACE
57 QT_CHARTS_END_NAMESPACE
58
58
59 #endif /* CHARTVALUEAXISY_H */
59 #endif /* CHARTVALUEAXISY_H */
@@ -1,56 +1,56
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef POLARCHARTVALUEAXISANGULAR_P_H
28 #ifndef POLARCHARTVALUEAXISANGULAR_P_H
29 #define POLARCHARTVALUEAXISANGULAR_P_H
29 #define POLARCHARTVALUEAXISANGULAR_P_H
30
30
31 #include <private/polarchartaxisangular_p.h>
31 #include <private/polarchartaxisangular_p.h>
32 #include <QtCharts/QValueAxis>
32 #include <QtCharts/QValueAxis>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class QValueAxis;
36 class QValueAxis;
37
37
38 class PolarChartValueAxisAngular : public PolarChartAxisAngular
38 class PolarChartValueAxisAngular : public PolarChartAxisAngular
39 {
39 {
40 Q_OBJECT
40 Q_OBJECT
41 public:
41 public:
42 PolarChartValueAxisAngular(QValueAxis *axis, QGraphicsItem *item);
42 PolarChartValueAxisAngular(QValueAxis *axis, QGraphicsItem *item);
43 ~PolarChartValueAxisAngular();
43 ~PolarChartValueAxisAngular();
44
44
45 virtual QVector<qreal> calculateLayout() const;
45 virtual QVector<qreal> calculateLayout() const;
46 virtual void createAxisLabels(const QVector<qreal> &layout);
46 virtual void createAxisLabels(const QVector<qreal> &layout);
47
47
48 private Q_SLOTS:
48 private Q_SLOTS:
49 void handleTickCountChanged(int tick);
49 void handleTickCountChanged(int tick);
50 void handleMinorTickCountChanged(int tick);
50 void handleMinorTickCountChanged(int tick);
51 void handleLabelFormatChanged(const QString &format);
51 void handleLabelFormatChanged(const QString &format);
52 };
52 };
53
53
54 QT_CHARTS_END_NAMESPACE
54 QT_CHARTS_END_NAMESPACE
55
55
56 #endif // POLARCHARTVALUEAXISANGULAR_P_H
56 #endif // POLARCHARTVALUEAXISANGULAR_P_H
@@ -1,55 +1,55
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef POLARCHARTVALUEAXISRADIAL_P_H
28 #ifndef POLARCHARTVALUEAXISRADIAL_P_H
29 #define POLARCHARTVALUEAXISRADIAL_P_H
29 #define POLARCHARTVALUEAXISRADIAL_P_H
30
30
31 #include <private/polarchartaxisradial_p.h>
31 #include <private/polarchartaxisradial_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QValueAxis;
35 class QValueAxis;
36
36
37 class PolarChartValueAxisRadial : public PolarChartAxisRadial
37 class PolarChartValueAxisRadial : public PolarChartAxisRadial
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40 public:
40 public:
41 PolarChartValueAxisRadial(QValueAxis *axis, QGraphicsItem *item);
41 PolarChartValueAxisRadial(QValueAxis *axis, QGraphicsItem *item);
42 ~PolarChartValueAxisRadial();
42 ~PolarChartValueAxisRadial();
43
43
44 virtual QVector<qreal> calculateLayout() const;
44 virtual QVector<qreal> calculateLayout() const;
45 virtual void createAxisLabels(const QVector<qreal> &layout);
45 virtual void createAxisLabels(const QVector<qreal> &layout);
46
46
47 private Q_SLOTS:
47 private Q_SLOTS:
48 void handleTickCountChanged(int tick);
48 void handleTickCountChanged(int tick);
49 void handleMinorTickCountChanged(int tick);
49 void handleMinorTickCountChanged(int tick);
50 void handleLabelFormatChanged(const QString &format);
50 void handleLabelFormatChanged(const QString &format);
51 };
51 };
52
52
53 QT_CHARTS_END_NAMESPACE
53 QT_CHARTS_END_NAMESPACE
54
54
55 #endif // POLARCHARTVALUEAXISRADIAL_P_H
55 #endif // POLARCHARTVALUEAXISRADIAL_P_H
@@ -1,68 +1,68
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QVALUEAXIS_P_H
28 #ifndef QVALUEAXIS_P_H
29 #define QVALUEAXIS_P_H
29 #define QVALUEAXIS_P_H
30
30
31 #include <QtCharts/QValueAxis>
31 #include <QtCharts/QValueAxis>
32 #include <private/qabstractaxis_p.h>
32 #include <private/qabstractaxis_p.h>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class QValueAxisPrivate : public QAbstractAxisPrivate
36 class QValueAxisPrivate : public QAbstractAxisPrivate
37 {
37 {
38 Q_OBJECT
38 Q_OBJECT
39 public:
39 public:
40 QValueAxisPrivate(QValueAxis *q);
40 QValueAxisPrivate(QValueAxis *q);
41 ~QValueAxisPrivate();
41 ~QValueAxisPrivate();
42
42
43 public:
43 public:
44 void initializeGraphics(QGraphicsItem* parent);
44 void initializeGraphics(QGraphicsItem* parent);
45 void initializeDomain(AbstractDomain *domain);
45 void initializeDomain(AbstractDomain *domain);
46
46
47 qreal min() { return m_min; }
47 qreal min() { return m_min; }
48 qreal max() { return m_max; }
48 qreal max() { return m_max; }
49 void setRange(qreal min,qreal max);
49 void setRange(qreal min,qreal max);
50
50
51 protected:
51 protected:
52 void setMin(const QVariant &min);
52 void setMin(const QVariant &min);
53 void setMax(const QVariant &max);
53 void setMax(const QVariant &max);
54 void setRange(const QVariant &min, const QVariant &max);
54 void setRange(const QVariant &min, const QVariant &max);
55
55
56 private:
56 private:
57 qreal m_min;
57 qreal m_min;
58 qreal m_max;
58 qreal m_max;
59 int m_tickCount;
59 int m_tickCount;
60 int m_minorTickCount;
60 int m_minorTickCount;
61 QString m_format;
61 QString m_format;
62 bool m_applying;
62 bool m_applying;
63 Q_DECLARE_PUBLIC(QValueAxis)
63 Q_DECLARE_PUBLIC(QValueAxis)
64 };
64 };
65
65
66 QT_CHARTS_END_NAMESPACE
66 QT_CHARTS_END_NAMESPACE
67
67
68 #endif // QVALUEAXIS_P_H
68 #endif // QVALUEAXIS_P_H
@@ -1,48 +1,48
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef VERTICALAXIS_P_H_
28 #ifndef VERTICALAXIS_P_H_
29 #define VERTICALAXIS_P_H_
29 #define VERTICALAXIS_P_H_
30
30
31 #include <private/cartesianchartaxis_p.h>
31 #include <private/cartesianchartaxis_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class VerticalAxis : public CartesianChartAxis
35 class VerticalAxis : public CartesianChartAxis
36 {
36 {
37 public:
37 public:
38 VerticalAxis(QAbstractAxis *axis, QGraphicsItem *item = 0, bool intervalAxis = false);
38 VerticalAxis(QAbstractAxis *axis, QGraphicsItem *item = 0, bool intervalAxis = false);
39 ~VerticalAxis();
39 ~VerticalAxis();
40 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
40 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
41 protected:
41 protected:
42 void updateGeometry();
42 void updateGeometry();
43
43
44 };
44 };
45
45
46 QT_CHARTS_END_NAMESPACE
46 QT_CHARTS_END_NAMESPACE
47
47
48 #endif /* VERTICALAXIS_P_H_ */
48 #endif /* VERTICALAXIS_P_H_ */
@@ -1,95 +1,95
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28
28
29 #ifndef ABSTRACTBARCHARTITEM_H
29 #ifndef ABSTRACTBARCHARTITEM_H
30 #define ABSTRACTBARCHARTITEM_H
30 #define ABSTRACTBARCHARTITEM_H
31
31
32 #include <private/chartitem_p.h>
32 #include <private/chartitem_p.h>
33 #include <QtCharts/QAbstractBarSeries>
33 #include <QtCharts/QAbstractBarSeries>
34 #include <QtGui/QPen>
34 #include <QtGui/QPen>
35 #include <QtGui/QBrush>
35 #include <QtGui/QBrush>
36
36
37 QT_CHARTS_BEGIN_NAMESPACE
37 QT_CHARTS_BEGIN_NAMESPACE
38
38
39 class Bar;
39 class Bar;
40 class QAxisCategories;
40 class QAxisCategories;
41 class QChart;
41 class QChart;
42 class BarAnimation;
42 class BarAnimation;
43
43
44 class AbstractBarChartItem : public ChartItem
44 class AbstractBarChartItem : public ChartItem
45 {
45 {
46 Q_OBJECT
46 Q_OBJECT
47 public:
47 public:
48 AbstractBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
48 AbstractBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
49 virtual ~AbstractBarChartItem();
49 virtual ~AbstractBarChartItem();
50
50
51 public:
51 public:
52 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
52 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
53 QRectF boundingRect() const;
53 QRectF boundingRect() const;
54
54
55 virtual QVector<QRectF> calculateLayout() = 0;
55 virtual QVector<QRectF> calculateLayout() = 0;
56 virtual void initializeLayout() = 0;
56 virtual void initializeLayout() = 0;
57 virtual void applyLayout(const QVector<QRectF> &layout);
57 virtual void applyLayout(const QVector<QRectF> &layout);
58 virtual void setAnimation(BarAnimation *animation);
58 virtual void setAnimation(BarAnimation *animation);
59 void setLayout(const QVector<QRectF> &layout);
59 void setLayout(const QVector<QRectF> &layout);
60 void updateLayout(const QVector<QRectF> &layout);
60 void updateLayout(const QVector<QRectF> &layout);
61 QRectF geometry() const { return m_rect;}
61 QRectF geometry() const { return m_rect;}
62
62
63 public Q_SLOTS:
63 public Q_SLOTS:
64 void handleDomainUpdated();
64 void handleDomainUpdated();
65 void handleLayoutChanged();
65 void handleLayoutChanged();
66 void handleLabelsVisibleChanged(bool visible);
66 void handleLabelsVisibleChanged(bool visible);
67 void handleDataStructureChanged(); // structure of of series has changed, recreate graphic items
67 void handleDataStructureChanged(); // structure of of series has changed, recreate graphic items
68 void handleVisibleChanged();
68 void handleVisibleChanged();
69 void handleOpacityChanged();
69 void handleOpacityChanged();
70 virtual void handleUpdatedBars();
70 virtual void handleUpdatedBars();
71 void handleLabelsPositionChanged();
71 void handleLabelsPositionChanged();
72 virtual void positionLabels();
72 virtual void positionLabels();
73
73
74 protected:
74 protected:
75 void positionLabelsVertical();
75 void positionLabelsVertical();
76
76
77 qreal m_domainMinX;
77 qreal m_domainMinX;
78 qreal m_domainMaxX;
78 qreal m_domainMaxX;
79 qreal m_domainMinY;
79 qreal m_domainMinY;
80 qreal m_domainMaxY;
80 qreal m_domainMaxY;
81
81
82 QRectF m_rect;
82 QRectF m_rect;
83 QVector<QRectF> m_layout;
83 QVector<QRectF> m_layout;
84
84
85 BarAnimation *m_animation;
85 BarAnimation *m_animation;
86
86
87 QAbstractBarSeries *m_series; // Not owned.
87 QAbstractBarSeries *m_series; // Not owned.
88 QList<Bar *> m_bars;
88 QList<Bar *> m_bars;
89 QList<QGraphicsTextItem *> m_labels;
89 QList<QGraphicsTextItem *> m_labels;
90 QSizeF m_oldSize;
90 QSizeF m_oldSize;
91 };
91 };
92
92
93 QT_CHARTS_END_NAMESPACE
93 QT_CHARTS_END_NAMESPACE
94
94
95 #endif // ABSTRACTBARCHARTITEM_H
95 #endif // ABSTRACTBARCHARTITEM_H
@@ -1,72 +1,72
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef BAR_H
28 #ifndef BAR_H
29 #define BAR_H
29 #define BAR_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <QtWidgets/QGraphicsRectItem>
32 #include <QtWidgets/QGraphicsRectItem>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class QBarSet;
36 class QBarSet;
37
37
38 // Single visual bar item of chart
38 // Single visual bar item of chart
39 class Bar : public QObject, public QGraphicsRectItem
39 class Bar : public QObject, public QGraphicsRectItem
40 {
40 {
41 Q_OBJECT
41 Q_OBJECT
42 public:
42 public:
43 Bar(QBarSet *barset, int index, QGraphicsItem *parent = 0);
43 Bar(QBarSet *barset, int index, QGraphicsItem *parent = 0);
44 ~Bar();
44 ~Bar();
45
45
46 public:
46 public:
47 void mousePressEvent(QGraphicsSceneMouseEvent *event);
47 void mousePressEvent(QGraphicsSceneMouseEvent *event);
48 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
48 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
49 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
49 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
50 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
50 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
51 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
51 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
52
52
53 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
53 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
54
54
55 Q_SIGNALS:
55 Q_SIGNALS:
56 void clicked(int index, QBarSet *barset);
56 void clicked(int index, QBarSet *barset);
57 void hovered(bool status, int index, QBarSet *barset);
57 void hovered(bool status, int index, QBarSet *barset);
58 void pressed(int index, QBarSet *barset);
58 void pressed(int index, QBarSet *barset);
59 void released(int index, QBarSet *barset);
59 void released(int index, QBarSet *barset);
60 void doubleClicked(int index, QBarSet *barset);
60 void doubleClicked(int index, QBarSet *barset);
61
61
62 private:
62 private:
63 int m_index;
63 int m_index;
64 QBarSet *m_barset;
64 QBarSet *m_barset;
65 bool m_hovering;
65 bool m_hovering;
66
66
67 bool m_mousePressed;
67 bool m_mousePressed;
68 };
68 };
69
69
70 QT_CHARTS_END_NAMESPACE
70 QT_CHARTS_END_NAMESPACE
71
71
72 #endif // BAR_H
72 #endif // BAR_H
@@ -1,49 +1,49
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef HORIZONTALBARCHARTITEM_H
28 #ifndef HORIZONTALBARCHARTITEM_H
29 #define HORIZONTALBARCHARTITEM_H
29 #define HORIZONTALBARCHARTITEM_H
30
30
31 #include <private/abstractbarchartitem_p.h>
31 #include <private/abstractbarchartitem_p.h>
32 #include <QtWidgets/QGraphicsItem>
32 #include <QtWidgets/QGraphicsItem>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class HorizontalBarChartItem : public AbstractBarChartItem
36 class HorizontalBarChartItem : public AbstractBarChartItem
37 {
37 {
38 Q_OBJECT
38 Q_OBJECT
39 public:
39 public:
40 HorizontalBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
40 HorizontalBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
41
41
42 private:
42 private:
43 virtual QVector<QRectF> calculateLayout();
43 virtual QVector<QRectF> calculateLayout();
44 void initializeLayout();
44 void initializeLayout();
45 };
45 };
46
46
47 QT_CHARTS_END_NAMESPACE
47 QT_CHARTS_END_NAMESPACE
48
48
49 #endif // HORIZONTALBARCHARTITEM_H
49 #endif // HORIZONTALBARCHARTITEM_H
@@ -1,48 +1,48
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QHORIZONTALBARSERIES_P_H
28 #ifndef QHORIZONTALBARSERIES_P_H
29 #define QHORIZONTALBARSERIES_P_H
29 #define QHORIZONTALBARSERIES_P_H
30
30
31 #include <private/qabstractbarseries_p.h>
31 #include <private/qabstractbarseries_p.h>
32 #include <private/abstractdomain_p.h>
32 #include <private/abstractdomain_p.h>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class QHorizontalBarSeriesPrivate: public QAbstractBarSeriesPrivate
36 class QHorizontalBarSeriesPrivate: public QAbstractBarSeriesPrivate
37 {
37 {
38 public:
38 public:
39 QHorizontalBarSeriesPrivate(QHorizontalBarSeries *q);
39 QHorizontalBarSeriesPrivate(QHorizontalBarSeries *q);
40 void initializeGraphics(QGraphicsItem* parent);
40 void initializeGraphics(QGraphicsItem* parent);
41 void initializeDomain();
41 void initializeDomain();
42 private:
42 private:
43 Q_DECLARE_PUBLIC(QHorizontalBarSeries)
43 Q_DECLARE_PUBLIC(QHorizontalBarSeries)
44 };
44 };
45
45
46 QT_CHARTS_END_NAMESPACE
46 QT_CHARTS_END_NAMESPACE
47
47
48 #endif // QHORIZONTALBARSERIES_P_H
48 #endif // QHORIZONTALBARSERIES_P_H
@@ -1,50 +1,50
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef HORIZONTALPERCENTBARCHARTITEM_P_H
28 #ifndef HORIZONTALPERCENTBARCHARTITEM_P_H
29 #define HORIZONTALPERCENTBARCHARTITEM_P_H
29 #define HORIZONTALPERCENTBARCHARTITEM_P_H
30
30
31 #include <private/abstractbarchartitem_p.h>
31 #include <private/abstractbarchartitem_p.h>
32 #include <QtWidgets/QGraphicsItem>
32 #include <QtWidgets/QGraphicsItem>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class HorizontalPercentBarChartItem : public AbstractBarChartItem
36 class HorizontalPercentBarChartItem : public AbstractBarChartItem
37 {
37 {
38 Q_OBJECT
38 Q_OBJECT
39 public:
39 public:
40 HorizontalPercentBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
40 HorizontalPercentBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
41 void handleUpdatedBars();
41 void handleUpdatedBars();
42
42
43 private:
43 private:
44 virtual QVector<QRectF> calculateLayout();
44 virtual QVector<QRectF> calculateLayout();
45 void initializeLayout();
45 void initializeLayout();
46 };
46 };
47
47
48 QT_CHARTS_END_NAMESPACE
48 QT_CHARTS_END_NAMESPACE
49
49
50 #endif // HORIZONTALPERCENTBARCHARTITEM_P_H
50 #endif // HORIZONTALPERCENTBARCHARTITEM_P_H
@@ -1,48 +1,48
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QHORIZONTALPERCENTBARSERIES_P_H
28 #ifndef QHORIZONTALPERCENTBARSERIES_P_H
29 #define QHORIZONTALPERCENTBARSERIES_P_H
29 #define QHORIZONTALPERCENTBARSERIES_P_H
30
30
31 #include <private/qabstractbarseries_p.h>
31 #include <private/qabstractbarseries_p.h>
32 #include <private/abstractdomain_p.h>
32 #include <private/abstractdomain_p.h>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class QHorizontalPercentBarSeriesPrivate: public QAbstractBarSeriesPrivate
36 class QHorizontalPercentBarSeriesPrivate: public QAbstractBarSeriesPrivate
37 {
37 {
38 public:
38 public:
39 QHorizontalPercentBarSeriesPrivate(QHorizontalPercentBarSeries *q);
39 QHorizontalPercentBarSeriesPrivate(QHorizontalPercentBarSeries *q);
40 void initializeGraphics(QGraphicsItem* parent);
40 void initializeGraphics(QGraphicsItem* parent);
41 void initializeDomain();
41 void initializeDomain();
42 private:
42 private:
43 Q_DECLARE_PUBLIC(QHorizontalPercentBarSeries)
43 Q_DECLARE_PUBLIC(QHorizontalPercentBarSeries)
44 };
44 };
45
45
46 QT_CHARTS_END_NAMESPACE
46 QT_CHARTS_END_NAMESPACE
47
47
48 #endif // QHORIZONTALPERCENTBARSERIES_P_H
48 #endif // QHORIZONTALPERCENTBARSERIES_P_H
@@ -1,49 +1,49
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef HORIZONTALSTACKEDBARCHARTITEM_P_H
28 #ifndef HORIZONTALSTACKEDBARCHARTITEM_P_H
29 #define HORIZONTALSTACKEDBARCHARTITEM_P_H
29 #define HORIZONTALSTACKEDBARCHARTITEM_P_H
30
30
31 #include <private/abstractbarchartitem_p.h>
31 #include <private/abstractbarchartitem_p.h>
32 #include <QtWidgets/QGraphicsItem>
32 #include <QtWidgets/QGraphicsItem>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class HorizontalStackedBarChartItem : public AbstractBarChartItem
36 class HorizontalStackedBarChartItem : public AbstractBarChartItem
37 {
37 {
38 Q_OBJECT
38 Q_OBJECT
39 public:
39 public:
40 HorizontalStackedBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
40 HorizontalStackedBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
41
41
42 private:
42 private:
43 virtual QVector<QRectF> calculateLayout();
43 virtual QVector<QRectF> calculateLayout();
44 void initializeLayout();
44 void initializeLayout();
45 };
45 };
46
46
47 QT_CHARTS_END_NAMESPACE
47 QT_CHARTS_END_NAMESPACE
48
48
49 #endif // HORIZONTALSTACKEDBARCHARTITEM_P_H
49 #endif // HORIZONTALSTACKEDBARCHARTITEM_P_H
@@ -1,48 +1,48
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QHORIZONTALSTACKEDBARSERIES_P_H
28 #ifndef QHORIZONTALSTACKEDBARSERIES_P_H
29 #define QHORIZONTALSTACKEDBARSERIES_P_H
29 #define QHORIZONTALSTACKEDBARSERIES_P_H
30
30
31 #include <private/qabstractbarseries_p.h>
31 #include <private/qabstractbarseries_p.h>
32 #include <private/abstractdomain_p.h>
32 #include <private/abstractdomain_p.h>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class QHorizontalStackedBarSeriesPrivate: public QAbstractBarSeriesPrivate
36 class QHorizontalStackedBarSeriesPrivate: public QAbstractBarSeriesPrivate
37 {
37 {
38 public:
38 public:
39 QHorizontalStackedBarSeriesPrivate(QHorizontalStackedBarSeries *q);
39 QHorizontalStackedBarSeriesPrivate(QHorizontalStackedBarSeries *q);
40 void initializeGraphics(QGraphicsItem* parent);
40 void initializeGraphics(QGraphicsItem* parent);
41 void initializeDomain();
41 void initializeDomain();
42 private:
42 private:
43 Q_DECLARE_PUBLIC(QHorizontalStackedBarSeries)
43 Q_DECLARE_PUBLIC(QHorizontalStackedBarSeries)
44 };
44 };
45
45
46 QT_CHARTS_END_NAMESPACE
46 QT_CHARTS_END_NAMESPACE
47
47
48 #endif // QHORIZONTALSTACKEDBARSERIES_P_H
48 #endif // QHORIZONTALSTACKEDBARSERIES_P_H
@@ -1,122 +1,122
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QABSTRACTBARSERIES_P_H
28 #ifndef QABSTRACTBARSERIES_P_H
29 #define QABSTRACTBARSERIES_P_H
29 #define QABSTRACTBARSERIES_P_H
30
30
31 #include <QtCharts/QAbstractBarSeries>
31 #include <QtCharts/QAbstractBarSeries>
32 #include <private/qabstractseries_p.h>
32 #include <private/qabstractseries_p.h>
33 #include <QtCore/QStringList>
33 #include <QtCore/QStringList>
34 #include <QtCharts/QAbstractSeries>
34 #include <QtCharts/QAbstractSeries>
35
35
36 QT_CHARTS_BEGIN_NAMESPACE
36 QT_CHARTS_BEGIN_NAMESPACE
37
37
38 class QBarModelMapper;
38 class QBarModelMapper;
39 class QBarCategoryAxis;
39 class QBarCategoryAxis;
40 class QLegendMarker;
40 class QLegendMarker;
41
41
42 class QAbstractBarSeriesPrivate : public QAbstractSeriesPrivate
42 class QAbstractBarSeriesPrivate : public QAbstractSeriesPrivate
43 {
43 {
44 Q_OBJECT
44 Q_OBJECT
45 public:
45 public:
46 QAbstractBarSeriesPrivate(QAbstractBarSeries *parent);
46 QAbstractBarSeriesPrivate(QAbstractBarSeries *parent);
47 int categoryCount() const;
47 int categoryCount() const;
48
48
49 void setBarWidth(qreal width);
49 void setBarWidth(qreal width);
50 qreal barWidth() const;
50 qreal barWidth() const;
51
51
52 void setVisible(bool visible);
52 void setVisible(bool visible);
53 void setLabelsVisible(bool visible);
53 void setLabelsVisible(bool visible);
54
54
55 void initializeDomain();
55 void initializeDomain();
56 void initializeAxes();
56 void initializeAxes();
57 void initializeAnimations(QChart::AnimationOptions options, int duration, QEasingCurve &curve);
57 void initializeAnimations(QChart::AnimationOptions options, int duration, QEasingCurve &curve);
58 void initializeTheme(int index, ChartTheme* theme, bool forced = false);
58 void initializeTheme(int index, ChartTheme* theme, bool forced = false);
59
59
60 QList<QLegendMarker*> createLegendMarkers(QLegend *legend);
60 QList<QLegendMarker*> createLegendMarkers(QLegend *legend);
61
61
62 virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
62 virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
63 QAbstractAxis* createDefaultAxis(Qt::Orientation orientation) const;
63 QAbstractAxis* createDefaultAxis(Qt::Orientation orientation) const;
64
64
65 bool append(QBarSet *set);
65 bool append(QBarSet *set);
66 bool remove(QBarSet *set);
66 bool remove(QBarSet *set);
67 bool append(QList<QBarSet *> sets);
67 bool append(QList<QBarSet *> sets);
68 bool remove(QList<QBarSet *> sets);
68 bool remove(QList<QBarSet *> sets);
69 bool insert(int index, QBarSet *set);
69 bool insert(int index, QBarSet *set);
70
70
71 QBarSet *barsetAt(int index);
71 QBarSet *barsetAt(int index);
72 qreal min();
72 qreal min();
73 qreal max();
73 qreal max();
74 qreal valueAt(int set, int category);
74 qreal valueAt(int set, int category);
75 qreal percentageAt(int set, int category);
75 qreal percentageAt(int set, int category);
76 qreal categorySum(int category);
76 qreal categorySum(int category);
77 qreal absoluteCategorySum(int category);
77 qreal absoluteCategorySum(int category);
78 qreal maxCategorySum();
78 qreal maxCategorySum();
79 qreal minX();
79 qreal minX();
80 qreal maxX();
80 qreal maxX();
81 qreal categoryTop(int category);
81 qreal categoryTop(int category);
82 qreal categoryBottom(int category);
82 qreal categoryBottom(int category);
83 qreal top();
83 qreal top();
84 qreal bottom();
84 qreal bottom();
85
85
86 bool blockBarUpdate();
86 bool blockBarUpdate();
87
87
88 qreal labelsAngle() const;
88 qreal labelsAngle() const;
89
89
90 Q_SIGNALS:
90 Q_SIGNALS:
91 void clicked(int index, QBarSet *barset);
91 void clicked(int index, QBarSet *barset);
92 void pressed(int index, QBarSet *barset);
92 void pressed(int index, QBarSet *barset);
93 void released(int index, QBarSet *barset);
93 void released(int index, QBarSet *barset);
94 void doubleClicked(int index, QBarSet *barset);
94 void doubleClicked(int index, QBarSet *barset);
95 void updatedBars();
95 void updatedBars();
96 void updatedLayout();
96 void updatedLayout();
97 void restructuredBars();
97 void restructuredBars();
98 void labelsVisibleChanged(bool visible);
98 void labelsVisibleChanged(bool visible);
99 void visibleChanged();
99 void visibleChanged();
100
100
101 private:
101 private:
102 void populateCategories(QBarCategoryAxis *axis);
102 void populateCategories(QBarCategoryAxis *axis);
103
103
104 protected:
104 protected:
105 QList<QBarSet *> m_barSets;
105 QList<QBarSet *> m_barSets;
106 qreal m_barWidth;
106 qreal m_barWidth;
107 bool m_labelsVisible;
107 bool m_labelsVisible;
108 bool m_visible;
108 bool m_visible;
109 bool m_blockBarUpdate;
109 bool m_blockBarUpdate;
110 QString m_labelsFormat;
110 QString m_labelsFormat;
111 QAbstractBarSeries::LabelsPosition m_labelsPosition;
111 QAbstractBarSeries::LabelsPosition m_labelsPosition;
112 qreal m_labelsAngle;
112 qreal m_labelsAngle;
113
113
114 private:
114 private:
115 Q_DECLARE_PUBLIC(QAbstractBarSeries)
115 Q_DECLARE_PUBLIC(QAbstractBarSeries)
116 friend class HorizontalBarChartItem;
116 friend class HorizontalBarChartItem;
117 friend class BarChartItem;
117 friend class BarChartItem;
118 };
118 };
119
119
120 QT_CHARTS_END_NAMESPACE
120 QT_CHARTS_END_NAMESPACE
121
121
122 #endif // QABSTRACTBARSERIES_P_H
122 #endif // QABSTRACTBARSERIES_P_H
@@ -1,96 +1,96
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QBARMODELMAPPER_P_H
28 #ifndef QBARMODELMAPPER_P_H
29 #define QBARMODELMAPPER_P_H
29 #define QBARMODELMAPPER_P_H
30
30
31 #include <QtCore/QObject>
31 #include <QtCore/QObject>
32 #include <QtCharts/QBarModelMapper>
32 #include <QtCharts/QBarModelMapper>
33
33
34 QT_BEGIN_NAMESPACE
34 QT_BEGIN_NAMESPACE
35 class QModelIndex;
35 class QModelIndex;
36 QT_END_NAMESPACE
36 QT_END_NAMESPACE
37
37
38 QT_CHARTS_BEGIN_NAMESPACE
38 QT_CHARTS_BEGIN_NAMESPACE
39
39
40 class QBarSet;
40 class QBarSet;
41
41
42 class QBarModelMapperPrivate : public QObject
42 class QBarModelMapperPrivate : public QObject
43 {
43 {
44 Q_OBJECT
44 Q_OBJECT
45 public:
45 public:
46 explicit QBarModelMapperPrivate(QBarModelMapper *q);
46 explicit QBarModelMapperPrivate(QBarModelMapper *q);
47
47
48 public Q_SLOTS:
48 public Q_SLOTS:
49 // for the model
49 // for the model
50 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
50 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
51 void modelHeaderDataUpdated(Qt::Orientation orientation, int first, int last);
51 void modelHeaderDataUpdated(Qt::Orientation orientation, int first, int last);
52 void modelRowsAdded(QModelIndex parent, int start, int end);
52 void modelRowsAdded(QModelIndex parent, int start, int end);
53 void modelRowsRemoved(QModelIndex parent, int start, int end);
53 void modelRowsRemoved(QModelIndex parent, int start, int end);
54 void modelColumnsAdded(QModelIndex parent, int start, int end);
54 void modelColumnsAdded(QModelIndex parent, int start, int end);
55 void modelColumnsRemoved(QModelIndex parent, int start, int end);
55 void modelColumnsRemoved(QModelIndex parent, int start, int end);
56 void handleModelDestroyed();
56 void handleModelDestroyed();
57
57
58 // for the series
58 // for the series
59 void barSetsAdded(QList<QBarSet *> sets);
59 void barSetsAdded(QList<QBarSet *> sets);
60 void barSetsRemoved(QList<QBarSet *> sets);
60 void barSetsRemoved(QList<QBarSet *> sets);
61 void valuesAdded(int index, int count);
61 void valuesAdded(int index, int count);
62 void valuesRemoved(int index, int count);
62 void valuesRemoved(int index, int count);
63 void barLabelChanged();
63 void barLabelChanged();
64 void barValueChanged(int index);
64 void barValueChanged(int index);
65 void handleSeriesDestroyed();
65 void handleSeriesDestroyed();
66
66
67 void initializeBarFromModel();
67 void initializeBarFromModel();
68
68
69 private:
69 private:
70 QBarSet *barSet(QModelIndex index);
70 QBarSet *barSet(QModelIndex index);
71 QModelIndex barModelIndex(int barSection, int posInBar);
71 QModelIndex barModelIndex(int barSection, int posInBar);
72 void insertData(int start, int end);
72 void insertData(int start, int end);
73 void removeData(int start, int end);
73 void removeData(int start, int end);
74 void blockModelSignals(bool block = true);
74 void blockModelSignals(bool block = true);
75 void blockSeriesSignals(bool block = true);
75 void blockSeriesSignals(bool block = true);
76
76
77 private:
77 private:
78 QAbstractBarSeries *m_series;
78 QAbstractBarSeries *m_series;
79 QList<QBarSet *> m_barSets;
79 QList<QBarSet *> m_barSets;
80 QAbstractItemModel *m_model;
80 QAbstractItemModel *m_model;
81 int m_first;
81 int m_first;
82 int m_count;
82 int m_count;
83 Qt::Orientation m_orientation;
83 Qt::Orientation m_orientation;
84 int m_firstBarSetSection;
84 int m_firstBarSetSection;
85 int m_lastBarSetSection;
85 int m_lastBarSetSection;
86 bool m_seriesSignalsBlock;
86 bool m_seriesSignalsBlock;
87 bool m_modelSignalsBlock;
87 bool m_modelSignalsBlock;
88
88
89 private:
89 private:
90 QBarModelMapper *q_ptr;
90 QBarModelMapper *q_ptr;
91 Q_DECLARE_PUBLIC(QBarModelMapper)
91 Q_DECLARE_PUBLIC(QBarModelMapper)
92 };
92 };
93
93
94 QT_CHARTS_END_NAMESPACE
94 QT_CHARTS_END_NAMESPACE
95
95
96 #endif // QBARMODELMAPPER_P_H
96 #endif // QBARMODELMAPPER_P_H
@@ -1,80 +1,80
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QBARSET_P_H
28 #ifndef QBARSET_P_H
29 #define QBARSET_P_H
29 #define QBARSET_P_H
30
30
31 #include <QtCharts/QBarSet>
31 #include <QtCharts/QBarSet>
32 #include <QtCore/QMap>
32 #include <QtCore/QMap>
33 #include <QtGui/QPen>
33 #include <QtGui/QPen>
34 #include <QtGui/QBrush>
34 #include <QtGui/QBrush>
35 #include <QtGui/QFont>
35 #include <QtGui/QFont>
36
36
37 QT_CHARTS_BEGIN_NAMESPACE
37 QT_CHARTS_BEGIN_NAMESPACE
38
38
39 class QBarSetPrivate : public QObject
39 class QBarSetPrivate : public QObject
40 {
40 {
41 Q_OBJECT
41 Q_OBJECT
42
42
43 public:
43 public:
44 QBarSetPrivate(const QString label, QBarSet *parent);
44 QBarSetPrivate(const QString label, QBarSet *parent);
45 ~QBarSetPrivate();
45 ~QBarSetPrivate();
46
46
47 void append(QPointF value);
47 void append(QPointF value);
48 void append(QList<QPointF> values);
48 void append(QList<QPointF> values);
49 void append(QList<qreal> values);
49 void append(QList<qreal> values);
50
50
51 void insert(const int index, const qreal value);
51 void insert(const int index, const qreal value);
52 void insert(const int index, const QPointF value);
52 void insert(const int index, const QPointF value);
53 int remove(const int index, const int count);
53 int remove(const int index, const int count);
54
54
55 void replace(const int index, const qreal value);
55 void replace(const int index, const qreal value);
56 void replace(const int index, const QPointF value);
56 void replace(const int index, const QPointF value);
57
57
58 qreal pos(const int index);
58 qreal pos(const int index);
59 qreal value(const int index);
59 qreal value(const int index);
60
60
61 Q_SIGNALS:
61 Q_SIGNALS:
62 void restructuredBars();
62 void restructuredBars();
63 void updatedBars();
63 void updatedBars();
64 void updatedLayout();
64 void updatedLayout();
65
65
66 public:
66 public:
67 QBarSet * const q_ptr;
67 QBarSet * const q_ptr;
68 QString m_label;
68 QString m_label;
69 QList<QPointF> m_values;
69 QList<QPointF> m_values;
70 QPen m_pen;
70 QPen m_pen;
71 QBrush m_brush;
71 QBrush m_brush;
72 QBrush m_labelBrush;
72 QBrush m_labelBrush;
73 QFont m_labelFont;
73 QFont m_labelFont;
74
74
75 friend class QBarSet;
75 friend class QBarSet;
76 };
76 };
77
77
78 QT_CHARTS_END_NAMESPACE
78 QT_CHARTS_END_NAMESPACE
79
79
80 #endif // QBARSETPRIVATE_P_H
80 #endif // QBARSETPRIVATE_P_H
@@ -1,55 +1,55
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28
28
29 #ifndef BARCHARTITEM_H
29 #ifndef BARCHARTITEM_H
30 #define BARCHARTITEM_H
30 #define BARCHARTITEM_H
31
31
32 #include <private/abstractbarchartitem_p.h>
32 #include <private/abstractbarchartitem_p.h>
33 #include <QtCharts/QStackedBarSeries>
33 #include <QtCharts/QStackedBarSeries>
34 #include <QtWidgets/QGraphicsItem>
34 #include <QtWidgets/QGraphicsItem>
35
35
36 QT_CHARTS_BEGIN_NAMESPACE
36 QT_CHARTS_BEGIN_NAMESPACE
37
37
38 class BarChartItem : public AbstractBarChartItem
38 class BarChartItem : public AbstractBarChartItem
39 {
39 {
40 Q_OBJECT
40 Q_OBJECT
41 public:
41 public:
42 BarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
42 BarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
43
43
44 private Q_SLOTS:
44 private Q_SLOTS:
45 void handleLabelsPositionChanged();
45 void handleLabelsPositionChanged();
46 void positionLabels();
46 void positionLabels();
47
47
48 private:
48 private:
49 virtual QVector<QRectF> calculateLayout();
49 virtual QVector<QRectF> calculateLayout();
50 void initializeLayout();
50 void initializeLayout();
51 };
51 };
52
52
53 QT_CHARTS_END_NAMESPACE
53 QT_CHARTS_END_NAMESPACE
54
54
55 #endif // BARCHARTITEM_H
55 #endif // BARCHARTITEM_H
@@ -1,50 +1,50
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QBARSERIES_P_H
28 #ifndef QBARSERIES_P_H
29 #define QBARSERIES_P_H
29 #define QBARSERIES_P_H
30
30
31 #include <private/qabstractbarseries_p.h>
31 #include <private/qabstractbarseries_p.h>
32 #include <private/abstractdomain_p.h>
32 #include <private/abstractdomain_p.h>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36
36
37 class QBarSeriesPrivate: public QAbstractBarSeriesPrivate
37 class QBarSeriesPrivate: public QAbstractBarSeriesPrivate
38 {
38 {
39 public:
39 public:
40 QBarSeriesPrivate(QBarSeries *q);
40 QBarSeriesPrivate(QBarSeries *q);
41 void initializeGraphics(QGraphicsItem* parent);
41 void initializeGraphics(QGraphicsItem* parent);
42 void initializeDomain();
42 void initializeDomain();
43
43
44 private:
44 private:
45 Q_DECLARE_PUBLIC(QBarSeries)
45 Q_DECLARE_PUBLIC(QBarSeries)
46 };
46 };
47
47
48 QT_CHARTS_END_NAMESPACE
48 QT_CHARTS_END_NAMESPACE
49
49
50 #endif // QBARSERIES_P_H
50 #endif // QBARSERIES_P_H
@@ -1,57 +1,57
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28
28
29 #ifndef PERCENTBARCHARTITEM_H
29 #ifndef PERCENTBARCHARTITEM_H
30 #define PERCENTBARCHARTITEM_H
30 #define PERCENTBARCHARTITEM_H
31
31
32 #include <private/abstractbarchartitem_p.h>
32 #include <private/abstractbarchartitem_p.h>
33 #include <QtWidgets/QGraphicsItem>
33 #include <QtWidgets/QGraphicsItem>
34
34
35 QT_CHARTS_BEGIN_NAMESPACE
35 QT_CHARTS_BEGIN_NAMESPACE
36
36
37 class QAbstractBarSeries;
37 class QAbstractBarSeries;
38
38
39 class PercentBarChartItem : public AbstractBarChartItem
39 class PercentBarChartItem : public AbstractBarChartItem
40 {
40 {
41 Q_OBJECT
41 Q_OBJECT
42 public:
42 public:
43 PercentBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
43 PercentBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
44 void handleUpdatedBars();
44 void handleUpdatedBars();
45
45
46 private Q_SLOTS:
46 private Q_SLOTS:
47 void handleLabelsPositionChanged();
47 void handleLabelsPositionChanged();
48 void positionLabels();
48 void positionLabels();
49
49
50 private:
50 private:
51 virtual QVector<QRectF> calculateLayout();
51 virtual QVector<QRectF> calculateLayout();
52 void initializeLayout();
52 void initializeLayout();
53 };
53 };
54
54
55 QT_CHARTS_END_NAMESPACE
55 QT_CHARTS_END_NAMESPACE
56
56
57 #endif // PERCENTBARCHARTITEM_H
57 #endif // PERCENTBARCHARTITEM_H
@@ -1,49 +1,49
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QPERCENTBARSERIES_P_H
28 #ifndef QPERCENTBARSERIES_P_H
29 #define QPERCENTBARSERIES_P_H
29 #define QPERCENTBARSERIES_P_H
30
30
31 #include <private/qabstractbarseries_p.h>
31 #include <private/qabstractbarseries_p.h>
32 #include <private/abstractdomain_p.h>
32 #include <private/abstractdomain_p.h>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36
36
37 class QPercentBarSeriesPrivate: public QAbstractBarSeriesPrivate
37 class QPercentBarSeriesPrivate: public QAbstractBarSeriesPrivate
38 {
38 {
39 public:
39 public:
40 QPercentBarSeriesPrivate(QPercentBarSeries *q);
40 QPercentBarSeriesPrivate(QPercentBarSeries *q);
41 void initializeDomain();
41 void initializeDomain();
42 void initializeGraphics(QGraphicsItem* parent);
42 void initializeGraphics(QGraphicsItem* parent);
43 private:
43 private:
44 Q_DECLARE_PUBLIC(QPercentBarSeries)
44 Q_DECLARE_PUBLIC(QPercentBarSeries)
45 };
45 };
46
46
47 QT_CHARTS_END_NAMESPACE
47 QT_CHARTS_END_NAMESPACE
48
48
49 #endif
49 #endif
@@ -1,49 +1,49
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QSTACKEDBARSERIES_P_H
28 #ifndef QSTACKEDBARSERIES_P_H
29 #define QSTACKEDBARSERIES_P_H
29 #define QSTACKEDBARSERIES_P_H
30
30
31 #include <private/qabstractbarseries_p.h>
31 #include <private/qabstractbarseries_p.h>
32 #include <private/abstractdomain_p.h>
32 #include <private/abstractdomain_p.h>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36
36
37 class QStackedBarSeriesPrivate: public QAbstractBarSeriesPrivate
37 class QStackedBarSeriesPrivate: public QAbstractBarSeriesPrivate
38 {
38 {
39 public:
39 public:
40 QStackedBarSeriesPrivate(QStackedBarSeries *q);
40 QStackedBarSeriesPrivate(QStackedBarSeries *q);
41 void initializeGraphics(QGraphicsItem* parent);
41 void initializeGraphics(QGraphicsItem* parent);
42 void initializeDomain();
42 void initializeDomain();
43 private:
43 private:
44 Q_DECLARE_PUBLIC(QStackedBarSeries)
44 Q_DECLARE_PUBLIC(QStackedBarSeries)
45 };
45 };
46
46
47 QT_CHARTS_END_NAMESPACE
47 QT_CHARTS_END_NAMESPACE
48
48
49 #endif
49 #endif
@@ -1,56 +1,56
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28
28
29 #ifndef STACKEDBARCHARTITEM_H
29 #ifndef STACKEDBARCHARTITEM_H
30 #define STACKEDBARCHARTITEM_H
30 #define STACKEDBARCHARTITEM_H
31
31
32 #include <private/abstractbarchartitem_p.h>
32 #include <private/abstractbarchartitem_p.h>
33 #include <QtCharts/QStackedBarSeries>
33 #include <QtCharts/QStackedBarSeries>
34 #include <QtWidgets/QGraphicsItem>
34 #include <QtWidgets/QGraphicsItem>
35
35
36 QT_CHARTS_BEGIN_NAMESPACE
36 QT_CHARTS_BEGIN_NAMESPACE
37
37
38 class StackedBarChartItem : public AbstractBarChartItem
38 class StackedBarChartItem : public AbstractBarChartItem
39 {
39 {
40 Q_OBJECT
40 Q_OBJECT
41 public:
41 public:
42 StackedBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item =0);
42 StackedBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item =0);
43
43
44 private Q_SLOTS:
44 private Q_SLOTS:
45 void handleLabelsPositionChanged();
45 void handleLabelsPositionChanged();
46 void positionLabels();
46 void positionLabels();
47
47
48 private:
48 private:
49 virtual QVector<QRectF> calculateLayout();
49 virtual QVector<QRectF> calculateLayout();
50 void initializeLayout();
50 void initializeLayout();
51
51
52 };
52 };
53
53
54 QT_CHARTS_END_NAMESPACE
54 QT_CHARTS_END_NAMESPACE
55
55
56 #endif // STACKEDBARCHARTITEM_H
56 #endif // STACKEDBARCHARTITEM_H
@@ -1,82 +1,82
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28
28
29 #ifndef BOXPLOTCHARTITEM_H
29 #ifndef BOXPLOTCHARTITEM_H
30 #define BOXPLOTCHARTITEM_H
30 #define BOXPLOTCHARTITEM_H
31
31
32 #include <private/boxwhiskers_p.h>
32 #include <private/boxwhiskers_p.h>
33 #include <QtCharts/QBoxPlotSeries>
33 #include <QtCharts/QBoxPlotSeries>
34 #include <private/chartitem_p.h>
34 #include <private/chartitem_p.h>
35 #include <private/boxplotanimation_p.h>
35 #include <private/boxplotanimation_p.h>
36 #include <QtCharts/QBoxSet>
36 #include <QtCharts/QBoxSet>
37 #include <QtWidgets/QGraphicsItem>
37 #include <QtWidgets/QGraphicsItem>
38
38
39 QT_CHARTS_BEGIN_NAMESPACE
39 QT_CHARTS_BEGIN_NAMESPACE
40
40
41 class BoxPlotSeriesPrivate;
41 class BoxPlotSeriesPrivate;
42
42
43 class BoxPlotChartItem : public ChartItem
43 class BoxPlotChartItem : public ChartItem
44 {
44 {
45 Q_OBJECT
45 Q_OBJECT
46 public:
46 public:
47 BoxPlotChartItem(QBoxPlotSeries *series, QGraphicsItem *item = 0);
47 BoxPlotChartItem(QBoxPlotSeries *series, QGraphicsItem *item = 0);
48 ~BoxPlotChartItem();
48 ~BoxPlotChartItem();
49
49
50 void setAnimation(BoxPlotAnimation *animation);
50 void setAnimation(BoxPlotAnimation *animation);
51
51
52 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
52 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
53 QRectF boundingRect() const;
53 QRectF boundingRect() const;
54
54
55 public Q_SLOTS:
55 public Q_SLOTS:
56 void handleDataStructureChanged();
56 void handleDataStructureChanged();
57 void handleDomainUpdated();
57 void handleDomainUpdated();
58 void handleLayoutChanged();
58 void handleLayoutChanged();
59 void handleUpdatedBars();
59 void handleUpdatedBars();
60 void handleBoxsetRemove(QList<QBoxSet *> barSets);
60 void handleBoxsetRemove(QList<QBoxSet *> barSets);
61
61
62 private:
62 private:
63 virtual QVector<QRectF> calculateLayout();
63 virtual QVector<QRectF> calculateLayout();
64 void initializeLayout();
64 void initializeLayout();
65 bool updateBoxGeometry(BoxWhiskers *box, int index);
65 bool updateBoxGeometry(BoxWhiskers *box, int index);
66
66
67 protected:
67 protected:
68 friend class QBoxPlotSeriesPrivate;
68 friend class QBoxPlotSeriesPrivate;
69 QBoxPlotSeries *m_series; // Not owned.
69 QBoxPlotSeries *m_series; // Not owned.
70 QList<BoxWhiskers *> m_boxes;
70 QList<BoxWhiskers *> m_boxes;
71 QHash<QBoxSet *, BoxWhiskers *> m_boxTable;
71 QHash<QBoxSet *, BoxWhiskers *> m_boxTable;
72 int m_seriesIndex;
72 int m_seriesIndex;
73 int m_seriesCount;
73 int m_seriesCount;
74
74
75 BoxPlotAnimation *m_animation;
75 BoxPlotAnimation *m_animation;
76
76
77 QRectF m_boundingRect;
77 QRectF m_boundingRect;
78 };
78 };
79
79
80 QT_CHARTS_END_NAMESPACE
80 QT_CHARTS_END_NAMESPACE
81
81
82 #endif // BOXPLOTCHARTITEM_H
82 #endif // BOXPLOTCHARTITEM_H
@@ -1,107 +1,107
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef BOXWHISKERS_H
28 #ifndef BOXWHISKERS_H
29 #define BOXWHISKERS_H
29 #define BOXWHISKERS_H
30
30
31 #include <private/boxwhiskersdata_p.h>
31 #include <private/boxwhiskersdata_p.h>
32 #include <QtCharts/QChartGlobal>
32 #include <QtCharts/QChartGlobal>
33 #include <private/abstractdomain_p.h>
33 #include <private/abstractdomain_p.h>
34 #include <QtCharts/QBoxSet>
34 #include <QtCharts/QBoxSet>
35 #include <QtWidgets/QGraphicsRectItem>
35 #include <QtWidgets/QGraphicsRectItem>
36 #include <QtWidgets/QGraphicsLineItem>
36 #include <QtWidgets/QGraphicsLineItem>
37 #include <QtWidgets/QGraphicsLayoutItem>
37 #include <QtWidgets/QGraphicsLayoutItem>
38 #include <QtGui/QPainterPath>
38 #include <QtGui/QPainterPath>
39
39
40 QT_CHARTS_BEGIN_NAMESPACE
40 QT_CHARTS_BEGIN_NAMESPACE
41
41
42 class QBarSet;
42 class QBarSet;
43
43
44 class BoxWhiskers : public QGraphicsObject
44 class BoxWhiskers : public QGraphicsObject
45 {
45 {
46 Q_OBJECT
46 Q_OBJECT
47
47
48 public:
48 public:
49 BoxWhiskers(QBoxSet *set, AbstractDomain *domain, QGraphicsObject *parent);
49 BoxWhiskers(QBoxSet *set, AbstractDomain *domain, QGraphicsObject *parent);
50 ~BoxWhiskers();
50 ~BoxWhiskers();
51
51
52 void setBrush(const QBrush &brush);
52 void setBrush(const QBrush &brush);
53 void setPen(const QPen &pen);
53 void setPen(const QPen &pen);
54 void setLayout(const BoxWhiskersData &data);
54 void setLayout(const BoxWhiskersData &data);
55 void setBoxOutlined(const bool outlined) { m_boxOutlined = outlined; }
55 void setBoxOutlined(const bool outlined) { m_boxOutlined = outlined; }
56 void setBoxWidth(const qreal width);
56 void setBoxWidth(const qreal width);
57
57
58 void mousePressEvent(QGraphicsSceneMouseEvent *event);
58 void mousePressEvent(QGraphicsSceneMouseEvent *event);
59 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
59 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
60 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
60 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
61 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
61 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
62 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
62 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
63
63
64 QRectF boundingRect() const;
64 QRectF boundingRect() const;
65 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
65 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
66
66
67 void updateGeometry(AbstractDomain *domain);
67 void updateGeometry(AbstractDomain *domain);
68 protected:
68 protected:
69 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
69 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
70 void setGeometry(const QRectF &rect);
70 void setGeometry(const QRectF &rect);
71
71
72 Q_SIGNALS:
72 Q_SIGNALS:
73 void clicked(QBoxSet *boxset);
73 void clicked(QBoxSet *boxset);
74 void hovered(bool status, QBoxSet *boxset);
74 void hovered(bool status, QBoxSet *boxset);
75 void pressed(QBoxSet *boxset);
75 void pressed(QBoxSet *boxset);
76 void released(QBoxSet *boxset);
76 void released(QBoxSet *boxset);
77 void doubleClicked(QBoxSet *boxset);
77 void doubleClicked(QBoxSet *boxset);
78
78
79 private:
79 private:
80 friend class BoxPlotChartItem;
80 friend class BoxPlotChartItem;
81 friend class BoxPlotAnimation;
81 friend class BoxPlotAnimation;
82
82
83 QBoxSet *m_boxSet;
83 QBoxSet *m_boxSet;
84 AbstractDomain *m_domain;
84 AbstractDomain *m_domain;
85 QPainterPath m_boxPath;
85 QPainterPath m_boxPath;
86 QRectF m_boundingRect;
86 QRectF m_boundingRect;
87 bool m_hovering;
87 bool m_hovering;
88 bool m_validData;
88 bool m_validData;
89 QBrush m_brush;
89 QBrush m_brush;
90 QPen m_pen;
90 QPen m_pen;
91 QPen m_medianPen;
91 QPen m_medianPen;
92 QPen m_outlinePen;
92 QPen m_outlinePen;
93 bool m_boxOutlined;
93 bool m_boxOutlined;
94 qreal m_boxWidth;
94 qreal m_boxWidth;
95 BoxWhiskersData m_data;
95 BoxWhiskersData m_data;
96 QSizeF m_domainSize;
96 QSizeF m_domainSize;
97 QRectF m_middleBox;
97 QRectF m_middleBox;
98 qreal m_geometryMedian;
98 qreal m_geometryMedian;
99 qreal m_geometryLeft;
99 qreal m_geometryLeft;
100 qreal m_geometryRight;
100 qreal m_geometryRight;
101
101
102 bool m_mousePressed;
102 bool m_mousePressed;
103 };
103 };
104
104
105 QT_CHARTS_END_NAMESPACE
105 QT_CHARTS_END_NAMESPACE
106
106
107 #endif // BOXWHISKERS_H
107 #endif // BOXWHISKERS_H
@@ -1,78 +1,78
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef BOXWHISKERSDATA_P_H
28 #ifndef BOXWHISKERSDATA_P_H
29 #define BOXWHISKERSDATA_P_H
29 #define BOXWHISKERSDATA_P_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <QtCore/QSizeF>
32 #include <QtCore/QSizeF>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class BoxWhiskersData
36 class BoxWhiskersData
37 {
37 {
38 public:
38 public:
39 BoxWhiskersData() :
39 BoxWhiskersData() :
40 m_lowerExtreme(0.0),
40 m_lowerExtreme(0.0),
41 m_lowerQuartile(0.0),
41 m_lowerQuartile(0.0),
42 m_median(0.0),
42 m_median(0.0),
43 m_upperQuartile(0.0),
43 m_upperQuartile(0.0),
44 m_upperExtreme(0.0),
44 m_upperExtreme(0.0),
45 m_index(0),
45 m_index(0),
46 m_boxItems(0),
46 m_boxItems(0),
47 m_maxX(0.0),
47 m_maxX(0.0),
48 m_minX(0.0),
48 m_minX(0.0),
49 m_maxY(0.0),
49 m_maxY(0.0),
50 m_minY(0.0),
50 m_minY(0.0),
51 m_seriesIndex(0),
51 m_seriesIndex(0),
52 m_seriesCount(0)
52 m_seriesCount(0)
53 {
53 {
54 }
54 }
55
55
56 // Box related statistics
56 // Box related statistics
57 qreal m_lowerExtreme;
57 qreal m_lowerExtreme;
58 qreal m_lowerQuartile;
58 qreal m_lowerQuartile;
59 qreal m_median;
59 qreal m_median;
60 qreal m_upperQuartile;
60 qreal m_upperQuartile;
61 qreal m_upperExtreme;
61 qreal m_upperExtreme;
62 int m_index;
62 int m_index;
63 int m_boxItems;
63 int m_boxItems;
64
64
65 // Domain boundaries, axis
65 // Domain boundaries, axis
66 qreal m_maxX;
66 qreal m_maxX;
67 qreal m_minX;
67 qreal m_minX;
68 qreal m_maxY;
68 qreal m_maxY;
69 qreal m_minY;
69 qreal m_minY;
70
70
71 // Serieses related data
71 // Serieses related data
72 int m_seriesIndex;
72 int m_seriesIndex;
73 int m_seriesCount;
73 int m_seriesCount;
74 };
74 };
75
75
76 QT_CHARTS_END_NAMESPACE
76 QT_CHARTS_END_NAMESPACE
77
77
78 #endif // BOXWHISKERSDATA_P_H
78 #endif // BOXWHISKERSDATA_P_H
@@ -1,93 +1,93
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QBOXPLOTMODELMAPPER_P_H
28 #ifndef QBOXPLOTMODELMAPPER_P_H
29 #define QBOXPLOTMODELMAPPER_P_H
29 #define QBOXPLOTMODELMAPPER_P_H
30
30
31 #include <QtCore/QObject>
31 #include <QtCore/QObject>
32 #include <QtCharts/QBoxPlotModelMapper>
32 #include <QtCharts/QBoxPlotModelMapper>
33
33
34 QT_BEGIN_NAMESPACE
34 QT_BEGIN_NAMESPACE
35 class QModelIndex;
35 class QModelIndex;
36 QT_END_NAMESPACE
36 QT_END_NAMESPACE
37
37
38 QT_CHARTS_BEGIN_NAMESPACE
38 QT_CHARTS_BEGIN_NAMESPACE
39
39
40 class QBoxSet;
40 class QBoxSet;
41
41
42 class QBoxPlotModelMapperPrivate : public QObject
42 class QBoxPlotModelMapperPrivate : public QObject
43 {
43 {
44 Q_OBJECT
44 Q_OBJECT
45 public:
45 public:
46 explicit QBoxPlotModelMapperPrivate(QBoxPlotModelMapper *q);
46 explicit QBoxPlotModelMapperPrivate(QBoxPlotModelMapper *q);
47
47
48 public Q_SLOTS:
48 public Q_SLOTS:
49 // for the model
49 // for the model
50 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
50 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
51 void modelHeaderDataUpdated(Qt::Orientation orientation, int first, int last);
51 void modelHeaderDataUpdated(Qt::Orientation orientation, int first, int last);
52 void modelRowsAdded(QModelIndex parent, int start, int end);
52 void modelRowsAdded(QModelIndex parent, int start, int end);
53 void modelRowsRemoved(QModelIndex parent, int start, int end);
53 void modelRowsRemoved(QModelIndex parent, int start, int end);
54 void modelColumnsAdded(QModelIndex parent, int start, int end);
54 void modelColumnsAdded(QModelIndex parent, int start, int end);
55 void modelColumnsRemoved(QModelIndex parent, int start, int end);
55 void modelColumnsRemoved(QModelIndex parent, int start, int end);
56 void handleModelDestroyed();
56 void handleModelDestroyed();
57
57
58 // for the series
58 // for the series
59 void boxSetsAdded(QList<QBoxSet *> sets);
59 void boxSetsAdded(QList<QBoxSet *> sets);
60 void boxSetsRemoved(QList<QBoxSet *> sets);
60 void boxSetsRemoved(QList<QBoxSet *> sets);
61 void boxValueChanged(int index);
61 void boxValueChanged(int index);
62 void handleSeriesDestroyed();
62 void handleSeriesDestroyed();
63
63
64 void initializeBoxFromModel();
64 void initializeBoxFromModel();
65
65
66 private:
66 private:
67 QBoxSet *boxSet(QModelIndex index);
67 QBoxSet *boxSet(QModelIndex index);
68 QModelIndex boxModelIndex(int boxSection, int posInBox);
68 QModelIndex boxModelIndex(int boxSection, int posInBox);
69 void insertData(int start, int end);
69 void insertData(int start, int end);
70 void removeData(int start, int end);
70 void removeData(int start, int end);
71 void blockModelSignals(bool block = true);
71 void blockModelSignals(bool block = true);
72 void blockSeriesSignals(bool block = true);
72 void blockSeriesSignals(bool block = true);
73
73
74 private:
74 private:
75 QBoxPlotSeries *m_series;
75 QBoxPlotSeries *m_series;
76 QList<QBoxSet *> m_boxSets;
76 QList<QBoxSet *> m_boxSets;
77 QAbstractItemModel *m_model;
77 QAbstractItemModel *m_model;
78 int m_first;
78 int m_first;
79 int m_count;
79 int m_count;
80 Qt::Orientation m_orientation;
80 Qt::Orientation m_orientation;
81 int m_firstBoxSetSection;
81 int m_firstBoxSetSection;
82 int m_lastBoxSetSection;
82 int m_lastBoxSetSection;
83 bool m_seriesSignalsBlock;
83 bool m_seriesSignalsBlock;
84 bool m_modelSignalsBlock;
84 bool m_modelSignalsBlock;
85
85
86 private:
86 private:
87 QBoxPlotModelMapper *q_ptr;
87 QBoxPlotModelMapper *q_ptr;
88 Q_DECLARE_PUBLIC(QBoxPlotModelMapper)
88 Q_DECLARE_PUBLIC(QBoxPlotModelMapper)
89 };
89 };
90
90
91 QT_CHARTS_END_NAMESPACE
91 QT_CHARTS_END_NAMESPACE
92
92
93 #endif // QBOXPLOTMODELMAPPER_P_H
93 #endif // QBOXPLOTMODELMAPPER_P_H
@@ -1,101 +1,101
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QBOXPLOTSERIES_P_H
28 #ifndef QBOXPLOTSERIES_P_H
29 #define QBOXPLOTSERIES_P_H
29 #define QBOXPLOTSERIES_P_H
30
30
31 #include <QtCharts/QBoxPlotSeries>
31 #include <QtCharts/QBoxPlotSeries>
32 #include <private/qabstractbarseries_p.h>
32 #include <private/qabstractbarseries_p.h>
33 #include <private/abstractdomain_p.h>
33 #include <private/abstractdomain_p.h>
34 #include <QtCharts/QBarSet>
34 #include <QtCharts/QBarSet>
35
35
36 QT_CHARTS_BEGIN_NAMESPACE
36 QT_CHARTS_BEGIN_NAMESPACE
37
37
38 class BoxPlotAnimation;
38 class BoxPlotAnimation;
39
39
40 class QBoxPlotSeriesPrivate : public QAbstractSeriesPrivate
40 class QBoxPlotSeriesPrivate : public QAbstractSeriesPrivate
41 {
41 {
42 Q_OBJECT
42 Q_OBJECT
43
43
44 public:
44 public:
45 QBoxPlotSeriesPrivate(QBoxPlotSeries *q);
45 QBoxPlotSeriesPrivate(QBoxPlotSeries *q);
46 ~QBoxPlotSeriesPrivate();
46 ~QBoxPlotSeriesPrivate();
47
47
48 void initializeGraphics(QGraphicsItem *parent);
48 void initializeGraphics(QGraphicsItem *parent);
49 void initializeDomain();
49 void initializeDomain();
50 void initializeAxes();
50 void initializeAxes();
51 void initializeAnimations(QChart::AnimationOptions options, int duration, QEasingCurve &curve);
51 void initializeAnimations(QChart::AnimationOptions options, int duration, QEasingCurve &curve);
52 void initializeTheme(int index, ChartTheme *theme, bool forced = false);
52 void initializeTheme(int index, ChartTheme *theme, bool forced = false);
53
53
54 QList<QLegendMarker*> createLegendMarkers(QLegend *legend);
54 QList<QLegendMarker*> createLegendMarkers(QLegend *legend);
55
55
56 virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
56 virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
57 QAbstractAxis *createDefaultAxis(Qt::Orientation orientation) const;
57 QAbstractAxis *createDefaultAxis(Qt::Orientation orientation) const;
58
58
59 bool append(QBoxSet *set);
59 bool append(QBoxSet *set);
60 bool remove(QBoxSet *set);
60 bool remove(QBoxSet *set);
61 bool append(QList<QBoxSet *> sets);
61 bool append(QList<QBoxSet *> sets);
62 bool remove(QList<QBoxSet *> sets);
62 bool remove(QList<QBoxSet *> sets);
63 bool insert(int index, QBoxSet *set);
63 bool insert(int index, QBoxSet *set);
64 QBoxSet *boxSetAt(int index);
64 QBoxSet *boxSetAt(int index);
65
65
66 qreal max();
66 qreal max();
67 qreal min();
67 qreal min();
68
68
69 private:
69 private:
70 void populateCategories(QBarCategoryAxis *axis);
70 void populateCategories(QBarCategoryAxis *axis);
71
71
72 Q_SIGNALS:
72 Q_SIGNALS:
73 void updated();
73 void updated();
74 void clicked(int index, QBoxSet *barset);
74 void clicked(int index, QBoxSet *barset);
75 void pressed(int index, QBoxSet *barset);
75 void pressed(int index, QBoxSet *barset);
76 void released(int index, QBoxSet *barset);
76 void released(int index, QBoxSet *barset);
77 void doubleClicked(int index, QBoxSet *barset);
77 void doubleClicked(int index, QBoxSet *barset);
78 void updatedBoxes();
78 void updatedBoxes();
79 void updatedLayout();
79 void updatedLayout();
80 void restructuredBoxes();
80 void restructuredBoxes();
81
81
82 private Q_SLOTS:
82 private Q_SLOTS:
83 void handleSeriesChange(QAbstractSeries *series);
83 void handleSeriesChange(QAbstractSeries *series);
84 void handleSeriesRemove(QAbstractSeries *series);
84 void handleSeriesRemove(QAbstractSeries *series);
85
85
86 protected:
86 protected:
87 QList<QBoxSet *> m_boxSets;
87 QList<QBoxSet *> m_boxSets;
88 QPen m_pen;
88 QPen m_pen;
89 QBrush m_brush;
89 QBrush m_brush;
90 bool m_boxOutlineVisible;
90 bool m_boxOutlineVisible;
91 int m_index;
91 int m_index;
92 BoxPlotAnimation *m_animation;
92 BoxPlotAnimation *m_animation;
93 qreal m_boxWidth;
93 qreal m_boxWidth;
94
94
95 private:
95 private:
96 Q_DECLARE_PUBLIC(QBoxPlotSeries)
96 Q_DECLARE_PUBLIC(QBoxPlotSeries)
97 };
97 };
98
98
99 QT_CHARTS_END_NAMESPACE
99 QT_CHARTS_END_NAMESPACE
100
100
101 #endif
101 #endif
@@ -1,82 +1,82
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QBOXSET_P_H
28 #ifndef QBOXSET_P_H
29 #define QBOXSET_P_H
29 #define QBOXSET_P_H
30
30
31 #include <QtCharts/QBoxSet>
31 #include <QtCharts/QBoxSet>
32 #include <QtCore/QMap>
32 #include <QtCore/QMap>
33 #include <QtGui/QPen>
33 #include <QtGui/QPen>
34 #include <QtGui/QBrush>
34 #include <QtGui/QBrush>
35 #include <QtGui/QFont>
35 #include <QtGui/QFont>
36
36
37 QT_CHARTS_BEGIN_NAMESPACE
37 QT_CHARTS_BEGIN_NAMESPACE
38
38
39 class QBoxPlotSeriesPrivate;
39 class QBoxPlotSeriesPrivate;
40
40
41 class QBoxSetPrivate : public QObject
41 class QBoxSetPrivate : public QObject
42 {
42 {
43 Q_OBJECT
43 Q_OBJECT
44
44
45 public:
45 public:
46 QBoxSetPrivate(const QString label, QBoxSet *parent);
46 QBoxSetPrivate(const QString label, QBoxSet *parent);
47 ~QBoxSetPrivate();
47 ~QBoxSetPrivate();
48
48
49 bool append(qreal value);
49 bool append(qreal value);
50 bool append(QList<qreal> values);
50 bool append(QList<qreal> values);
51
51
52 int remove(const int index, const int count);
52 int remove(const int index, const int count);
53 void clear();
53 void clear();
54
54
55 void setValue(const int index, const qreal value);
55 void setValue(const int index, const qreal value);
56
56
57 qreal value(const int index);
57 qreal value(const int index);
58
58
59 Q_SIGNALS:
59 Q_SIGNALS:
60 void restructuredBox();
60 void restructuredBox();
61 void updatedBox();
61 void updatedBox();
62 void updatedLayout();
62 void updatedLayout();
63
63
64 private:
64 private:
65 const QBoxSet *q_ptr;
65 const QBoxSet *q_ptr;
66 QString m_label;
66 QString m_label;
67 const int m_valuesCount;
67 const int m_valuesCount;
68 qreal *m_values;
68 qreal *m_values;
69 int m_appendCount;
69 int m_appendCount;
70 QPen m_pen;
70 QPen m_pen;
71 QBrush m_brush;
71 QBrush m_brush;
72 QBrush m_labelBrush;
72 QBrush m_labelBrush;
73 QFont m_labelFont;
73 QFont m_labelFont;
74 QBoxPlotSeriesPrivate *m_series;
74 QBoxPlotSeriesPrivate *m_series;
75
75
76 friend class QBoxSet;
76 friend class QBoxSet;
77 friend class QBoxPlotSeriesPrivate;
77 friend class QBoxPlotSeriesPrivate;
78 };
78 };
79
79
80 QT_CHARTS_END_NAMESPACE
80 QT_CHARTS_END_NAMESPACE
81
81
82 #endif // QBOXSET_P_H
82 #endif // QBOXSET_P_H
@@ -1,63 +1,63
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTBACKGROUND_H
28 #ifndef CHARTBACKGROUND_H
29 #define CHARTBACKGROUND_H
29 #define CHARTBACKGROUND_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <QtWidgets/QGraphicsRectItem>
32 #include <QtWidgets/QGraphicsRectItem>
33
33
34 QT_BEGIN_NAMESPACE
34 QT_BEGIN_NAMESPACE
35 class QGraphicsDropShadowEffect;
35 class QGraphicsDropShadowEffect;
36 QT_END_NAMESPACE
36 QT_END_NAMESPACE
37
37
38 QT_CHARTS_BEGIN_NAMESPACE
38 QT_CHARTS_BEGIN_NAMESPACE
39
39
40 class ChartBackground: public QGraphicsRectItem
40 class ChartBackground: public QGraphicsRectItem
41 {
41 {
42 public:
42 public:
43 ChartBackground(QGraphicsItem *parent = 0);
43 ChartBackground(QGraphicsItem *parent = 0);
44 ~ChartBackground();
44 ~ChartBackground();
45
45
46 void setDiameter(qreal diameter);
46 void setDiameter(qreal diameter);
47 qreal diameter() const;
47 qreal diameter() const;
48 void setDropShadowEnabled(bool enabled);
48 void setDropShadowEnabled(bool enabled);
49 bool isDropShadowEnabled() { return m_dropShadow != 0; }
49 bool isDropShadowEnabled() { return m_dropShadow != 0; }
50
50
51 protected:
51 protected:
52 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
52 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
53
53
54 private:
54 private:
55 qreal m_diameter;
55 qreal m_diameter;
56 QGraphicsDropShadowEffect *m_dropShadow;
56 QGraphicsDropShadowEffect *m_dropShadow;
57 };
57 };
58
58
59 QT_CHARTS_END_NAMESPACE
59 QT_CHARTS_END_NAMESPACE
60
60
61 #endif /* CHARTBACKGROUND_H */
61 #endif /* CHARTBACKGROUND_H */
62
62
63
63
@@ -1,58 +1,58
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTCONFIG_H
28 #ifndef CHARTCONFIG_H
29 #define CHARTCONFIG_H
29 #define CHARTCONFIG_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class ChartConfig
35 class ChartConfig
36 {
36 {
37 private:
37 private:
38 ChartConfig() {
38 ChartConfig() {
39 m_instance = this;
39 m_instance = this;
40 }
40 }
41 public:
41 public:
42 static ChartConfig *instance() {
42 static ChartConfig *instance() {
43 if (!m_instance) {
43 if (!m_instance) {
44 m_instance = new ChartConfig();
44 m_instance = new ChartConfig();
45 }
45 }
46 return m_instance;
46 return m_instance;
47 }
47 }
48
48
49 private:
49 private:
50 static ChartConfig *m_instance;
50 static ChartConfig *m_instance;
51 };
51 };
52
52
53
53
54 ChartConfig *ChartConfig::m_instance = 0;
54 ChartConfig *ChartConfig::m_instance = 0;
55
55
56 QT_CHARTS_END_NAMESPACE
56 QT_CHARTS_END_NAMESPACE
57
57
58 #endif
58 #endif
@@ -1,92 +1,92
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTDATASET_P_H
28 #ifndef CHARTDATASET_P_H
29 #define CHARTDATASET_P_H
29 #define CHARTDATASET_P_H
30
30
31 #include <QtCharts/QAbstractSeries>
31 #include <QtCharts/QAbstractSeries>
32 #include <private/abstractdomain_p.h>
32 #include <private/abstractdomain_p.h>
33 #include <private/qabstractaxis_p.h>
33 #include <private/qabstractaxis_p.h>
34 #include <QtCore/QVector>
34 #include <QtCore/QVector>
35
35
36 QT_CHARTS_BEGIN_NAMESPACE
36 QT_CHARTS_BEGIN_NAMESPACE
37
37
38 class QAbstractAxis;
38 class QAbstractAxis;
39 class ChartPresenter;
39 class ChartPresenter;
40
40
41 class QT_CHARTS_AUTOTEST_EXPORT ChartDataSet : public QObject
41 class QT_CHARTS_AUTOTEST_EXPORT ChartDataSet : public QObject
42 {
42 {
43 Q_OBJECT
43 Q_OBJECT
44 public:
44 public:
45 ChartDataSet(QChart *chart);
45 ChartDataSet(QChart *chart);
46 virtual ~ChartDataSet();
46 virtual ~ChartDataSet();
47
47
48 void addSeries(QAbstractSeries *series);
48 void addSeries(QAbstractSeries *series);
49 void removeSeries(QAbstractSeries *series);
49 void removeSeries(QAbstractSeries *series);
50 QList<QAbstractSeries *> series() const;
50 QList<QAbstractSeries *> series() const;
51
51
52 void addAxis(QAbstractAxis *axis,Qt::Alignment aligment);
52 void addAxis(QAbstractAxis *axis,Qt::Alignment aligment);
53 void removeAxis(QAbstractAxis *axis);
53 void removeAxis(QAbstractAxis *axis);
54 QList<QAbstractAxis*> axes() const;
54 QList<QAbstractAxis*> axes() const;
55
55
56 bool attachAxis(QAbstractSeries* series,QAbstractAxis *axis);
56 bool attachAxis(QAbstractSeries* series,QAbstractAxis *axis);
57 bool detachAxis(QAbstractSeries* series,QAbstractAxis *axis);
57 bool detachAxis(QAbstractSeries* series,QAbstractAxis *axis);
58
58
59 void createDefaultAxes();
59 void createDefaultAxes();
60
60
61 void zoomInDomain(const QRectF &rect);
61 void zoomInDomain(const QRectF &rect);
62 void zoomOutDomain(const QRectF &rect);
62 void zoomOutDomain(const QRectF &rect);
63 void zoomResetDomain();
63 void zoomResetDomain();
64 bool isZoomedDomain();
64 bool isZoomedDomain();
65 void scrollDomain(qreal dx, qreal dy);
65 void scrollDomain(qreal dx, qreal dy);
66
66
67 QPointF mapToValue(const QPointF &position, QAbstractSeries *series = 0);
67 QPointF mapToValue(const QPointF &position, QAbstractSeries *series = 0);
68 QPointF mapToPosition(const QPointF &value, QAbstractSeries *series = 0);
68 QPointF mapToPosition(const QPointF &value, QAbstractSeries *series = 0);
69
69
70 Q_SIGNALS:
70 Q_SIGNALS:
71 void axisAdded(QAbstractAxis* axis);
71 void axisAdded(QAbstractAxis* axis);
72 void axisRemoved(QAbstractAxis* axis);
72 void axisRemoved(QAbstractAxis* axis);
73 void seriesAdded(QAbstractSeries* series);
73 void seriesAdded(QAbstractSeries* series);
74 void seriesRemoved(QAbstractSeries* series);
74 void seriesRemoved(QAbstractSeries* series);
75
75
76 private:
76 private:
77 void createAxes(QAbstractAxis::AxisTypes type, Qt::Orientation orientation);
77 void createAxes(QAbstractAxis::AxisTypes type, Qt::Orientation orientation);
78 QAbstractAxis *createAxis(QAbstractAxis::AxisType type, Qt::Orientation orientation);
78 QAbstractAxis *createAxis(QAbstractAxis::AxisType type, Qt::Orientation orientation);
79 AbstractDomain::DomainType selectDomain(QList<QAbstractAxis* > axes);
79 AbstractDomain::DomainType selectDomain(QList<QAbstractAxis* > axes);
80 AbstractDomain* createDomain(AbstractDomain::DomainType type);
80 AbstractDomain* createDomain(AbstractDomain::DomainType type);
81 void deleteAllAxes();
81 void deleteAllAxes();
82 void deleteAllSeries();
82 void deleteAllSeries();
83 void findMinMaxForSeries(QList<QAbstractSeries *> series,Qt::Orientations orientation, qreal &min, qreal &max);
83 void findMinMaxForSeries(QList<QAbstractSeries *> series,Qt::Orientations orientation, qreal &min, qreal &max);
84 private:
84 private:
85 QList<QAbstractSeries *> m_seriesList;
85 QList<QAbstractSeries *> m_seriesList;
86 QList<QAbstractAxis *> m_axisList;
86 QList<QAbstractAxis *> m_axisList;
87 QChart* m_chart;
87 QChart* m_chart;
88 };
88 };
89
89
90 QT_CHARTS_END_NAMESPACE
90 QT_CHARTS_END_NAMESPACE
91
91
92 #endif /* CHARTENGINE_P_H */
92 #endif /* CHARTENGINE_P_H */
@@ -1,63 +1,63
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTELEMENT_H
28 #ifndef CHARTELEMENT_H
29 #define CHARTELEMENT_H
29 #define CHARTELEMENT_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <QtCore/QObject>
32 #include <QtCore/QObject>
33 #include <QtCore/QRect>
33 #include <QtCore/QRect>
34 #include <QGraphicsObject>
34 #include <QGraphicsObject>
35
35
36 QT_CHARTS_BEGIN_NAMESPACE
36 QT_CHARTS_BEGIN_NAMESPACE
37
37
38 class ChartAnimator;
38 class ChartAnimator;
39 class ChartPresenter;
39 class ChartPresenter;
40 class ChartAnimation;
40 class ChartAnimation;
41 class ChartThemeManager;
41 class ChartThemeManager;
42 class AbstractDomain;
42 class AbstractDomain;
43
43
44 class ChartElement: public QGraphicsObject
44 class ChartElement: public QGraphicsObject
45 {
45 {
46
46
47 public:
47 public:
48 explicit ChartElement(QGraphicsItem* item = 0);
48 explicit ChartElement(QGraphicsItem* item = 0);
49
49
50 virtual ChartAnimation *animation() const { return 0; }
50 virtual ChartAnimation *animation() const { return 0; }
51 virtual void setPresenter(ChartPresenter *presenter);
51 virtual void setPresenter(ChartPresenter *presenter);
52 ChartPresenter *presenter() const;
52 ChartPresenter *presenter() const;
53 virtual void setThemeManager(ChartThemeManager *manager);
53 virtual void setThemeManager(ChartThemeManager *manager);
54 ChartThemeManager* themeManager() const;
54 ChartThemeManager* themeManager() const;
55
55
56 private:
56 private:
57 ChartPresenter *m_presenter;
57 ChartPresenter *m_presenter;
58 ChartThemeManager *m_themeManager;
58 ChartThemeManager *m_themeManager;
59 };
59 };
60
60
61 QT_CHARTS_END_NAMESPACE
61 QT_CHARTS_END_NAMESPACE
62
62
63 #endif
63 #endif
@@ -1,53 +1,53
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTHELPERS_P_H
28 #ifndef CHARTHELPERS_P_H
29 #define CHARTHELPERS_P_H
29 #define CHARTHELPERS_P_H
30
30
31 #include <QtCore/QtNumeric>
31 #include <QtCore/QtNumeric>
32 #include <QtCore/QPointF>
32 #include <QtCore/QPointF>
33
33
34 static inline bool isValidValue(qreal value)
34 static inline bool isValidValue(qreal value)
35 {
35 {
36 if (qIsNaN(value) || qIsInf(value)) {
36 if (qIsNaN(value) || qIsInf(value)) {
37 qWarning("Ignored NaN, Inf, or -Inf value.");
37 qWarning("Ignored NaN, Inf, or -Inf value.");
38 return false;
38 return false;
39 }
39 }
40 return true;
40 return true;
41 }
41 }
42
42
43 static inline bool isValidValue(qreal x, qreal y)
43 static inline bool isValidValue(qreal x, qreal y)
44 {
44 {
45 return (isValidValue(x) && isValidValue(y));
45 return (isValidValue(x) && isValidValue(y));
46 }
46 }
47
47
48 static inline bool isValidValue(const QPointF point)
48 static inline bool isValidValue(const QPointF point)
49 {
49 {
50 return (isValidValue(point.x()) && isValidValue(point.y()));
50 return (isValidValue(point.x()) && isValidValue(point.y()));
51 }
51 }
52
52
53 #endif // CHARTHELPERS_P_H
53 #endif // CHARTHELPERS_P_H
@@ -1,58 +1,58
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTITEM_H
28 #ifndef CHARTITEM_H
29 #define CHARTITEM_H
29 #define CHARTITEM_H
30
30
31 #include <private/chartelement_p.h>
31 #include <private/chartelement_p.h>
32 #include <private/chartpresenter_p.h>
32 #include <private/chartpresenter_p.h>
33 #include <QtWidgets/QGraphicsItem>
33 #include <QtWidgets/QGraphicsItem>
34
34
35 QT_CHARTS_BEGIN_NAMESPACE
35 QT_CHARTS_BEGIN_NAMESPACE
36
36
37 class ChartItem : public ChartElement
37 class ChartItem : public ChartElement
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40 enum ChartItemTypes { AXIS_ITEM = UserType + 1, XYLINE_ITEM };
40 enum ChartItemTypes { AXIS_ITEM = UserType + 1, XYLINE_ITEM };
41 public:
41 public:
42 ChartItem(QAbstractSeriesPrivate *series,QGraphicsItem* item);
42 ChartItem(QAbstractSeriesPrivate *series,QGraphicsItem* item);
43 AbstractDomain* domain() const;
43 AbstractDomain* domain() const;
44 public Q_SLOTS:
44 public Q_SLOTS:
45 virtual void handleDomainUpdated();
45 virtual void handleDomainUpdated();
46
46
47 void reversePainter(QPainter *painter, const QRectF &clipRect);
47 void reversePainter(QPainter *painter, const QRectF &clipRect);
48 QAbstractSeriesPrivate* seriesPrivate() const {return m_series;}
48 QAbstractSeriesPrivate* seriesPrivate() const {return m_series;}
49
49
50 protected:
50 protected:
51 bool m_validData;
51 bool m_validData;
52 private:
52 private:
53 QAbstractSeriesPrivate* m_series;
53 QAbstractSeriesPrivate* m_series;
54 };
54 };
55
55
56 QT_CHARTS_END_NAMESPACE
56 QT_CHARTS_END_NAMESPACE
57
57
58 #endif /* CHARTITEM_H */
58 #endif /* CHARTITEM_H */
@@ -1,199 +1,199
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTPRESENTER_H
28 #ifndef CHARTPRESENTER_H
29 #define CHARTPRESENTER_H
29 #define CHARTPRESENTER_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <QtCharts/QChart> //because of QChart::ChartThemeId
32 #include <QtCharts/QChart> //because of QChart::ChartThemeId
33 #include <QtCore/QRectF>
33 #include <QtCore/QRectF>
34 #include <QtCore/QMargins>
34 #include <QtCore/QMargins>
35 #include <QtCore/QLocale>
35 #include <QtCore/QLocale>
36
36
37 QT_CHARTS_BEGIN_NAMESPACE
37 QT_CHARTS_BEGIN_NAMESPACE
38
38
39 class ChartItem;
39 class ChartItem;
40 class AxisItem;
40 class AxisItem;
41 class QAbstractSeries;
41 class QAbstractSeries;
42 class ChartDataSet;
42 class ChartDataSet;
43 class AbstractDomain;
43 class AbstractDomain;
44 class ChartAxisElement;
44 class ChartAxisElement;
45 class ChartAnimator;
45 class ChartAnimator;
46 class ChartBackground;
46 class ChartBackground;
47 class ChartTitle;
47 class ChartTitle;
48 class ChartAnimation;
48 class ChartAnimation;
49 class AbstractChartLayout;
49 class AbstractChartLayout;
50
50
51 class ChartPresenter: public QObject
51 class ChartPresenter: public QObject
52 {
52 {
53 Q_OBJECT
53 Q_OBJECT
54 public:
54 public:
55 enum ZValues {
55 enum ZValues {
56 BackgroundZValue = -1,
56 BackgroundZValue = -1,
57 PlotAreaZValue,
57 PlotAreaZValue,
58 ShadesZValue,
58 ShadesZValue,
59 GridZValue,
59 GridZValue,
60 AxisZValue,
60 AxisZValue,
61 SeriesZValue,
61 SeriesZValue,
62 LineChartZValue = SeriesZValue,
62 LineChartZValue = SeriesZValue,
63 SplineChartZValue = SeriesZValue,
63 SplineChartZValue = SeriesZValue,
64 BarSeriesZValue = SeriesZValue,
64 BarSeriesZValue = SeriesZValue,
65 ScatterSeriesZValue = SeriesZValue,
65 ScatterSeriesZValue = SeriesZValue,
66 PieSeriesZValue = SeriesZValue,
66 PieSeriesZValue = SeriesZValue,
67 BoxPlotSeriesZValue = SeriesZValue,
67 BoxPlotSeriesZValue = SeriesZValue,
68 LegendZValue,
68 LegendZValue,
69 TopMostZValue
69 TopMostZValue
70 };
70 };
71
71
72 enum State {
72 enum State {
73 ShowState,
73 ShowState,
74 ScrollUpState,
74 ScrollUpState,
75 ScrollDownState,
75 ScrollDownState,
76 ScrollLeftState,
76 ScrollLeftState,
77 ScrollRightState,
77 ScrollRightState,
78 ZoomInState,
78 ZoomInState,
79 ZoomOutState
79 ZoomOutState
80 };
80 };
81
81
82 ChartPresenter(QChart *chart, QChart::ChartType type);
82 ChartPresenter(QChart *chart, QChart::ChartType type);
83 virtual ~ChartPresenter();
83 virtual ~ChartPresenter();
84
84
85
85
86 void setGeometry(QRectF rect);
86 void setGeometry(QRectF rect);
87 QRectF geometry() const;
87 QRectF geometry() const;
88
88
89 QGraphicsItem *rootItem(){ return m_chart; }
89 QGraphicsItem *rootItem(){ return m_chart; }
90 ChartBackground *backgroundElement();
90 ChartBackground *backgroundElement();
91 QAbstractGraphicsShapeItem *plotAreaElement();
91 QAbstractGraphicsShapeItem *plotAreaElement();
92 ChartTitle *titleElement();
92 ChartTitle *titleElement();
93 QList<ChartAxisElement *> axisItems() const;
93 QList<ChartAxisElement *> axisItems() const;
94 QList<ChartItem *> chartItems() const;
94 QList<ChartItem *> chartItems() const;
95
95
96 QLegend *legend();
96 QLegend *legend();
97
97
98 void setBackgroundBrush(const QBrush &brush);
98 void setBackgroundBrush(const QBrush &brush);
99 QBrush backgroundBrush() const;
99 QBrush backgroundBrush() const;
100
100
101 void setBackgroundPen(const QPen &pen);
101 void setBackgroundPen(const QPen &pen);
102 QPen backgroundPen() const;
102 QPen backgroundPen() const;
103
103
104 void setBackgroundRoundness(qreal diameter);
104 void setBackgroundRoundness(qreal diameter);
105 qreal backgroundRoundness() const;
105 qreal backgroundRoundness() const;
106
106
107 void setPlotAreaBackgroundBrush(const QBrush &brush);
107 void setPlotAreaBackgroundBrush(const QBrush &brush);
108 QBrush plotAreaBackgroundBrush() const;
108 QBrush plotAreaBackgroundBrush() const;
109
109
110 void setPlotAreaBackgroundPen(const QPen &pen);
110 void setPlotAreaBackgroundPen(const QPen &pen);
111 QPen plotAreaBackgroundPen() const;
111 QPen plotAreaBackgroundPen() const;
112
112
113 void setTitle(const QString &title);
113 void setTitle(const QString &title);
114 QString title() const;
114 QString title() const;
115
115
116 void setTitleFont(const QFont &font);
116 void setTitleFont(const QFont &font);
117 QFont titleFont() const;
117 QFont titleFont() const;
118
118
119 void setTitleBrush(const QBrush &brush);
119 void setTitleBrush(const QBrush &brush);
120 QBrush titleBrush() const;
120 QBrush titleBrush() const;
121
121
122 void setBackgroundVisible(bool visible);
122 void setBackgroundVisible(bool visible);
123 bool isBackgroundVisible() const;
123 bool isBackgroundVisible() const;
124
124
125 void setPlotAreaBackgroundVisible(bool visible);
125 void setPlotAreaBackgroundVisible(bool visible);
126 bool isPlotAreaBackgroundVisible() const;
126 bool isPlotAreaBackgroundVisible() const;
127
127
128 void setBackgroundDropShadowEnabled(bool enabled);
128 void setBackgroundDropShadowEnabled(bool enabled);
129 bool isBackgroundDropShadowEnabled() const;
129 bool isBackgroundDropShadowEnabled() const;
130
130
131 void setLocalizeNumbers(bool localize);
131 void setLocalizeNumbers(bool localize);
132 inline bool localizeNumbers() const { return m_localizeNumbers; }
132 inline bool localizeNumbers() const { return m_localizeNumbers; }
133 void setLocale(const QLocale &locale);
133 void setLocale(const QLocale &locale);
134 inline const QLocale &locale() const { return m_locale; }
134 inline const QLocale &locale() const { return m_locale; }
135
135
136 void setVisible(bool visible);
136 void setVisible(bool visible);
137
137
138 void setAnimationOptions(QChart::AnimationOptions options);
138 void setAnimationOptions(QChart::AnimationOptions options);
139 QChart::AnimationOptions animationOptions() const;
139 QChart::AnimationOptions animationOptions() const;
140 void setAnimationDuration(int msecs);
140 void setAnimationDuration(int msecs);
141 int animationDuration() const { return m_animationDuration; }
141 int animationDuration() const { return m_animationDuration; }
142 void setAnimationEasingCurve(const QEasingCurve &curve);
142 void setAnimationEasingCurve(const QEasingCurve &curve);
143 QEasingCurve animationEasingCurve() const { return m_animationCurve; }
143 QEasingCurve animationEasingCurve() const { return m_animationCurve; }
144
144
145 void startAnimation(ChartAnimation *animation);
145 void startAnimation(ChartAnimation *animation);
146
146
147 void setState(State state,QPointF point);
147 void setState(State state,QPointF point);
148 State state() const { return m_state; }
148 State state() const { return m_state; }
149 QPointF statePoint() const { return m_statePoint; }
149 QPointF statePoint() const { return m_statePoint; }
150 AbstractChartLayout *layout();
150 AbstractChartLayout *layout();
151
151
152 QChart::ChartType chartType() const { return m_chart->chartType(); }
152 QChart::ChartType chartType() const { return m_chart->chartType(); }
153 QChart *chart() { return m_chart; }
153 QChart *chart() { return m_chart; }
154
154
155 static QRectF textBoundingRect(const QFont &font, const QString &text, qreal angle = 0.0);
155 static QRectF textBoundingRect(const QFont &font, const QString &text, qreal angle = 0.0);
156 static QString truncatedText(const QFont &font, const QString &text, qreal angle,
156 static QString truncatedText(const QFont &font, const QString &text, qreal angle,
157 qreal maxWidth, qreal maxHeight, QRectF &boundingRect);
157 qreal maxWidth, qreal maxHeight, QRectF &boundingRect);
158 inline static qreal textMargin() { return qreal(0.5); }
158 inline static qreal textMargin() { return qreal(0.5); }
159
159
160 QString numberToString(double value, char f = 'g', int prec = 6);
160 QString numberToString(double value, char f = 'g', int prec = 6);
161 QString numberToString(int value);
161 QString numberToString(int value);
162
162
163 private:
163 private:
164 void createBackgroundItem();
164 void createBackgroundItem();
165 void createPlotAreaBackgroundItem();
165 void createPlotAreaBackgroundItem();
166 void createTitleItem();
166 void createTitleItem();
167
167
168 public Q_SLOTS:
168 public Q_SLOTS:
169 void handleSeriesAdded(QAbstractSeries *series);
169 void handleSeriesAdded(QAbstractSeries *series);
170 void handleSeriesRemoved(QAbstractSeries *series);
170 void handleSeriesRemoved(QAbstractSeries *series);
171 void handleAxisAdded(QAbstractAxis *axis);
171 void handleAxisAdded(QAbstractAxis *axis);
172 void handleAxisRemoved(QAbstractAxis *axis);
172 void handleAxisRemoved(QAbstractAxis *axis);
173
173
174 Q_SIGNALS:
174 Q_SIGNALS:
175 void plotAreaChanged(const QRectF &plotArea);
175 void plotAreaChanged(const QRectF &plotArea);
176
176
177 private:
177 private:
178 QChart *m_chart;
178 QChart *m_chart;
179 QList<ChartItem *> m_chartItems;
179 QList<ChartItem *> m_chartItems;
180 QList<ChartAxisElement *> m_axisItems;
180 QList<ChartAxisElement *> m_axisItems;
181 QList<QAbstractSeries *> m_series;
181 QList<QAbstractSeries *> m_series;
182 QList<QAbstractAxis *> m_axes;
182 QList<QAbstractAxis *> m_axes;
183 QChart::AnimationOptions m_options;
183 QChart::AnimationOptions m_options;
184 int m_animationDuration;
184 int m_animationDuration;
185 QEasingCurve m_animationCurve;
185 QEasingCurve m_animationCurve;
186 State m_state;
186 State m_state;
187 QPointF m_statePoint;
187 QPointF m_statePoint;
188 AbstractChartLayout *m_layout;
188 AbstractChartLayout *m_layout;
189 ChartBackground *m_background;
189 ChartBackground *m_background;
190 QAbstractGraphicsShapeItem *m_plotAreaBackground;
190 QAbstractGraphicsShapeItem *m_plotAreaBackground;
191 ChartTitle *m_title;
191 ChartTitle *m_title;
192 QRectF m_rect;
192 QRectF m_rect;
193 bool m_localizeNumbers;
193 bool m_localizeNumbers;
194 QLocale m_locale;
194 QLocale m_locale;
195 };
195 };
196
196
197 QT_CHARTS_END_NAMESPACE
197 QT_CHARTS_END_NAMESPACE
198
198
199 #endif /* CHARTPRESENTER_H */
199 #endif /* CHARTPRESENTER_H */
@@ -1,82 +1,82
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTTHEMEMANAGER_H
28 #ifndef CHARTTHEMEMANAGER_H
29 #define CHARTTHEMEMANAGER_H
29 #define CHARTTHEMEMANAGER_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <QtCharts/QChart>
32 #include <QtCharts/QChart>
33 #include <QtGui/QColor>
33 #include <QtGui/QColor>
34 #include <QtGui/QGradientStops>
34 #include <QtGui/QGradientStops>
35
35
36 QT_CHARTS_BEGIN_NAMESPACE
36 QT_CHARTS_BEGIN_NAMESPACE
37 class ChartTheme;
37 class ChartTheme;
38
38
39 class ChartThemeManager: public QObject
39 class ChartThemeManager: public QObject
40 {
40 {
41 Q_OBJECT
41 Q_OBJECT
42 public:
42 public:
43 enum BackgroundShadesMode {
43 enum BackgroundShadesMode {
44 BackgroundShadesNone = 0,
44 BackgroundShadesNone = 0,
45 BackgroundShadesVertical,
45 BackgroundShadesVertical,
46 BackgroundShadesHorizontal,
46 BackgroundShadesHorizontal,
47 BackgroundShadesBoth
47 BackgroundShadesBoth
48 };
48 };
49
49
50 public:
50 public:
51 explicit ChartThemeManager(QChart* chart);
51 explicit ChartThemeManager(QChart* chart);
52 void setTheme(QChart::ChartTheme theme);
52 void setTheme(QChart::ChartTheme theme);
53 ChartTheme* theme() const { return m_theme.data(); }
53 ChartTheme* theme() const { return m_theme.data(); }
54 void decorateChart(QChart *chart, ChartTheme* theme) const;
54 void decorateChart(QChart *chart, ChartTheme* theme) const;
55 void decorateLegend(QLegend *legend, ChartTheme* theme) const;
55 void decorateLegend(QLegend *legend, ChartTheme* theme) const;
56 void updateSeries(QAbstractSeries *series);
56 void updateSeries(QAbstractSeries *series);
57
57
58 public:
58 public:
59 static QList<QGradient> generateSeriesGradients(const QList<QColor>& colors);
59 static QList<QGradient> generateSeriesGradients(const QList<QColor>& colors);
60 static QColor colorAt(const QColor &start, const QColor &end, qreal pos);
60 static QColor colorAt(const QColor &start, const QColor &end, qreal pos);
61 static QColor colorAt(const QGradient &gradient, qreal pos);
61 static QColor colorAt(const QGradient &gradient, qreal pos);
62
62
63 private:
63 private:
64 int createIndexKey(QList<int> keys) const;
64 int createIndexKey(QList<int> keys) const;
65 int seriesCount(QAbstractSeries::SeriesType type) const;
65 int seriesCount(QAbstractSeries::SeriesType type) const;
66
66
67 public Q_SLOTS:
67 public Q_SLOTS:
68 void handleSeriesAdded(QAbstractSeries *series);
68 void handleSeriesAdded(QAbstractSeries *series);
69 void handleSeriesRemoved(QAbstractSeries *series);
69 void handleSeriesRemoved(QAbstractSeries *series);
70 void handleAxisAdded(QAbstractAxis *axis);
70 void handleAxisAdded(QAbstractAxis *axis);
71 void handleAxisRemoved(QAbstractAxis *axis);
71 void handleAxisRemoved(QAbstractAxis *axis);
72
72
73 protected:
73 protected:
74 QScopedPointer<ChartTheme> m_theme;
74 QScopedPointer<ChartTheme> m_theme;
75 QMap<QAbstractSeries *,int> m_seriesMap;
75 QMap<QAbstractSeries *,int> m_seriesMap;
76 QList<QAbstractAxis *> m_axisList;
76 QList<QAbstractAxis *> m_axisList;
77 QChart* m_chart;
77 QChart* m_chart;
78 };
78 };
79
79
80 QT_CHARTS_END_NAMESPACE
80 QT_CHARTS_END_NAMESPACE
81
81
82 #endif // CHARTTHEME_H
82 #endif // CHARTTHEME_H
@@ -1,51 +1,51
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTTITLE_P_H_
28 #ifndef CHARTTITLE_P_H_
29 #define CHARTTITLE_P_H_
29 #define CHARTTITLE_P_H_
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <QtWidgets/QGraphicsTextItem>
32 #include <QtWidgets/QGraphicsTextItem>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class ChartTitle : public QGraphicsTextItem
36 class ChartTitle : public QGraphicsTextItem
37 {
37 {
38 public:
38 public:
39 ChartTitle(QGraphicsItem *parent = 0);
39 ChartTitle(QGraphicsItem *parent = 0);
40 ~ChartTitle();
40 ~ChartTitle();
41 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
41 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
42 void setText(const QString &text);
42 void setText(const QString &text);
43 QString text() const;
43 QString text() const;
44 void setGeometry(const QRectF &rect);
44 void setGeometry(const QRectF &rect);
45 private:
45 private:
46 QString m_text;
46 QString m_text;
47 };
47 };
48
48
49 QT_CHARTS_END_NAMESPACE
49 QT_CHARTS_END_NAMESPACE
50
50
51 #endif /* CHARTTITLE_P_H_ */
51 #endif /* CHARTTITLE_P_H_ */
@@ -1,130 +1,130
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef ABSTRACTDOMAIN_H
28 #ifndef ABSTRACTDOMAIN_H
29 #define ABSTRACTDOMAIN_H
29 #define ABSTRACTDOMAIN_H
30 #include <QtCharts/QChartGlobal>
30 #include <QtCharts/QChartGlobal>
31 #include <QtCore/QRectF>
31 #include <QtCore/QRectF>
32 #include <QtCore/QSizeF>
32 #include <QtCore/QSizeF>
33 #include <QtCore/QDebug>
33 #include <QtCore/QDebug>
34
34
35 QT_CHARTS_BEGIN_NAMESPACE
35 QT_CHARTS_BEGIN_NAMESPACE
36
36
37 class QAbstractAxis;
37 class QAbstractAxis;
38
38
39 class QT_CHARTS_AUTOTEST_EXPORT AbstractDomain: public QObject
39 class QT_CHARTS_AUTOTEST_EXPORT AbstractDomain: public QObject
40 {
40 {
41 Q_OBJECT
41 Q_OBJECT
42 public:
42 public:
43 enum DomainType { UndefinedDomain,
43 enum DomainType { UndefinedDomain,
44 XYDomain,
44 XYDomain,
45 XLogYDomain,
45 XLogYDomain,
46 LogXYDomain,
46 LogXYDomain,
47 LogXLogYDomain,
47 LogXLogYDomain,
48 XYPolarDomain,
48 XYPolarDomain,
49 XLogYPolarDomain,
49 XLogYPolarDomain,
50 LogXYPolarDomain,
50 LogXYPolarDomain,
51 LogXLogYPolarDomain };
51 LogXLogYPolarDomain };
52 public:
52 public:
53 explicit AbstractDomain(QObject *object = 0);
53 explicit AbstractDomain(QObject *object = 0);
54 virtual ~AbstractDomain();
54 virtual ~AbstractDomain();
55
55
56 virtual void setSize(const QSizeF &size);
56 virtual void setSize(const QSizeF &size);
57 QSizeF size() const;
57 QSizeF size() const;
58
58
59 virtual DomainType type() = 0;
59 virtual DomainType type() = 0;
60
60
61 virtual void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) = 0;
61 virtual void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) = 0;
62 void setRangeX(qreal min, qreal max);
62 void setRangeX(qreal min, qreal max);
63 void setRangeY(qreal min, qreal max);
63 void setRangeY(qreal min, qreal max);
64 void setMinX(qreal min);
64 void setMinX(qreal min);
65 void setMaxX(qreal max);
65 void setMaxX(qreal max);
66 void setMinY(qreal min);
66 void setMinY(qreal min);
67 void setMaxY(qreal max);
67 void setMaxY(qreal max);
68
68
69 qreal minX() const { return m_minX; }
69 qreal minX() const { return m_minX; }
70 qreal maxX() const { return m_maxX; }
70 qreal maxX() const { return m_maxX; }
71 qreal minY() const { return m_minY; }
71 qreal minY() const { return m_minY; }
72 qreal maxY() const { return m_maxY; }
72 qreal maxY() const { return m_maxY; }
73
73
74 qreal spanX() const;
74 qreal spanX() const;
75 qreal spanY() const;
75 qreal spanY() const;
76 bool isEmpty() const;
76 bool isEmpty() const;
77
77
78 void blockRangeSignals(bool block);
78 void blockRangeSignals(bool block);
79 bool rangeSignalsBlocked() const { return m_signalsBlocked; }
79 bool rangeSignalsBlocked() const { return m_signalsBlocked; }
80
80
81 void zoomReset();
81 void zoomReset();
82 void storeZoomReset();
82 void storeZoomReset();
83 bool isZoomed() { return m_zoomed; }
83 bool isZoomed() { return m_zoomed; }
84
84
85 friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const AbstractDomain &domain1, const AbstractDomain &domain2);
85 friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const AbstractDomain &domain1, const AbstractDomain &domain2);
86 friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const AbstractDomain &domain1, const AbstractDomain &domain2);
86 friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const AbstractDomain &domain1, const AbstractDomain &domain2);
87 friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const AbstractDomain &domain);
87 friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const AbstractDomain &domain);
88
88
89 virtual void zoomIn(const QRectF &rect) = 0;
89 virtual void zoomIn(const QRectF &rect) = 0;
90 virtual void zoomOut(const QRectF &rect) = 0;
90 virtual void zoomOut(const QRectF &rect) = 0;
91 virtual void move(qreal dx, qreal dy) = 0;
91 virtual void move(qreal dx, qreal dy) = 0;
92
92
93 virtual QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const = 0;
93 virtual QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const = 0;
94 virtual QPointF calculateDomainPoint(const QPointF &point) const = 0;
94 virtual QPointF calculateDomainPoint(const QPointF &point) const = 0;
95 virtual QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const = 0;
95 virtual QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const = 0;
96
96
97 virtual bool attachAxis(QAbstractAxis *axis);
97 virtual bool attachAxis(QAbstractAxis *axis);
98 virtual bool detachAxis(QAbstractAxis *axis);
98 virtual bool detachAxis(QAbstractAxis *axis);
99
99
100 static void looseNiceNumbers(qreal &min, qreal &max, int &ticksCount);
100 static void looseNiceNumbers(qreal &min, qreal &max, int &ticksCount);
101 static qreal niceNumber(qreal x, bool ceiling);
101 static qreal niceNumber(qreal x, bool ceiling);
102
102
103 Q_SIGNALS:
103 Q_SIGNALS:
104 void updated();
104 void updated();
105 void rangeHorizontalChanged(qreal min, qreal max);
105 void rangeHorizontalChanged(qreal min, qreal max);
106 void rangeVerticalChanged(qreal min, qreal max);
106 void rangeVerticalChanged(qreal min, qreal max);
107
107
108 public Q_SLOTS:
108 public Q_SLOTS:
109 void handleVerticalAxisRangeChanged(qreal min,qreal max);
109 void handleVerticalAxisRangeChanged(qreal min,qreal max);
110 void handleHorizontalAxisRangeChanged(qreal min,qreal max);
110 void handleHorizontalAxisRangeChanged(qreal min,qreal max);
111
111
112 protected:
112 protected:
113 void adjustLogDomainRanges(qreal &min, qreal &max);
113 void adjustLogDomainRanges(qreal &min, qreal &max);
114
114
115 qreal m_minX;
115 qreal m_minX;
116 qreal m_maxX;
116 qreal m_maxX;
117 qreal m_minY;
117 qreal m_minY;
118 qreal m_maxY;
118 qreal m_maxY;
119 QSizeF m_size;
119 QSizeF m_size;
120 bool m_signalsBlocked;
120 bool m_signalsBlocked;
121 bool m_zoomed;
121 bool m_zoomed;
122 qreal m_zoomResetMinX;
122 qreal m_zoomResetMinX;
123 qreal m_zoomResetMaxX;
123 qreal m_zoomResetMaxX;
124 qreal m_zoomResetMinY;
124 qreal m_zoomResetMinY;
125 qreal m_zoomResetMaxY;
125 qreal m_zoomResetMaxY;
126 };
126 };
127
127
128 QT_CHARTS_END_NAMESPACE
128 QT_CHARTS_END_NAMESPACE
129
129
130 #endif // ABSTRACTDOMAIN_H
130 #endif // ABSTRACTDOMAIN_H
@@ -1,77 +1,77
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef LOGXLOGYDOMAIN_H
28 #ifndef LOGXLOGYDOMAIN_H
29 #define LOGXLOGYDOMAIN_H
29 #define LOGXLOGYDOMAIN_H
30 #include <private/abstractdomain_p.h>
30 #include <private/abstractdomain_p.h>
31 #include <QtCore/QRectF>
31 #include <QtCore/QRectF>
32 #include <QtCore/QSizeF>
32 #include <QtCore/QSizeF>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class QT_CHARTS_AUTOTEST_EXPORT LogXLogYDomain: public AbstractDomain
36 class QT_CHARTS_AUTOTEST_EXPORT LogXLogYDomain: public AbstractDomain
37 {
37 {
38 Q_OBJECT
38 Q_OBJECT
39 public:
39 public:
40 explicit LogXLogYDomain(QObject *object = 0);
40 explicit LogXLogYDomain(QObject *object = 0);
41 virtual ~LogXLogYDomain();
41 virtual ~LogXLogYDomain();
42
42
43 DomainType type(){ return AbstractDomain::LogXLogYDomain;}
43 DomainType type(){ return AbstractDomain::LogXLogYDomain;}
44
44
45 void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
45 void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
46
46
47 friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2);
47 friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2);
48 friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2);
48 friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2);
49 friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXLogYDomain &domain);
49 friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXLogYDomain &domain);
50
50
51 void zoomIn(const QRectF &rect);
51 void zoomIn(const QRectF &rect);
52 void zoomOut(const QRectF &rect);
52 void zoomOut(const QRectF &rect);
53 void move(qreal dx, qreal dy);
53 void move(qreal dx, qreal dy);
54
54
55 QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
55 QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
56 QPointF calculateDomainPoint(const QPointF &point) const;
56 QPointF calculateDomainPoint(const QPointF &point) const;
57 QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
57 QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
58
58
59 bool attachAxis(QAbstractAxis *axis);
59 bool attachAxis(QAbstractAxis *axis);
60 bool detachAxis(QAbstractAxis *axis);
60 bool detachAxis(QAbstractAxis *axis);
61
61
62 public Q_SLOTS:
62 public Q_SLOTS:
63 void handleVerticalAxisBaseChanged(qreal baseY);
63 void handleVerticalAxisBaseChanged(qreal baseY);
64 void handleHorizontalAxisBaseChanged(qreal baseX);
64 void handleHorizontalAxisBaseChanged(qreal baseX);
65
65
66 private:
66 private:
67 qreal m_logLeftX;
67 qreal m_logLeftX;
68 qreal m_logRightX;
68 qreal m_logRightX;
69 qreal m_logBaseX;
69 qreal m_logBaseX;
70 qreal m_logLeftY;
70 qreal m_logLeftY;
71 qreal m_logRightY;
71 qreal m_logRightY;
72 qreal m_logBaseY;
72 qreal m_logBaseY;
73 };
73 };
74
74
75 QT_CHARTS_END_NAMESPACE
75 QT_CHARTS_END_NAMESPACE
76
76
77 #endif // LOGXLOGYDOMAIN_H
77 #endif // LOGXLOGYDOMAIN_H
@@ -1,79 +1,79
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef LOGXLOGYPOLARDOMAIN_H
28 #ifndef LOGXLOGYPOLARDOMAIN_H
29 #define LOGXLOGYPOLARDOMAIN_H
29 #define LOGXLOGYPOLARDOMAIN_H
30 #include <private/polardomain_p.h>
30 #include <private/polardomain_p.h>
31 #include <QtCore/QRectF>
31 #include <QtCore/QRectF>
32 #include <QtCore/QSizeF>
32 #include <QtCore/QSizeF>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class QT_CHARTS_AUTOTEST_EXPORT LogXLogYPolarDomain: public PolarDomain
36 class QT_CHARTS_AUTOTEST_EXPORT LogXLogYPolarDomain: public PolarDomain
37 {
37 {
38 Q_OBJECT
38 Q_OBJECT
39 public:
39 public:
40 explicit LogXLogYPolarDomain(QObject *object = 0);
40 explicit LogXLogYPolarDomain(QObject *object = 0);
41 virtual ~LogXLogYPolarDomain();
41 virtual ~LogXLogYPolarDomain();
42
42
43 DomainType type() { return AbstractDomain::LogXLogYPolarDomain; }
43 DomainType type() { return AbstractDomain::LogXLogYPolarDomain; }
44
44
45 void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
45 void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
46
46
47 friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const LogXLogYPolarDomain &domain1, const LogXLogYPolarDomain &domain2);
47 friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const LogXLogYPolarDomain &domain1, const LogXLogYPolarDomain &domain2);
48 friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const LogXLogYPolarDomain &domain1, const LogXLogYPolarDomain &domain2);
48 friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const LogXLogYPolarDomain &domain1, const LogXLogYPolarDomain &domain2);
49 friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXLogYPolarDomain &domain);
49 friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXLogYPolarDomain &domain);
50
50
51 void zoomIn(const QRectF &rect);
51 void zoomIn(const QRectF &rect);
52 void zoomOut(const QRectF &rect);
52 void zoomOut(const QRectF &rect);
53 void move(qreal dx, qreal dy);
53 void move(qreal dx, qreal dy);
54
54
55 QPointF calculateDomainPoint(const QPointF &point) const;
55 QPointF calculateDomainPoint(const QPointF &point) const;
56
56
57 bool attachAxis(QAbstractAxis *axis);
57 bool attachAxis(QAbstractAxis *axis);
58 bool detachAxis(QAbstractAxis *axis);
58 bool detachAxis(QAbstractAxis *axis);
59
59
60 public Q_SLOTS:
60 public Q_SLOTS:
61 void handleVerticalAxisBaseChanged(qreal baseY);
61 void handleVerticalAxisBaseChanged(qreal baseY);
62 void handleHorizontalAxisBaseChanged(qreal baseX);
62 void handleHorizontalAxisBaseChanged(qreal baseX);
63
63
64 protected:
64 protected:
65 qreal toAngularCoordinate(qreal value, bool &ok) const;
65 qreal toAngularCoordinate(qreal value, bool &ok) const;
66 qreal toRadialCoordinate(qreal value, bool &ok) const;
66 qreal toRadialCoordinate(qreal value, bool &ok) const;
67
67
68 private:
68 private:
69 qreal m_logLeftX;
69 qreal m_logLeftX;
70 qreal m_logRightX;
70 qreal m_logRightX;
71 qreal m_logBaseX;
71 qreal m_logBaseX;
72 qreal m_logInnerY;
72 qreal m_logInnerY;
73 qreal m_logOuterY;
73 qreal m_logOuterY;
74 qreal m_logBaseY;
74 qreal m_logBaseY;
75 };
75 };
76
76
77 QT_CHARTS_END_NAMESPACE
77 QT_CHARTS_END_NAMESPACE
78
78
79 #endif // LOGXLOGYPOLARDOMAIN_H
79 #endif // LOGXLOGYPOLARDOMAIN_H
@@ -1,73 +1,73
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef LOGXYDOMAIN_H
28 #ifndef LOGXYDOMAIN_H
29 #define LOGXYDOMAIN_H
29 #define LOGXYDOMAIN_H
30 #include <private/abstractdomain_p.h>
30 #include <private/abstractdomain_p.h>
31 #include <QtCore/QRectF>
31 #include <QtCore/QRectF>
32 #include <QtCore/QSizeF>
32 #include <QtCore/QSizeF>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class QT_CHARTS_AUTOTEST_EXPORT LogXYDomain: public AbstractDomain
36 class QT_CHARTS_AUTOTEST_EXPORT LogXYDomain: public AbstractDomain
37 {
37 {
38 Q_OBJECT
38 Q_OBJECT
39 public:
39 public:
40 explicit LogXYDomain(QObject *object = 0);
40 explicit LogXYDomain(QObject *object = 0);
41 virtual ~LogXYDomain();
41 virtual ~LogXYDomain();
42
42
43 DomainType type(){ return AbstractDomain::LogXYDomain;}
43 DomainType type(){ return AbstractDomain::LogXYDomain;}
44
44
45 void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
45 void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
46
46
47 friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const LogXYDomain &domain1, const LogXYDomain &domain2);
47 friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const LogXYDomain &domain1, const LogXYDomain &domain2);
48 friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const LogXYDomain &domain1, const LogXYDomain &domain2);
48 friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const LogXYDomain &domain1, const LogXYDomain &domain2);
49 friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXYDomain &domain);
49 friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXYDomain &domain);
50
50
51 void zoomIn(const QRectF &rect);
51 void zoomIn(const QRectF &rect);
52 void zoomOut(const QRectF &rect);
52 void zoomOut(const QRectF &rect);
53 void move(qreal dx, qreal dy);
53 void move(qreal dx, qreal dy);
54
54
55 QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
55 QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
56 QPointF calculateDomainPoint(const QPointF &point) const;
56 QPointF calculateDomainPoint(const QPointF &point) const;
57 QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
57 QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
58
58
59 bool attachAxis(QAbstractAxis *axis);
59 bool attachAxis(QAbstractAxis *axis);
60 bool detachAxis(QAbstractAxis *axis);
60 bool detachAxis(QAbstractAxis *axis);
61
61
62 public Q_SLOTS:
62 public Q_SLOTS:
63 void handleHorizontalAxisBaseChanged(qreal baseX);
63 void handleHorizontalAxisBaseChanged(qreal baseX);
64
64
65 private:
65 private:
66 qreal m_logLeftX;
66 qreal m_logLeftX;
67 qreal m_logRightX;
67 qreal m_logRightX;
68 qreal m_logBaseX;
68 qreal m_logBaseX;
69 };
69 };
70
70
71 QT_CHARTS_END_NAMESPACE
71 QT_CHARTS_END_NAMESPACE
72
72
73 #endif // LOGXYDOMAIN_H
73 #endif // LOGXYDOMAIN_H
@@ -1,75 +1,75
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef LOGXYPOLARDOMAIN_H
28 #ifndef LOGXYPOLARDOMAIN_H
29 #define LOGXYPOLARDOMAIN_H
29 #define LOGXYPOLARDOMAIN_H
30 #include <private/polardomain_p.h>
30 #include <private/polardomain_p.h>
31 #include <QtCore/QRectF>
31 #include <QtCore/QRectF>
32 #include <QtCore/QSizeF>
32 #include <QtCore/QSizeF>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class QT_CHARTS_AUTOTEST_EXPORT LogXYPolarDomain: public PolarDomain
36 class QT_CHARTS_AUTOTEST_EXPORT LogXYPolarDomain: public PolarDomain
37 {
37 {
38 Q_OBJECT
38 Q_OBJECT
39 public:
39 public:
40 explicit LogXYPolarDomain(QObject *object = 0);
40 explicit LogXYPolarDomain(QObject *object = 0);
41 virtual ~LogXYPolarDomain();
41 virtual ~LogXYPolarDomain();
42
42
43 DomainType type() { return AbstractDomain::LogXYPolarDomain; }
43 DomainType type() { return AbstractDomain::LogXYPolarDomain; }
44
44
45 void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
45 void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
46
46
47 friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const LogXYPolarDomain &domain1, const LogXYPolarDomain &domain2);
47 friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const LogXYPolarDomain &domain1, const LogXYPolarDomain &domain2);
48 friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const LogXYPolarDomain &domain1, const LogXYPolarDomain &domain2);
48 friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const LogXYPolarDomain &domain1, const LogXYPolarDomain &domain2);
49 friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXYPolarDomain &domain);
49 friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXYPolarDomain &domain);
50
50
51 void zoomIn(const QRectF &rect);
51 void zoomIn(const QRectF &rect);
52 void zoomOut(const QRectF &rect);
52 void zoomOut(const QRectF &rect);
53 void move(qreal dx, qreal dy);
53 void move(qreal dx, qreal dy);
54
54
55 QPointF calculateDomainPoint(const QPointF &point) const;
55 QPointF calculateDomainPoint(const QPointF &point) const;
56
56
57 bool attachAxis(QAbstractAxis *axis);
57 bool attachAxis(QAbstractAxis *axis);
58 bool detachAxis(QAbstractAxis *axis);
58 bool detachAxis(QAbstractAxis *axis);
59
59
60 public Q_SLOTS:
60 public Q_SLOTS:
61 void handleHorizontalAxisBaseChanged(qreal baseX);
61 void handleHorizontalAxisBaseChanged(qreal baseX);
62
62
63 protected:
63 protected:
64 qreal toAngularCoordinate(qreal value, bool &ok) const;
64 qreal toAngularCoordinate(qreal value, bool &ok) const;
65 qreal toRadialCoordinate(qreal value, bool &ok) const;
65 qreal toRadialCoordinate(qreal value, bool &ok) const;
66
66
67 private:
67 private:
68 qreal m_logLeftX;
68 qreal m_logLeftX;
69 qreal m_logRightX;
69 qreal m_logRightX;
70 qreal m_logBaseX;
70 qreal m_logBaseX;
71 };
71 };
72
72
73 QT_CHARTS_END_NAMESPACE
73 QT_CHARTS_END_NAMESPACE
74
74
75 #endif // LOGXYPOLARDOMAIN_H
75 #endif // LOGXYPOLARDOMAIN_H
@@ -1,60 +1,60
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef POLARDOMAIN_H
28 #ifndef POLARDOMAIN_H
29 #define POLARDOMAIN_H
29 #define POLARDOMAIN_H
30 #include <private/abstractdomain_p.h>
30 #include <private/abstractdomain_p.h>
31 #include <QtCore/QRectF>
31 #include <QtCore/QRectF>
32 #include <QtCore/QSizeF>
32 #include <QtCore/QSizeF>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class QT_CHARTS_AUTOTEST_EXPORT PolarDomain: public AbstractDomain
36 class QT_CHARTS_AUTOTEST_EXPORT PolarDomain: public AbstractDomain
37 {
37 {
38 Q_OBJECT
38 Q_OBJECT
39 public:
39 public:
40 explicit PolarDomain(QObject *object = 0);
40 explicit PolarDomain(QObject *object = 0);
41 virtual ~PolarDomain();
41 virtual ~PolarDomain();
42
42
43 void setSize(const QSizeF &size);
43 void setSize(const QSizeF &size);
44
44
45 QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
45 QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
46 QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
46 QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
47
47
48 virtual qreal toAngularCoordinate(qreal value, bool &ok) const = 0;
48 virtual qreal toAngularCoordinate(qreal value, bool &ok) const = 0;
49 virtual qreal toRadialCoordinate(qreal value, bool &ok) const = 0;
49 virtual qreal toRadialCoordinate(qreal value, bool &ok) const = 0;
50
50
51 protected:
51 protected:
52 QPointF polarCoordinateToPoint(qreal angularCoordinate, qreal radialCoordinate) const;
52 QPointF polarCoordinateToPoint(qreal angularCoordinate, qreal radialCoordinate) const;
53
53
54 QPointF m_center;
54 QPointF m_center;
55 qreal m_radius;
55 qreal m_radius;
56 };
56 };
57
57
58 QT_CHARTS_END_NAMESPACE
58 QT_CHARTS_END_NAMESPACE
59
59
60 #endif // POLARDOMAIN_H
60 #endif // POLARDOMAIN_H
@@ -1,73 +1,73
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef XLOGYDOMAIN_H
28 #ifndef XLOGYDOMAIN_H
29 #define XLOGYDOMAIN_H
29 #define XLOGYDOMAIN_H
30 #include <private/abstractdomain_p.h>
30 #include <private/abstractdomain_p.h>
31 #include <QtCore/QRectF>
31 #include <QtCore/QRectF>
32 #include <QtCore/QSizeF>
32 #include <QtCore/QSizeF>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class QT_CHARTS_AUTOTEST_EXPORT XLogYDomain: public AbstractDomain
36 class QT_CHARTS_AUTOTEST_EXPORT XLogYDomain: public AbstractDomain
37 {
37 {
38 Q_OBJECT
38 Q_OBJECT
39 public:
39 public:
40 explicit XLogYDomain(QObject *object = 0);
40 explicit XLogYDomain(QObject *object = 0);
41 virtual ~XLogYDomain();
41 virtual ~XLogYDomain();
42
42
43 DomainType type(){ return AbstractDomain::XLogYDomain;};
43 DomainType type(){ return AbstractDomain::XLogYDomain;};
44
44
45 void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
45 void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
46
46
47 friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const XLogYDomain &domain1, const XLogYDomain &domain2);
47 friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const XLogYDomain &domain1, const XLogYDomain &domain2);
48 friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const XLogYDomain &domain1, const XLogYDomain &domain2);
48 friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const XLogYDomain &domain1, const XLogYDomain &domain2);
49 friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const XLogYDomain &domain);
49 friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const XLogYDomain &domain);
50
50
51 void zoomIn(const QRectF &rect);
51 void zoomIn(const QRectF &rect);
52 void zoomOut(const QRectF &rect);
52 void zoomOut(const QRectF &rect);
53 void move(qreal dx, qreal dy);
53 void move(qreal dx, qreal dy);
54
54
55 QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
55 QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
56 QPointF calculateDomainPoint(const QPointF &point) const;
56 QPointF calculateDomainPoint(const QPointF &point) const;
57 QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
57 QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
58
58
59 bool attachAxis(QAbstractAxis *axis);
59 bool attachAxis(QAbstractAxis *axis);
60 bool detachAxis(QAbstractAxis *axis);
60 bool detachAxis(QAbstractAxis *axis);
61
61
62 public Q_SLOTS:
62 public Q_SLOTS:
63 void handleVerticalAxisBaseChanged(qreal baseY);
63 void handleVerticalAxisBaseChanged(qreal baseY);
64
64
65 private:
65 private:
66 qreal m_logLeftY;
66 qreal m_logLeftY;
67 qreal m_logRightY;
67 qreal m_logRightY;
68 qreal m_logBaseY;
68 qreal m_logBaseY;
69 };
69 };
70
70
71 QT_CHARTS_END_NAMESPACE
71 QT_CHARTS_END_NAMESPACE
72
72
73 #endif // XLOGYDOMAIN_H
73 #endif // XLOGYDOMAIN_H
@@ -1,75 +1,75
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef XLOGYPOLARDOMAIN_H
28 #ifndef XLOGYPOLARDOMAIN_H
29 #define XLOGYPOLARDOMAIN_H
29 #define XLOGYPOLARDOMAIN_H
30 #include <private/polardomain_p.h>
30 #include <private/polardomain_p.h>
31 #include <QtCore/QRectF>
31 #include <QtCore/QRectF>
32 #include <QtCore/QSizeF>
32 #include <QtCore/QSizeF>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class QT_CHARTS_AUTOTEST_EXPORT XLogYPolarDomain: public PolarDomain
36 class QT_CHARTS_AUTOTEST_EXPORT XLogYPolarDomain: public PolarDomain
37 {
37 {
38 Q_OBJECT
38 Q_OBJECT
39 public:
39 public:
40 explicit XLogYPolarDomain(QObject *object = 0);
40 explicit XLogYPolarDomain(QObject *object = 0);
41 virtual ~XLogYPolarDomain();
41 virtual ~XLogYPolarDomain();
42
42
43 DomainType type() { return AbstractDomain::XLogYPolarDomain; }
43 DomainType type() { return AbstractDomain::XLogYPolarDomain; }
44
44
45 void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
45 void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
46
46
47 friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const XLogYPolarDomain &domain1, const XLogYPolarDomain &domain2);
47 friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const XLogYPolarDomain &domain1, const XLogYPolarDomain &domain2);
48 friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const XLogYPolarDomain &domain1, const XLogYPolarDomain &domain2);
48 friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const XLogYPolarDomain &domain1, const XLogYPolarDomain &domain2);
49 friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const XLogYPolarDomain &domain);
49 friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const XLogYPolarDomain &domain);
50
50
51 void zoomIn(const QRectF &rect);
51 void zoomIn(const QRectF &rect);
52 void zoomOut(const QRectF &rect);
52 void zoomOut(const QRectF &rect);
53 void move(qreal dx, qreal dy);
53 void move(qreal dx, qreal dy);
54
54
55 QPointF calculateDomainPoint(const QPointF &point) const;
55 QPointF calculateDomainPoint(const QPointF &point) const;
56
56
57 bool attachAxis(QAbstractAxis *axis);
57 bool attachAxis(QAbstractAxis *axis);
58 bool detachAxis(QAbstractAxis *axis);
58 bool detachAxis(QAbstractAxis *axis);
59
59
60 public Q_SLOTS:
60 public Q_SLOTS:
61 void handleVerticalAxisBaseChanged(qreal baseY);
61 void handleVerticalAxisBaseChanged(qreal baseY);
62
62
63 protected:
63 protected:
64 qreal toAngularCoordinate(qreal value, bool &ok) const;
64 qreal toAngularCoordinate(qreal value, bool &ok) const;
65 qreal toRadialCoordinate(qreal value, bool &ok) const;
65 qreal toRadialCoordinate(qreal value, bool &ok) const;
66
66
67 private:
67 private:
68 qreal m_logInnerY;
68 qreal m_logInnerY;
69 qreal m_logOuterY;
69 qreal m_logOuterY;
70 qreal m_logBaseY;
70 qreal m_logBaseY;
71 };
71 };
72
72
73 QT_CHARTS_END_NAMESPACE
73 QT_CHARTS_END_NAMESPACE
74
74
75 #endif // XLOGYPOLARDOMAIN_H
75 #endif // XLOGYPOLARDOMAIN_H
@@ -1,62 +1,62
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef XYDOMAIN_H
28 #ifndef XYDOMAIN_H
29 #define XYDOMAIN_H
29 #define XYDOMAIN_H
30 #include <private/abstractdomain_p.h>
30 #include <private/abstractdomain_p.h>
31 #include <QtCore/QRectF>
31 #include <QtCore/QRectF>
32 #include <QtCore/QSizeF>
32 #include <QtCore/QSizeF>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class QT_CHARTS_AUTOTEST_EXPORT XYDomain: public AbstractDomain
36 class QT_CHARTS_AUTOTEST_EXPORT XYDomain: public AbstractDomain
37 {
37 {
38 Q_OBJECT
38 Q_OBJECT
39 public:
39 public:
40 explicit XYDomain(QObject *object = 0);
40 explicit XYDomain(QObject *object = 0);
41 virtual ~XYDomain();
41 virtual ~XYDomain();
42
42
43 DomainType type(){ return AbstractDomain::XYDomain;}
43 DomainType type(){ return AbstractDomain::XYDomain;}
44
44
45 void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
45 void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
46
46
47 friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const XYDomain &Domain1, const XYDomain &Domain2);
47 friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const XYDomain &Domain1, const XYDomain &Domain2);
48 friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const XYDomain &Domain1, const XYDomain &Domain2);
48 friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const XYDomain &Domain1, const XYDomain &Domain2);
49 friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const XYDomain &AbstractDomain);
49 friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const XYDomain &AbstractDomain);
50
50
51 void zoomIn(const QRectF &rect);
51 void zoomIn(const QRectF &rect);
52 void zoomOut(const QRectF &rect);
52 void zoomOut(const QRectF &rect);
53 void move(qreal dx, qreal dy);
53 void move(qreal dx, qreal dy);
54
54
55 QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
55 QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
56 QPointF calculateDomainPoint(const QPointF &point) const;
56 QPointF calculateDomainPoint(const QPointF &point) const;
57 QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
57 QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
58 };
58 };
59
59
60 QT_CHARTS_END_NAMESPACE
60 QT_CHARTS_END_NAMESPACE
61
61
62 #endif // XYDOMAIN_H
62 #endif // XYDOMAIN_H
@@ -1,63 +1,63
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef XYPOLARDOMAIN_H
28 #ifndef XYPOLARDOMAIN_H
29 #define XYPOLARDOMAIN_H
29 #define XYPOLARDOMAIN_H
30 #include <private/polardomain_p.h>
30 #include <private/polardomain_p.h>
31 #include <QtCore/QRectF>
31 #include <QtCore/QRectF>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QT_CHARTS_AUTOTEST_EXPORT XYPolarDomain: public PolarDomain
35 class QT_CHARTS_AUTOTEST_EXPORT XYPolarDomain: public PolarDomain
36 {
36 {
37 Q_OBJECT
37 Q_OBJECT
38 public:
38 public:
39 explicit XYPolarDomain(QObject *object = 0);
39 explicit XYPolarDomain(QObject *object = 0);
40 virtual ~XYPolarDomain();
40 virtual ~XYPolarDomain();
41
41
42 DomainType type(){ return AbstractDomain::XYPolarDomain;}
42 DomainType type(){ return AbstractDomain::XYPolarDomain;}
43
43
44 void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
44 void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
45
45
46 friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const XYPolarDomain &Domain1, const XYPolarDomain &Domain2);
46 friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const XYPolarDomain &Domain1, const XYPolarDomain &Domain2);
47 friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const XYPolarDomain &Domain1, const XYPolarDomain &Domain2);
47 friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const XYPolarDomain &Domain1, const XYPolarDomain &Domain2);
48 friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const XYPolarDomain &AbstractDomain);
48 friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const XYPolarDomain &AbstractDomain);
49
49
50 void zoomIn(const QRectF &rect);
50 void zoomIn(const QRectF &rect);
51 void zoomOut(const QRectF &rect);
51 void zoomOut(const QRectF &rect);
52 void move(qreal dx, qreal dy);
52 void move(qreal dx, qreal dy);
53
53
54 QPointF calculateDomainPoint(const QPointF &point) const;
54 QPointF calculateDomainPoint(const QPointF &point) const;
55
55
56 protected:
56 protected:
57 qreal toAngularCoordinate(qreal value, bool &ok) const;
57 qreal toAngularCoordinate(qreal value, bool &ok) const;
58 qreal toRadialCoordinate(qreal value, bool &ok) const;
58 qreal toRadialCoordinate(qreal value, bool &ok) const;
59 };
59 };
60
60
61 QT_CHARTS_END_NAMESPACE
61 QT_CHARTS_END_NAMESPACE
62
62
63 #endif // XYPOLARDOMAIN_H
63 #endif // XYPOLARDOMAIN_H
@@ -1,80 +1,80
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef ABSTRACTCHARTLAYOUT_H
28 #ifndef ABSTRACTCHARTLAYOUT_H
29 #define ABSTRACTCHARTLAYOUT_H
29 #define ABSTRACTCHARTLAYOUT_H
30
30
31 #include <QtWidgets/QGraphicsLayout>
31 #include <QtWidgets/QGraphicsLayout>
32 #include <QtCore/QMargins>
32 #include <QtCore/QMargins>
33 #include <QtCharts/QChartGlobal>
33 #include <QtCharts/QChartGlobal>
34
34
35 QT_CHARTS_BEGIN_NAMESPACE
35 QT_CHARTS_BEGIN_NAMESPACE
36
36
37 class ChartTitle;
37 class ChartTitle;
38 class ChartAxisElement;
38 class ChartAxisElement;
39 class ChartPresenter;
39 class ChartPresenter;
40 class QLegend;
40 class QLegend;
41 class ChartBackground;
41 class ChartBackground;
42
42
43 class AbstractChartLayout : public QGraphicsLayout
43 class AbstractChartLayout : public QGraphicsLayout
44 {
44 {
45 public:
45 public:
46 AbstractChartLayout(ChartPresenter *presenter);
46 AbstractChartLayout(ChartPresenter *presenter);
47 virtual ~AbstractChartLayout();
47 virtual ~AbstractChartLayout();
48
48
49 virtual void setMargins(const QMargins &margins);
49 virtual void setMargins(const QMargins &margins);
50 virtual QMargins margins() const;
50 virtual QMargins margins() const;
51 virtual void setGeometry(const QRectF &rect);
51 virtual void setGeometry(const QRectF &rect);
52
52
53 protected:
53 protected:
54 virtual QRectF calculateBackgroundGeometry(const QRectF &geometry, ChartBackground *background) const;
54 virtual QRectF calculateBackgroundGeometry(const QRectF &geometry, ChartBackground *background) const;
55 virtual QRectF calculateBackgroundMinimum(const QRectF &minimum) const;
55 virtual QRectF calculateBackgroundMinimum(const QRectF &minimum) const;
56 virtual QRectF calculateContentGeometry(const QRectF &geometry) const;
56 virtual QRectF calculateContentGeometry(const QRectF &geometry) const;
57 virtual QRectF calculateContentMinimum(const QRectF &minimum) const;
57 virtual QRectF calculateContentMinimum(const QRectF &minimum) const;
58 virtual QRectF calculateTitleGeometry(const QRectF &geometry, ChartTitle *title) const;
58 virtual QRectF calculateTitleGeometry(const QRectF &geometry, ChartTitle *title) const;
59 virtual QRectF calculateTitleMinimum(const QRectF &minimum, ChartTitle *title) const;
59 virtual QRectF calculateTitleMinimum(const QRectF &minimum, ChartTitle *title) const;
60 virtual QRectF calculateLegendGeometry(const QRectF &geometry, QLegend *legend) const;
60 virtual QRectF calculateLegendGeometry(const QRectF &geometry, QLegend *legend) const;
61 virtual QRectF calculateLegendMinimum(const QRectF &minimum, QLegend *legend) const;
61 virtual QRectF calculateLegendMinimum(const QRectF &minimum, QLegend *legend) const;
62
62
63 virtual QRectF calculateAxisGeometry(const QRectF &geometry, const QList<ChartAxisElement *>& axes) const = 0;
63 virtual QRectF calculateAxisGeometry(const QRectF &geometry, const QList<ChartAxisElement *>& axes) const = 0;
64 virtual QRectF calculateAxisMinimum(const QRectF &minimum, const QList<ChartAxisElement *>& axes) const = 0;
64 virtual QRectF calculateAxisMinimum(const QRectF &minimum, const QList<ChartAxisElement *>& axes) const = 0;
65
65
66 // from QGraphicsLayout
66 // from QGraphicsLayout
67 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
67 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
68 int count() const { return 0; }
68 int count() const { return 0; }
69 QGraphicsLayoutItem *itemAt(int) const { return 0; };
69 QGraphicsLayoutItem *itemAt(int) const { return 0; };
70 void removeAt(int) {};
70 void removeAt(int) {};
71
71
72 ChartPresenter *m_presenter;
72 ChartPresenter *m_presenter;
73 QMargins m_margins;
73 QMargins m_margins;
74 QRectF m_minChartRect;
74 QRectF m_minChartRect;
75 QRectF m_minAxisRect;
75 QRectF m_minAxisRect;
76 };
76 };
77
77
78 QT_CHARTS_END_NAMESPACE
78 QT_CHARTS_END_NAMESPACE
79
79
80 #endif // ABSTRACTCHARTLAYOUT_H
80 #endif // ABSTRACTCHARTLAYOUT_H
@@ -1,48 +1,48
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CARTESIANCHARTLAYOUT_H
28 #ifndef CARTESIANCHARTLAYOUT_H
29 #define CARTESIANCHARTLAYOUT_H
29 #define CARTESIANCHARTLAYOUT_H
30
30
31 #include <private/abstractchartlayout_p.h>
31 #include <private/abstractchartlayout_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class CartesianChartLayout : public AbstractChartLayout
35 class CartesianChartLayout : public AbstractChartLayout
36 {
36 {
37 public:
37 public:
38 CartesianChartLayout(ChartPresenter *presenter);
38 CartesianChartLayout(ChartPresenter *presenter);
39 virtual ~CartesianChartLayout();
39 virtual ~CartesianChartLayout();
40
40
41 // from AbstractChartLayout
41 // from AbstractChartLayout
42 QRectF calculateAxisMinimum(const QRectF &minimum, const QList<ChartAxisElement *> &axes) const;
42 QRectF calculateAxisMinimum(const QRectF &minimum, const QList<ChartAxisElement *> &axes) const;
43 QRectF calculateAxisGeometry(const QRectF &geometry, const QList<ChartAxisElement *> &axes) const;
43 QRectF calculateAxisGeometry(const QRectF &geometry, const QList<ChartAxisElement *> &axes) const;
44 };
44 };
45
45
46 QT_CHARTS_END_NAMESPACE
46 QT_CHARTS_END_NAMESPACE
47
47
48 #endif // CARTESIANCHARTLAYOUT_H
48 #endif // CARTESIANCHARTLAYOUT_H
@@ -1,48 +1,48
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef POLARCHARTLAYOUT_H
28 #ifndef POLARCHARTLAYOUT_H
29 #define POLARCHARTLAYOUT_H
29 #define POLARCHARTLAYOUT_H
30
30
31 #include <private/abstractchartlayout_p.h>
31 #include <private/abstractchartlayout_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class PolarChartLayout : public AbstractChartLayout
35 class PolarChartLayout : public AbstractChartLayout
36 {
36 {
37 public:
37 public:
38 PolarChartLayout(ChartPresenter *presenter);
38 PolarChartLayout(ChartPresenter *presenter);
39 virtual ~PolarChartLayout();
39 virtual ~PolarChartLayout();
40
40
41 // from AbstractChartLayout
41 // from AbstractChartLayout
42 QRectF calculateAxisMinimum(const QRectF &minimum, const QList<ChartAxisElement *> &axes) const;
42 QRectF calculateAxisMinimum(const QRectF &minimum, const QList<ChartAxisElement *> &axes) const;
43 QRectF calculateAxisGeometry(const QRectF &geometry, const QList<ChartAxisElement *> &axes) const;
43 QRectF calculateAxisGeometry(const QRectF &geometry, const QList<ChartAxisElement *> &axes) const;
44 };
44 };
45
45
46 QT_CHARTS_END_NAMESPACE
46 QT_CHARTS_END_NAMESPACE
47
47
48 #endif // POLARCHARTLAYOUT_H
48 #endif // POLARCHARTLAYOUT_H
@@ -1,82 +1,82
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef LEGENDLAYOUT_H
28 #ifndef LEGENDLAYOUT_H
29 #define LEGENDLAYOUT_H
29 #define LEGENDLAYOUT_H
30 #include <QtWidgets/QGraphicsLayout>
30 #include <QtWidgets/QGraphicsLayout>
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QLegend;
35 class QLegend;
36 class LegendMarkerItem;
36 class LegendMarkerItem;
37
37
38 class LegendLayout : public QGraphicsLayout
38 class LegendLayout : public QGraphicsLayout
39 {
39 {
40 public:
40 public:
41
41
42 LegendLayout(QLegend *legend);
42 LegendLayout(QLegend *legend);
43 virtual ~LegendLayout();
43 virtual ~LegendLayout();
44
44
45 void setGeometry(const QRectF &rect);
45 void setGeometry(const QRectF &rect);
46
46
47 void setOffset(qreal x, qreal y);
47 void setOffset(qreal x, qreal y);
48 QPointF offset() const;
48 QPointF offset() const;
49
49
50 void invalidate();
50 void invalidate();
51 protected:
51 protected:
52 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
52 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
53 int count() const { return 0; }
53 int count() const { return 0; }
54 QGraphicsLayoutItem *itemAt(int) const { return 0; };
54 QGraphicsLayoutItem *itemAt(int) const { return 0; };
55 void removeAt(int) {};
55 void removeAt(int) {};
56
56
57 private:
57 private:
58 void setAttachedGeometry(const QRectF &rect);
58 void setAttachedGeometry(const QRectF &rect);
59 void setDettachedGeometry(const QRectF &rect);
59 void setDettachedGeometry(const QRectF &rect);
60
60
61 struct LegendWidthStruct {
61 struct LegendWidthStruct {
62 LegendMarkerItem *item;
62 LegendMarkerItem *item;
63 qreal width;
63 qreal width;
64 };
64 };
65 static bool widthLongerThan(const LegendWidthStruct *item1,
65 static bool widthLongerThan(const LegendWidthStruct *item1,
66 const LegendWidthStruct *item2);
66 const LegendWidthStruct *item2);
67
67
68 private:
68 private:
69 QLegend *m_legend;
69 QLegend *m_legend;
70 qreal m_offsetX;
70 qreal m_offsetX;
71 qreal m_offsetY;
71 qreal m_offsetY;
72 qreal m_minOffsetX;
72 qreal m_minOffsetX;
73 qreal m_minOffsetY;
73 qreal m_minOffsetY;
74 qreal m_maxOffsetX;
74 qreal m_maxOffsetX;
75 qreal m_maxOffsetY;
75 qreal m_maxOffsetY;
76 qreal m_width;
76 qreal m_width;
77 qreal m_height;
77 qreal m_height;
78 };
78 };
79
79
80 QT_CHARTS_END_NAMESPACE
80 QT_CHARTS_END_NAMESPACE
81
81
82 #endif
82 #endif
@@ -1,99 +1,99
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef LEGENDMARKERITEM_P_H
28 #ifndef LEGENDMARKERITEM_P_H
29 #define LEGENDMARKERITEM_P_H
29 #define LEGENDMARKERITEM_P_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <QGraphicsObject>
32 #include <QGraphicsObject>
33 #include <QtGui/QFont>
33 #include <QtGui/QFont>
34 #include <QtGui/QBrush>
34 #include <QtGui/QBrush>
35 #include <QtGui/QPen>
35 #include <QtGui/QPen>
36 #include <QtWidgets/QGraphicsTextItem>
36 #include <QtWidgets/QGraphicsTextItem>
37 #include <QtWidgets/QGraphicsLayoutItem>
37 #include <QtWidgets/QGraphicsLayoutItem>
38
38
39 QT_CHARTS_BEGIN_NAMESPACE
39 QT_CHARTS_BEGIN_NAMESPACE
40
40
41 class QLegendMarkerPrivate;
41 class QLegendMarkerPrivate;
42
42
43 class LegendMarkerItem : public QGraphicsObject, public QGraphicsLayoutItem
43 class LegendMarkerItem : public QGraphicsObject, public QGraphicsLayoutItem
44 {
44 {
45 Q_OBJECT
45 Q_OBJECT
46 Q_INTERFACES(QGraphicsLayoutItem)
46 Q_INTERFACES(QGraphicsLayoutItem)
47 public:
47 public:
48 explicit LegendMarkerItem(QLegendMarkerPrivate *marker, QGraphicsObject *parent = 0);
48 explicit LegendMarkerItem(QLegendMarkerPrivate *marker, QGraphicsObject *parent = 0);
49 ~LegendMarkerItem();
49 ~LegendMarkerItem();
50
50
51 void setPen(const QPen &pen);
51 void setPen(const QPen &pen);
52 QPen pen() const;
52 QPen pen() const;
53
53
54 void setBrush(const QBrush &brush);
54 void setBrush(const QBrush &brush);
55 QBrush brush() const;
55 QBrush brush() const;
56
56
57 void setFont(const QFont &font);
57 void setFont(const QFont &font);
58 QFont font() const;
58 QFont font() const;
59
59
60 void setLabel(const QString label);
60 void setLabel(const QString label);
61 QString label() const;
61 QString label() const;
62
62
63 void setLabelBrush(const QBrush &brush);
63 void setLabelBrush(const QBrush &brush);
64 QBrush labelBrush() const;
64 QBrush labelBrush() const;
65
65
66 void setGeometry(const QRectF &rect);
66 void setGeometry(const QRectF &rect);
67 QRectF boundingRect() const;
67 QRectF boundingRect() const;
68
68
69 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
69 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
70 QSizeF sizeHint (Qt::SizeHint which, const QSizeF &constraint) const;
70 QSizeF sizeHint (Qt::SizeHint which, const QSizeF &constraint) const;
71
71
72 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
72 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
73 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
73 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
74
74
75 protected:
75 protected:
76 QLegendMarkerPrivate *m_marker; // Knows
76 QLegendMarkerPrivate *m_marker; // Knows
77 QRectF m_markerRect;
77 QRectF m_markerRect;
78 QRectF m_boundingRect;
78 QRectF m_boundingRect;
79 QGraphicsTextItem *m_textItem;
79 QGraphicsTextItem *m_textItem;
80 QGraphicsRectItem *m_rectItem;
80 QGraphicsRectItem *m_rectItem;
81 qreal m_margin;
81 qreal m_margin;
82 qreal m_space;
82 qreal m_space;
83 QString m_label;
83 QString m_label;
84
84
85 QBrush m_labelBrush;
85 QBrush m_labelBrush;
86 QPen m_pen;
86 QPen m_pen;
87 QBrush m_brush;
87 QBrush m_brush;
88 bool m_hovering;
88 bool m_hovering;
89
89
90 QPointF m_pressPos;
90 QPointF m_pressPos;
91
91
92 friend class QLegendMarker;
92 friend class QLegendMarker;
93 friend class QLegendMarkerPrivate;
93 friend class QLegendMarkerPrivate;
94 friend class LegendLayout;
94 friend class LegendLayout;
95 };
95 };
96
96
97 QT_CHARTS_END_NAMESPACE
97 QT_CHARTS_END_NAMESPACE
98
98
99 #endif // LEGENDMARKERITEM_P_H
99 #endif // LEGENDMARKERITEM_P_H
@@ -1,55 +1,55
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28
28
29 #ifndef LEGENDSCROLLER_P_H
29 #ifndef LEGENDSCROLLER_P_H
30 #define LEGENDSCROLLER_P_H
30 #define LEGENDSCROLLER_P_H
31
31
32 #include <QtCharts/qlegend.h>
32 #include <QtCharts/qlegend.h>
33 #include <private/qlegend_p.h>
33 #include <private/qlegend_p.h>
34 #include <private/scroller_p.h>
34 #include <private/scroller_p.h>
35
35
36 QT_CHARTS_BEGIN_NAMESPACE
36 QT_CHARTS_BEGIN_NAMESPACE
37
37
38 class LegendScroller: public QLegend, public Scroller
38 class LegendScroller: public QLegend, public Scroller
39 {
39 {
40 Q_OBJECT
40 Q_OBJECT
41
41
42 public:
42 public:
43 LegendScroller(QChart *chart);
43 LegendScroller(QChart *chart);
44
44
45 void setOffset(const QPointF &point);
45 void setOffset(const QPointF &point);
46 QPointF offset() const;
46 QPointF offset() const;
47
47
48 void mousePressEvent(QGraphicsSceneMouseEvent *event);
48 void mousePressEvent(QGraphicsSceneMouseEvent *event);
49 void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
49 void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
50 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
50 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
51 };
51 };
52
52
53 QT_CHARTS_END_NAMESPACE
53 QT_CHARTS_END_NAMESPACE
54
54
55 #endif
55 #endif
@@ -1,62 +1,62
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QAREALEGENDMARKER_P_H
28 #ifndef QAREALEGENDMARKER_P_H
29 #define QAREALEGENDMARKER_P_H
29 #define QAREALEGENDMARKER_P_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <private/qlegendmarker_p.h>
32 #include <private/qlegendmarker_p.h>
33 #include <private/legendmarkeritem_p.h>
33 #include <private/legendmarkeritem_p.h>
34 #include <QtCharts/QAreaSeries>
34 #include <QtCharts/QAreaSeries>
35
35
36 QT_CHARTS_BEGIN_NAMESPACE
36 QT_CHARTS_BEGIN_NAMESPACE
37
37
38 class QAreaLegendMarker;
38 class QAreaLegendMarker;
39
39
40 class QAreaLegendMarkerPrivate : public QLegendMarkerPrivate
40 class QAreaLegendMarkerPrivate : public QLegendMarkerPrivate
41 {
41 {
42 Q_OBJECT
42 Q_OBJECT
43 public:
43 public:
44 explicit QAreaLegendMarkerPrivate(QAreaLegendMarker *q, QAreaSeries *series, QLegend *legend);
44 explicit QAreaLegendMarkerPrivate(QAreaLegendMarker *q, QAreaSeries *series, QLegend *legend);
45 virtual ~QAreaLegendMarkerPrivate();
45 virtual ~QAreaLegendMarkerPrivate();
46
46
47 virtual QAreaSeries* series();
47 virtual QAreaSeries* series();
48 virtual QObject* relatedObject();
48 virtual QObject* relatedObject();
49
49
50 public Q_SLOTS:
50 public Q_SLOTS:
51 virtual void updated();
51 virtual void updated();
52
52
53 private:
53 private:
54 QAreaLegendMarker *q_ptr;
54 QAreaLegendMarker *q_ptr;
55 QAreaSeries *m_series;
55 QAreaSeries *m_series;
56
56
57 Q_DECLARE_PUBLIC(QAreaLegendMarker)
57 Q_DECLARE_PUBLIC(QAreaLegendMarker)
58 };
58 };
59
59
60 QT_CHARTS_END_NAMESPACE
60 QT_CHARTS_END_NAMESPACE
61
61
62 #endif // QAREALEGENDMARKER_P_H
62 #endif // QAREALEGENDMARKER_P_H
@@ -1,64 +1,64
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QBARLEGENDMARKER_P_H
28 #ifndef QBARLEGENDMARKER_P_H
29 #define QBARLEGENDMARKER_P_H
29 #define QBARLEGENDMARKER_P_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <private/qlegendmarker_p.h>
32 #include <private/qlegendmarker_p.h>
33 #include <private/legendmarkeritem_p.h>
33 #include <private/legendmarkeritem_p.h>
34 #include <QtCharts/QAbstractBarSeries>
34 #include <QtCharts/QAbstractBarSeries>
35 #include <QtCharts/QBarSet>
35 #include <QtCharts/QBarSet>
36
36
37 QT_CHARTS_BEGIN_NAMESPACE
37 QT_CHARTS_BEGIN_NAMESPACE
38
38
39 class QBarLegendMarker;
39 class QBarLegendMarker;
40
40
41 class QBarLegendMarkerPrivate : public QLegendMarkerPrivate
41 class QBarLegendMarkerPrivate : public QLegendMarkerPrivate
42 {
42 {
43 Q_OBJECT
43 Q_OBJECT
44 public:
44 public:
45 explicit QBarLegendMarkerPrivate(QBarLegendMarker *q, QAbstractBarSeries *series, QBarSet *barset, QLegend *legend);
45 explicit QBarLegendMarkerPrivate(QBarLegendMarker *q, QAbstractBarSeries *series, QBarSet *barset, QLegend *legend);
46 virtual ~QBarLegendMarkerPrivate();
46 virtual ~QBarLegendMarkerPrivate();
47
47
48 virtual QAbstractBarSeries* series();
48 virtual QAbstractBarSeries* series();
49 virtual QObject* relatedObject();
49 virtual QObject* relatedObject();
50
50
51 public Q_SLOTS:
51 public Q_SLOTS:
52 virtual void updated();
52 virtual void updated();
53
53
54 private:
54 private:
55 QBarLegendMarker *q_ptr;
55 QBarLegendMarker *q_ptr;
56 QAbstractBarSeries *m_series;
56 QAbstractBarSeries *m_series;
57 QBarSet *m_barset;
57 QBarSet *m_barset;
58
58
59 Q_DECLARE_PUBLIC(QBarLegendMarker)
59 Q_DECLARE_PUBLIC(QBarLegendMarker)
60 };
60 };
61
61
62 QT_CHARTS_END_NAMESPACE
62 QT_CHARTS_END_NAMESPACE
63
63
64 #endif // QBARLEGENDMARKER_P_H
64 #endif // QBARLEGENDMARKER_P_H
@@ -1,62 +1,62
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QBOXPLOTLEGENDMARKER_P_H
28 #ifndef QBOXPLOTLEGENDMARKER_P_H
29 #define QBOXPLOTLEGENDMARKER_P_H
29 #define QBOXPLOTLEGENDMARKER_P_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <private/qlegendmarker_p.h>
32 #include <private/qlegendmarker_p.h>
33 #include <private/legendmarkeritem_p.h>
33 #include <private/legendmarkeritem_p.h>
34 #include <QtCharts/QBoxPlotSeries>
34 #include <QtCharts/QBoxPlotSeries>
35
35
36 QT_CHARTS_BEGIN_NAMESPACE
36 QT_CHARTS_BEGIN_NAMESPACE
37
37
38 class QBoxPlotLegendMarker;
38 class QBoxPlotLegendMarker;
39
39
40 class QBoxPlotLegendMarkerPrivate : public QLegendMarkerPrivate
40 class QBoxPlotLegendMarkerPrivate : public QLegendMarkerPrivate
41 {
41 {
42 Q_OBJECT
42 Q_OBJECT
43 public:
43 public:
44 explicit QBoxPlotLegendMarkerPrivate(QBoxPlotLegendMarker *q, QBoxPlotSeries *series, QLegend *legend);
44 explicit QBoxPlotLegendMarkerPrivate(QBoxPlotLegendMarker *q, QBoxPlotSeries *series, QLegend *legend);
45 virtual ~QBoxPlotLegendMarkerPrivate();
45 virtual ~QBoxPlotLegendMarkerPrivate();
46
46
47 virtual QAbstractSeries *series();
47 virtual QAbstractSeries *series();
48 virtual QObject *relatedObject();
48 virtual QObject *relatedObject();
49
49
50 public Q_SLOTS:
50 public Q_SLOTS:
51 virtual void updated();
51 virtual void updated();
52
52
53 private:
53 private:
54 QBoxPlotLegendMarker *q_ptr;
54 QBoxPlotLegendMarker *q_ptr;
55 QBoxPlotSeries *m_series;
55 QBoxPlotSeries *m_series;
56
56
57 Q_DECLARE_PUBLIC(QBoxPlotLegendMarker)
57 Q_DECLARE_PUBLIC(QBoxPlotLegendMarker)
58 };
58 };
59
59
60 QT_CHARTS_END_NAMESPACE
60 QT_CHARTS_END_NAMESPACE
61
61
62 #endif // QBOXPLOTLEGENDMARKER_P_H
62 #endif // QBOXPLOTLEGENDMARKER_P_H
@@ -1,99 +1,99
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QLEGEND_P_H
28 #ifndef QLEGEND_P_H
29 #define QLEGEND_P_H
29 #define QLEGEND_P_H
30
30
31 #include <QtCharts/QLegend>
31 #include <QtCharts/QLegend>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QChart;
35 class QChart;
36 class ChartPresenter;
36 class ChartPresenter;
37 class QAbstractSeries;
37 class QAbstractSeries;
38 class LegendLayout;
38 class LegendLayout;
39 class QLegendMarker;
39 class QLegendMarker;
40
40
41 class QLegendPrivate : public QObject
41 class QLegendPrivate : public QObject
42 {
42 {
43 Q_OBJECT
43 Q_OBJECT
44 public:
44 public:
45 QLegendPrivate(ChartPresenter *presenter, QChart *chart, QLegend *q);
45 QLegendPrivate(ChartPresenter *presenter, QChart *chart, QLegend *q);
46 ~QLegendPrivate();
46 ~QLegendPrivate();
47
47
48 void setOffset(const QPointF &offset);
48 void setOffset(const QPointF &offset);
49 QPointF offset() const;
49 QPointF offset() const;
50 int roundness(qreal size);
50 int roundness(qreal size);
51
51
52 QGraphicsItemGroup* items() { return m_items; }
52 QGraphicsItemGroup* items() { return m_items; }
53
53
54 QList<QLegendMarker*> markers(QAbstractSeries *series = 0);
54 QList<QLegendMarker*> markers(QAbstractSeries *series = 0);
55
55
56 public Q_SLOTS:
56 public Q_SLOTS:
57 void handleSeriesAdded(QAbstractSeries *series);
57 void handleSeriesAdded(QAbstractSeries *series);
58 void handleSeriesRemoved(QAbstractSeries *series);
58 void handleSeriesRemoved(QAbstractSeries *series);
59 void handleSeriesVisibleChanged();
59 void handleSeriesVisibleChanged();
60 void handleCountChanged();
60 void handleCountChanged();
61
61
62 private:
62 private:
63 // Internal helpers
63 // Internal helpers
64 void addMarkers(QList<QLegendMarker *> markers);
64 void addMarkers(QList<QLegendMarker *> markers);
65 void removeMarkers(QList<QLegendMarker *> markers);
65 void removeMarkers(QList<QLegendMarker *> markers);
66 void decorateMarkers(QList<QLegendMarker *> markers);
66 void decorateMarkers(QList<QLegendMarker *> markers);
67
67
68 private:
68 private:
69 QLegend *q_ptr;
69 QLegend *q_ptr;
70 ChartPresenter *m_presenter;
70 ChartPresenter *m_presenter;
71 LegendLayout *m_layout;
71 LegendLayout *m_layout;
72 QChart *m_chart;
72 QChart *m_chart;
73 QGraphicsItemGroup *m_items;
73 QGraphicsItemGroup *m_items;
74 Qt::Alignment m_alignment;
74 Qt::Alignment m_alignment;
75 QBrush m_brush;
75 QBrush m_brush;
76 QPen m_pen;
76 QPen m_pen;
77 QFont m_font;
77 QFont m_font;
78 QBrush m_labelBrush;
78 QBrush m_labelBrush;
79
79
80 qreal m_diameter;
80 qreal m_diameter;
81 bool m_attachedToChart;
81 bool m_attachedToChart;
82 bool m_backgroundVisible;
82 bool m_backgroundVisible;
83 bool m_reverseMarkers;
83 bool m_reverseMarkers;
84
84
85 QList<QLegendMarker *> m_markers;
85 QList<QLegendMarker *> m_markers;
86 QList<QAbstractSeries *> m_series;
86 QList<QAbstractSeries *> m_series;
87
87
88 QHash<QGraphicsItem *, QLegendMarker *> m_markerHash;
88 QHash<QGraphicsItem *, QLegendMarker *> m_markerHash;
89
89
90 friend class QLegend;
90 friend class QLegend;
91 friend class LegendMarkerItem;
91 friend class LegendMarkerItem;
92 friend class LegendLayout;
92 friend class LegendLayout;
93 friend class QLegendMarkerPrivate;
93 friend class QLegendMarkerPrivate;
94 friend class LegendScroller;
94 friend class LegendScroller;
95 };
95 };
96
96
97 QT_CHARTS_END_NAMESPACE
97 QT_CHARTS_END_NAMESPACE
98
98
99 #endif
99 #endif
@@ -1,80 +1,80
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QLEGENDMARKERPRIVATE_H
28 #ifndef QLEGENDMARKERPRIVATE_H
29 #define QLEGENDMARKERPRIVATE_H
29 #define QLEGENDMARKERPRIVATE_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <QGraphicsObject>
32 #include <QGraphicsObject>
33 #include <QtGui/QBrush>
33 #include <QtGui/QBrush>
34 #include <QtGui/QPen>
34 #include <QtGui/QPen>
35 #include <QtWidgets/QGraphicsLayoutItem>
35 #include <QtWidgets/QGraphicsLayoutItem>
36
36
37 QT_CHARTS_BEGIN_NAMESPACE
37 QT_CHARTS_BEGIN_NAMESPACE
38
38
39 class QAbstractSeries;
39 class QAbstractSeries;
40 class QLegend;
40 class QLegend;
41
41
42 class QLegendMarker;
42 class QLegendMarker;
43 class LegendMarkerItem;
43 class LegendMarkerItem;
44
44
45 class QLegendMarkerPrivate : public QObject
45 class QLegendMarkerPrivate : public QObject
46 {
46 {
47 Q_OBJECT
47 Q_OBJECT
48 public:
48 public:
49 explicit QLegendMarkerPrivate(QLegendMarker *q, QLegend *legend);
49 explicit QLegendMarkerPrivate(QLegendMarker *q, QLegend *legend);
50 virtual ~QLegendMarkerPrivate();
50 virtual ~QLegendMarkerPrivate();
51
51
52 // Helper for now. (or declare LegendLayout as friend)
52 // Helper for now. (or declare LegendLayout as friend)
53 LegendMarkerItem* item() const { return m_item; }
53 LegendMarkerItem* item() const { return m_item; }
54
54
55 virtual QAbstractSeries* series() = 0;
55 virtual QAbstractSeries* series() = 0;
56 virtual QObject* relatedObject() = 0;
56 virtual QObject* relatedObject() = 0;
57
57
58 void invalidateLegend();
58 void invalidateLegend();
59
59
60 public Q_SLOTS:
60 public Q_SLOTS:
61 virtual void updated() = 0;
61 virtual void updated() = 0;
62
62
63 protected:
63 protected:
64 LegendMarkerItem *m_item;
64 LegendMarkerItem *m_item;
65 QLegend *m_legend;
65 QLegend *m_legend;
66 bool m_customLabel;
66 bool m_customLabel;
67 bool m_customBrush;
67 bool m_customBrush;
68 bool m_customPen;
68 bool m_customPen;
69
69
70 private:
70 private:
71 QLegendMarker *q_ptr;
71 QLegendMarker *q_ptr;
72
72
73 friend class QLegendPrivate;
73 friend class QLegendPrivate;
74 friend class LegendMarkerItem;
74 friend class LegendMarkerItem;
75 Q_DECLARE_PUBLIC(QLegendMarker)
75 Q_DECLARE_PUBLIC(QLegendMarker)
76 };
76 };
77
77
78 QT_CHARTS_END_NAMESPACE
78 QT_CHARTS_END_NAMESPACE
79
79
80 #endif // QLEGENDMARKERPRIVATE_H
80 #endif // QLEGENDMARKERPRIVATE_H
@@ -1,66 +1,66
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QPIELEGENDMARKER_P_H
28 #ifndef QPIELEGENDMARKER_P_H
29 #define QPIELEGENDMARKER_P_H
29 #define QPIELEGENDMARKER_P_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <private/qlegendmarker_p.h>
32 #include <private/qlegendmarker_p.h>
33 #include <private/legendmarkeritem_p.h>
33 #include <private/legendmarkeritem_p.h>
34 #include <QtCharts/QPieSeries>
34 #include <QtCharts/QPieSeries>
35 #include <QtCharts/QPieSlice>
35 #include <QtCharts/QPieSlice>
36
36
37 QT_CHARTS_BEGIN_NAMESPACE
37 QT_CHARTS_BEGIN_NAMESPACE
38
38
39 class QPieLegendMarker;
39 class QPieLegendMarker;
40
40
41 class QPieLegendMarkerPrivate : public QLegendMarkerPrivate
41 class QPieLegendMarkerPrivate : public QLegendMarkerPrivate
42 {
42 {
43 Q_OBJECT
43 Q_OBJECT
44 public:
44 public:
45 explicit QPieLegendMarkerPrivate(QPieLegendMarker *q, QPieSeries *series, QPieSlice *slice, QLegend *legend);
45 explicit QPieLegendMarkerPrivate(QPieLegendMarker *q, QPieSeries *series, QPieSlice *slice, QLegend *legend);
46 virtual ~QPieLegendMarkerPrivate();
46 virtual ~QPieLegendMarkerPrivate();
47
47
48 // internal
48 // internal
49 virtual QPieSeries* series();
49 virtual QPieSeries* series();
50 virtual QObject* relatedObject();
50 virtual QObject* relatedObject();
51
51
52 public Q_SLOTS:
52 public Q_SLOTS:
53 virtual void updated();
53 virtual void updated();
54
54
55 private:
55 private:
56 QPieLegendMarker *q_ptr;
56 QPieLegendMarker *q_ptr;
57
57
58 QPieSeries *m_series;
58 QPieSeries *m_series;
59 QPieSlice *m_slice;
59 QPieSlice *m_slice;
60
60
61 Q_DECLARE_PUBLIC(QPieLegendMarker)
61 Q_DECLARE_PUBLIC(QPieLegendMarker)
62 };
62 };
63
63
64 QT_CHARTS_END_NAMESPACE
64 QT_CHARTS_END_NAMESPACE
65
65
66 #endif // QPIELEGENDMARKER_P_H
66 #endif // QPIELEGENDMARKER_P_H
@@ -1,62 +1,62
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QXYLEGENDMARKER_P_H
28 #ifndef QXYLEGENDMARKER_P_H
29 #define QXYLEGENDMARKER_P_H
29 #define QXYLEGENDMARKER_P_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <private/qlegendmarker_p.h>
32 #include <private/qlegendmarker_p.h>
33 #include <private/legendmarkeritem_p.h>
33 #include <private/legendmarkeritem_p.h>
34 #include <QtCharts/QXYSeries>
34 #include <QtCharts/QXYSeries>
35
35
36 QT_CHARTS_BEGIN_NAMESPACE
36 QT_CHARTS_BEGIN_NAMESPACE
37
37
38 class QXYLegendMarker;
38 class QXYLegendMarker;
39
39
40 class QXYLegendMarkerPrivate : public QLegendMarkerPrivate
40 class QXYLegendMarkerPrivate : public QLegendMarkerPrivate
41 {
41 {
42 Q_OBJECT
42 Q_OBJECT
43 public:
43 public:
44 explicit QXYLegendMarkerPrivate(QXYLegendMarker *q, QXYSeries *series, QLegend *legend);
44 explicit QXYLegendMarkerPrivate(QXYLegendMarker *q, QXYSeries *series, QLegend *legend);
45 virtual ~QXYLegendMarkerPrivate();
45 virtual ~QXYLegendMarkerPrivate();
46
46
47 virtual QAbstractSeries* series();
47 virtual QAbstractSeries* series();
48 virtual QObject* relatedObject();
48 virtual QObject* relatedObject();
49
49
50 public Q_SLOTS:
50 public Q_SLOTS:
51 virtual void updated();
51 virtual void updated();
52
52
53 private:
53 private:
54 QXYLegendMarker *q_ptr;
54 QXYLegendMarker *q_ptr;
55 QXYSeries *m_series;
55 QXYSeries *m_series;
56
56
57 Q_DECLARE_PUBLIC(QXYLegendMarker)
57 Q_DECLARE_PUBLIC(QXYLegendMarker)
58 };
58 };
59
59
60 QT_CHARTS_END_NAMESPACE
60 QT_CHARTS_END_NAMESPACE
61
61
62 #endif // QXYLEGENDMARKER_P_H
62 #endif // QXYLEGENDMARKER_P_H
@@ -1,94 +1,94
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef LINECHARTITEM_H
28 #ifndef LINECHARTITEM_H
29 #define LINECHARTITEM_H
29 #define LINECHARTITEM_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <private/xychart_p.h>
32 #include <private/xychart_p.h>
33 #include <QtCharts/QChart>
33 #include <QtCharts/QChart>
34 #include <QtGui/QPen>
34 #include <QtGui/QPen>
35
35
36 QT_CHARTS_BEGIN_NAMESPACE
36 QT_CHARTS_BEGIN_NAMESPACE
37
37
38 class QLineSeries;
38 class QLineSeries;
39 class ChartPresenter;
39 class ChartPresenter;
40
40
41 class LineChartItem : public XYChart
41 class LineChartItem : public XYChart
42 {
42 {
43 Q_OBJECT
43 Q_OBJECT
44 Q_INTERFACES(QGraphicsItem)
44 Q_INTERFACES(QGraphicsItem)
45 public:
45 public:
46 explicit LineChartItem(QLineSeries *series, QGraphicsItem *item = 0);
46 explicit LineChartItem(QLineSeries *series, QGraphicsItem *item = 0);
47 ~LineChartItem() {}
47 ~LineChartItem() {}
48
48
49 //from QGraphicsItem
49 //from QGraphicsItem
50 QRectF boundingRect() const;
50 QRectF boundingRect() const;
51 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
51 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
52 QPainterPath shape() const;
52 QPainterPath shape() const;
53
53
54 QPainterPath path() const { return m_fullPath; }
54 QPainterPath path() const { return m_fullPath; }
55
55
56 public Q_SLOTS:
56 public Q_SLOTS:
57 void handleUpdated();
57 void handleUpdated();
58
58
59 protected:
59 protected:
60 void updateGeometry();
60 void updateGeometry();
61 void mousePressEvent(QGraphicsSceneMouseEvent *event);
61 void mousePressEvent(QGraphicsSceneMouseEvent *event);
62 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
62 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
63 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
63 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
64 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
64 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
65 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
65 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
66 void suppressPoints() { m_pointsVisible = false; }
66 void suppressPoints() { m_pointsVisible = false; }
67 void forceChartType(QChart::ChartType chartType) { m_chartType = chartType; }
67 void forceChartType(QChart::ChartType chartType) { m_chartType = chartType; }
68
68
69 private:
69 private:
70 QLineSeries *m_series;
70 QLineSeries *m_series;
71 QPainterPath m_linePath;
71 QPainterPath m_linePath;
72 QPainterPath m_linePathPolarRight;
72 QPainterPath m_linePathPolarRight;
73 QPainterPath m_linePathPolarLeft;
73 QPainterPath m_linePathPolarLeft;
74 QPainterPath m_fullPath;
74 QPainterPath m_fullPath;
75 QPainterPath m_shapePath;
75 QPainterPath m_shapePath;
76
76
77 QVector<QPointF> m_points;
77 QVector<QPointF> m_points;
78 QRectF m_rect;
78 QRectF m_rect;
79 QPen m_linePen;
79 QPen m_linePen;
80 bool m_pointsVisible;
80 bool m_pointsVisible;
81 QChart::ChartType m_chartType;
81 QChart::ChartType m_chartType;
82
82
83 bool m_pointLabelsVisible;
83 bool m_pointLabelsVisible;
84 QString m_pointLabelsFormat;
84 QString m_pointLabelsFormat;
85 QFont m_pointLabelsFont;
85 QFont m_pointLabelsFont;
86 QColor m_pointLabelsColor;
86 QColor m_pointLabelsColor;
87
87
88 QPointF m_lastMousePos;
88 QPointF m_lastMousePos;
89 bool m_mousePressed;
89 bool m_mousePressed;
90 };
90 };
91
91
92 QT_CHARTS_END_NAMESPACE
92 QT_CHARTS_END_NAMESPACE
93
93
94 #endif
94 #endif
@@ -1,49 +1,49
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QLINESERIES_P_H
28 #ifndef QLINESERIES_P_H
29 #define QLINESERIES_P_H
29 #define QLINESERIES_P_H
30
30
31 #include <private/qxyseries_p.h>
31 #include <private/qxyseries_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35
35
36 class QLineSeriesPrivate: public QXYSeriesPrivate
36 class QLineSeriesPrivate: public QXYSeriesPrivate
37 {
37 {
38 public:
38 public:
39 QLineSeriesPrivate(QLineSeries *q);
39 QLineSeriesPrivate(QLineSeries *q);
40 void initializeGraphics(QGraphicsItem* parent);
40 void initializeGraphics(QGraphicsItem* parent);
41 void initializeTheme(int index, ChartTheme* theme, bool forced = false);
41 void initializeTheme(int index, ChartTheme* theme, bool forced = false);
42
42
43 private:
43 private:
44 Q_DECLARE_PUBLIC(QLineSeries);
44 Q_DECLARE_PUBLIC(QLineSeries);
45 };
45 };
46
46
47 QT_CHARTS_END_NAMESPACE
47 QT_CHARTS_END_NAMESPACE
48
48
49 #endif
49 #endif
@@ -1,87 +1,87
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef PIECHARTITEM_H
28 #ifndef PIECHARTITEM_H
29 #define PIECHARTITEM_H
29 #define PIECHARTITEM_H
30
30
31 #include <QtCharts/QPieSeries>
31 #include <QtCharts/QPieSeries>
32 #include <private/chartitem_p.h>
32 #include <private/chartitem_p.h>
33 #include <private/piesliceitem_p.h>
33 #include <private/piesliceitem_p.h>
34 #include <QtCore/QPointer>
34 #include <QtCore/QPointer>
35
35
36 QT_BEGIN_NAMESPACE
36 QT_BEGIN_NAMESPACE
37 class QGraphicsItem;
37 class QGraphicsItem;
38 QT_END_NAMESPACE
38 QT_END_NAMESPACE
39
39
40 QT_CHARTS_BEGIN_NAMESPACE
40 QT_CHARTS_BEGIN_NAMESPACE
41 class QPieSlice;
41 class QPieSlice;
42 class ChartPresenter;
42 class ChartPresenter;
43 class PieAnimation;
43 class PieAnimation;
44
44
45 class PieChartItem : public ChartItem
45 class PieChartItem : public ChartItem
46 {
46 {
47 Q_OBJECT
47 Q_OBJECT
48
48
49 public:
49 public:
50 explicit PieChartItem(QPieSeries *series, QGraphicsItem* item = 0);
50 explicit PieChartItem(QPieSeries *series, QGraphicsItem* item = 0);
51 ~PieChartItem();
51 ~PieChartItem();
52
52
53 // from QGraphicsItem
53 // from QGraphicsItem
54 QRectF boundingRect() const { return m_rect; }
54 QRectF boundingRect() const { return m_rect; }
55 void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) {}
55 void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) {}
56
56
57 public Q_SLOTS:
57 public Q_SLOTS:
58 // from Chart
58 // from Chart
59 virtual void handleDomainUpdated();
59 virtual void handleDomainUpdated();
60
60
61 void updateLayout();
61 void updateLayout();
62 void handleSlicesAdded(QList<QPieSlice *> slices);
62 void handleSlicesAdded(QList<QPieSlice *> slices);
63 void handleSlicesRemoved(QList<QPieSlice *> slices);
63 void handleSlicesRemoved(QList<QPieSlice *> slices);
64 void handleSliceChanged();
64 void handleSliceChanged();
65 void handleSeriesVisibleChanged();
65 void handleSeriesVisibleChanged();
66 void handleOpacityChanged();
66 void handleOpacityChanged();
67
67
68 void setAnimation(PieAnimation *animation);
68 void setAnimation(PieAnimation *animation);
69 ChartAnimation *animation() const;
69 ChartAnimation *animation() const;
70
70
71 private:
71 private:
72 PieSliceData updateSliceGeometry(QPieSlice *slice);
72 PieSliceData updateSliceGeometry(QPieSlice *slice);
73
73
74 private:
74 private:
75 QHash<QPieSlice *, PieSliceItem *> m_sliceItems;
75 QHash<QPieSlice *, PieSliceItem *> m_sliceItems;
76 QPointer<QPieSeries> m_series;
76 QPointer<QPieSeries> m_series;
77 QRectF m_rect;
77 QRectF m_rect;
78 QPointF m_pieCenter;
78 QPointF m_pieCenter;
79 qreal m_pieRadius;
79 qreal m_pieRadius;
80 qreal m_holeSize;
80 qreal m_holeSize;
81 PieAnimation *m_animation;
81 PieAnimation *m_animation;
82
82
83 };
83 };
84
84
85 QT_CHARTS_END_NAMESPACE
85 QT_CHARTS_END_NAMESPACE
86
86
87 #endif // PIECHARTITEM_H
87 #endif // PIECHARTITEM_H
@@ -1,139 +1,139
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef PIESLICEDATA_P_H
28 #ifndef PIESLICEDATA_P_H
29 #define PIESLICEDATA_P_H
29 #define PIESLICEDATA_P_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <QtCharts/QPieSlice>
32 #include <QtCharts/QPieSlice>
33 #include <QtGui/QPen>
33 #include <QtGui/QPen>
34 #include <QtGui/QBrush>
34 #include <QtGui/QBrush>
35
35
36 QT_CHARTS_BEGIN_NAMESPACE
36 QT_CHARTS_BEGIN_NAMESPACE
37
37
38 template <class T>
38 template <class T>
39 class Themed : public T
39 class Themed : public T
40 {
40 {
41 public:
41 public:
42 Themed(): m_isThemed(true) {}
42 Themed(): m_isThemed(true) {}
43
43
44 inline T &operator=(const T &other) { return T::operator =(other); }
44 inline T &operator=(const T &other) { return T::operator =(other); }
45
45
46 inline bool operator!=(const T &other) const { return T::operator !=(other); }
46 inline bool operator!=(const T &other) const { return T::operator !=(other); }
47 inline bool operator!=(const Themed &other) const
47 inline bool operator!=(const Themed &other) const
48 {
48 {
49 if (T::operator !=(other))
49 if (T::operator !=(other))
50 return true;
50 return true;
51
51
52 if (m_isThemed != other.m_isThemed)
52 if (m_isThemed != other.m_isThemed)
53 return true;
53 return true;
54
54
55 return false;
55 return false;
56 }
56 }
57
57
58 inline void setThemed(bool state) { m_isThemed = state; }
58 inline void setThemed(bool state) { m_isThemed = state; }
59 inline bool isThemed() const { return m_isThemed; }
59 inline bool isThemed() const { return m_isThemed; }
60
60
61 private:
61 private:
62 bool m_isThemed;
62 bool m_isThemed;
63 };
63 };
64
64
65 class PieSliceData
65 class PieSliceData
66 {
66 {
67 public:
67 public:
68 PieSliceData() :
68 PieSliceData() :
69 m_value(0),
69 m_value(0),
70 m_isExploded(false),
70 m_isExploded(false),
71 m_explodeDistanceFactor(0.15),
71 m_explodeDistanceFactor(0.15),
72 m_isLabelVisible(false),
72 m_isLabelVisible(false),
73 m_labelPosition(QPieSlice::LabelOutside),
73 m_labelPosition(QPieSlice::LabelOutside),
74 m_labelArmLengthFactor(0.15),
74 m_labelArmLengthFactor(0.15),
75 m_percentage(0),
75 m_percentage(0),
76 m_radius(0),
76 m_radius(0),
77 m_startAngle(0),
77 m_startAngle(0),
78 m_angleSpan(0),
78 m_angleSpan(0),
79 m_holeRadius(0)
79 m_holeRadius(0)
80 {
80 {
81 }
81 }
82
82
83 bool operator!=(const PieSliceData &other) const {
83 bool operator!=(const PieSliceData &other) const {
84 if (!qFuzzyIsNull(m_value - other.m_value))
84 if (!qFuzzyIsNull(m_value - other.m_value))
85 return true;
85 return true;
86
86
87 if (m_slicePen != other.m_slicePen ||
87 if (m_slicePen != other.m_slicePen ||
88 m_sliceBrush != other.m_sliceBrush)
88 m_sliceBrush != other.m_sliceBrush)
89 return true;
89 return true;
90
90
91 if (m_isExploded != other.m_isExploded ||
91 if (m_isExploded != other.m_isExploded ||
92 !qFuzzyIsNull(m_explodeDistanceFactor - other.m_explodeDistanceFactor))
92 !qFuzzyIsNull(m_explodeDistanceFactor - other.m_explodeDistanceFactor))
93 return true;
93 return true;
94
94
95 if (m_isLabelVisible != other.m_isLabelVisible ||
95 if (m_isLabelVisible != other.m_isLabelVisible ||
96 m_labelText != other.m_labelText ||
96 m_labelText != other.m_labelText ||
97 m_labelFont != other.m_labelFont ||
97 m_labelFont != other.m_labelFont ||
98 m_labelPosition != other.m_labelPosition ||
98 m_labelPosition != other.m_labelPosition ||
99 !qFuzzyIsNull(m_labelArmLengthFactor - other.m_labelArmLengthFactor) ||
99 !qFuzzyIsNull(m_labelArmLengthFactor - other.m_labelArmLengthFactor) ||
100 m_labelBrush != other.m_labelBrush)
100 m_labelBrush != other.m_labelBrush)
101 return true;
101 return true;
102
102
103 if (!qFuzzyIsNull(m_percentage - other.m_percentage) ||
103 if (!qFuzzyIsNull(m_percentage - other.m_percentage) ||
104 m_center != other.m_center ||
104 m_center != other.m_center ||
105 !qFuzzyIsNull(m_radius - other.m_radius) ||
105 !qFuzzyIsNull(m_radius - other.m_radius) ||
106 !qFuzzyIsNull(m_startAngle - other.m_startAngle) ||
106 !qFuzzyIsNull(m_startAngle - other.m_startAngle) ||
107 !qFuzzyIsNull(m_angleSpan - other.m_angleSpan))
107 !qFuzzyIsNull(m_angleSpan - other.m_angleSpan))
108 return true;
108 return true;
109
109
110 return false;
110 return false;
111 }
111 }
112
112
113 qreal m_value;
113 qreal m_value;
114
114
115 Themed<QPen> m_slicePen;
115 Themed<QPen> m_slicePen;
116 Themed<QBrush> m_sliceBrush;
116 Themed<QBrush> m_sliceBrush;
117
117
118 bool m_isExploded;
118 bool m_isExploded;
119 qreal m_explodeDistanceFactor;
119 qreal m_explodeDistanceFactor;
120
120
121 bool m_isLabelVisible;
121 bool m_isLabelVisible;
122 QString m_labelText;
122 QString m_labelText;
123 Themed<QFont> m_labelFont;
123 Themed<QFont> m_labelFont;
124 QPieSlice::LabelPosition m_labelPosition;
124 QPieSlice::LabelPosition m_labelPosition;
125 qreal m_labelArmLengthFactor;
125 qreal m_labelArmLengthFactor;
126 Themed<QBrush> m_labelBrush;
126 Themed<QBrush> m_labelBrush;
127
127
128 qreal m_percentage;
128 qreal m_percentage;
129 QPointF m_center;
129 QPointF m_center;
130 qreal m_radius;
130 qreal m_radius;
131 qreal m_startAngle;
131 qreal m_startAngle;
132 qreal m_angleSpan;
132 qreal m_angleSpan;
133
133
134 qreal m_holeRadius;
134 qreal m_holeRadius;
135 };
135 };
136
136
137 QT_CHARTS_END_NAMESPACE
137 QT_CHARTS_END_NAMESPACE
138
138
139 #endif // PIESLICEDATA_P_H
139 #endif // PIESLICEDATA_P_H
@@ -1,96 +1,96
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef PIESLICEITEM_H
28 #ifndef PIESLICEITEM_H
29 #define PIESLICEITEM_H
29 #define PIESLICEITEM_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <private/charttheme_p.h>
32 #include <private/charttheme_p.h>
33 #include <QtCharts/QPieSeries>
33 #include <QtCharts/QPieSeries>
34 #include <private/pieslicedata_p.h>
34 #include <private/pieslicedata_p.h>
35 #include <QtWidgets/QGraphicsItem>
35 #include <QtWidgets/QGraphicsItem>
36 #include <QtCore/QRectF>
36 #include <QtCore/QRectF>
37 #include <QtGui/QColor>
37 #include <QtGui/QColor>
38 #include <QtGui/QPen>
38 #include <QtGui/QPen>
39
39
40 #define PIESLICE_LABEL_GAP 5
40 #define PIESLICE_LABEL_GAP 5
41
41
42 QT_CHARTS_BEGIN_NAMESPACE
42 QT_CHARTS_BEGIN_NAMESPACE
43 class PieChartItem;
43 class PieChartItem;
44 class PieSliceLabel;
44 class PieSliceLabel;
45 class QPieSlice;
45 class QPieSlice;
46
46
47 class PieSliceItem : public QGraphicsObject
47 class PieSliceItem : public QGraphicsObject
48 {
48 {
49 Q_OBJECT
49 Q_OBJECT
50
50
51 public:
51 public:
52 PieSliceItem(QGraphicsItem *parent = 0);
52 PieSliceItem(QGraphicsItem *parent = 0);
53 ~PieSliceItem();
53 ~PieSliceItem();
54
54
55 // from QGraphicsItem
55 // from QGraphicsItem
56 QRectF boundingRect() const;
56 QRectF boundingRect() const;
57 QPainterPath shape() const;
57 QPainterPath shape() const;
58 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
58 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
59 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
59 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
60 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
60 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
61 void mousePressEvent(QGraphicsSceneMouseEvent *event);
61 void mousePressEvent(QGraphicsSceneMouseEvent *event);
62 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
62 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
63 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
63 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
64
64
65 void setLayout(const PieSliceData &sliceData);
65 void setLayout(const PieSliceData &sliceData);
66 static QPointF sliceCenter(QPointF point, qreal radius, QPieSlice *slice);
66 static QPointF sliceCenter(QPointF point, qreal radius, QPieSlice *slice);
67
67
68 Q_SIGNALS:
68 Q_SIGNALS:
69 void clicked(Qt::MouseButtons buttons);
69 void clicked(Qt::MouseButtons buttons);
70 void hovered(bool state);
70 void hovered(bool state);
71 void pressed(Qt::MouseButtons buttons);
71 void pressed(Qt::MouseButtons buttons);
72 void released(Qt::MouseButtons buttons);
72 void released(Qt::MouseButtons buttons);
73 void doubleClicked(Qt::MouseButtons buttons);
73 void doubleClicked(Qt::MouseButtons buttons);
74
74
75 private:
75 private:
76 void updateGeometry();
76 void updateGeometry();
77 QPainterPath slicePath(QPointF center, qreal radius, qreal startAngle, qreal angleSpan, qreal *centerAngle, QPointF *armStart);
77 QPainterPath slicePath(QPointF center, qreal radius, qreal startAngle, qreal angleSpan, qreal *centerAngle, QPointF *armStart);
78 QPainterPath labelArmPath(QPointF start, qreal angle, qreal length, qreal textWidth, QPointF *textStart);
78 QPainterPath labelArmPath(QPointF start, qreal angle, qreal length, qreal textWidth, QPointF *textStart);
79
79
80 private:
80 private:
81 PieSliceData m_data;
81 PieSliceData m_data;
82 QRectF m_boundingRect;
82 QRectF m_boundingRect;
83 QPainterPath m_slicePath;
83 QPainterPath m_slicePath;
84 QPainterPath m_labelArmPath;
84 QPainterPath m_labelArmPath;
85 QRectF m_labelTextRect;
85 QRectF m_labelTextRect;
86 bool m_hovered;
86 bool m_hovered;
87 QGraphicsTextItem *m_labelItem;
87 QGraphicsTextItem *m_labelItem;
88
88
89 bool m_mousePressed;
89 bool m_mousePressed;
90
90
91 friend class PieSliceAnimation;
91 friend class PieSliceAnimation;
92 };
92 };
93
93
94 QT_CHARTS_END_NAMESPACE
94 QT_CHARTS_END_NAMESPACE
95
95
96 #endif // PIESLICEITEM_H
96 #endif // PIESLICEITEM_H
@@ -1,99 +1,99
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QPIEMODELMAPPER_P_H
28 #ifndef QPIEMODELMAPPER_P_H
29 #define QPIEMODELMAPPER_P_H
29 #define QPIEMODELMAPPER_P_H
30
30
31 #include <QtCore/QObject>
31 #include <QtCore/QObject>
32 #include <QtCharts/QPieModelMapper>
32 #include <QtCharts/QPieModelMapper>
33
33
34 QT_BEGIN_NAMESPACE
34 QT_BEGIN_NAMESPACE
35 class QModelIndex;
35 class QModelIndex;
36 QT_END_NAMESPACE
36 QT_END_NAMESPACE
37
37
38 QT_CHARTS_BEGIN_NAMESPACE
38 QT_CHARTS_BEGIN_NAMESPACE
39
39
40 class QPieSlice;
40 class QPieSlice;
41
41
42 class QPieModelMapperPrivate : public QObject
42 class QPieModelMapperPrivate : public QObject
43 {
43 {
44 Q_OBJECT
44 Q_OBJECT
45
45
46 public:
46 public:
47 explicit QPieModelMapperPrivate(QPieModelMapper *q);
47 explicit QPieModelMapperPrivate(QPieModelMapper *q);
48
48
49 public Q_SLOTS:
49 public Q_SLOTS:
50 // for the model
50 // for the model
51 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
51 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
52 void modelRowsAdded(QModelIndex parent, int start, int end);
52 void modelRowsAdded(QModelIndex parent, int start, int end);
53 void modelRowsRemoved(QModelIndex parent, int start, int end);
53 void modelRowsRemoved(QModelIndex parent, int start, int end);
54 void modelColumnsAdded(QModelIndex parent, int start, int end);
54 void modelColumnsAdded(QModelIndex parent, int start, int end);
55 void modelColumnsRemoved(QModelIndex parent, int start, int end);
55 void modelColumnsRemoved(QModelIndex parent, int start, int end);
56 void handleModelDestroyed();
56 void handleModelDestroyed();
57
57
58 // for the series
58 // for the series
59 void slicesAdded(QList<QPieSlice *> slices);
59 void slicesAdded(QList<QPieSlice *> slices);
60 void slicesRemoved(QList<QPieSlice *> slices);
60 void slicesRemoved(QList<QPieSlice *> slices);
61 void sliceLabelChanged();
61 void sliceLabelChanged();
62 void sliceValueChanged();
62 void sliceValueChanged();
63 void handleSeriesDestroyed();
63 void handleSeriesDestroyed();
64
64
65 void initializePieFromModel();
65 void initializePieFromModel();
66
66
67 private:
67 private:
68 QPieSlice *pieSlice(QModelIndex index) const;
68 QPieSlice *pieSlice(QModelIndex index) const;
69 bool isLabelIndex(QModelIndex index) const;
69 bool isLabelIndex(QModelIndex index) const;
70 bool isValueIndex(QModelIndex index) const;
70 bool isValueIndex(QModelIndex index) const;
71 QModelIndex valueModelIndex(int slicePos);
71 QModelIndex valueModelIndex(int slicePos);
72 QModelIndex labelModelIndex(int slicePos);
72 QModelIndex labelModelIndex(int slicePos);
73 void insertData(int start, int end);
73 void insertData(int start, int end);
74 void removeData(int start, int end);
74 void removeData(int start, int end);
75
75
76 void blockModelSignals(bool block = true);
76 void blockModelSignals(bool block = true);
77 void blockSeriesSignals(bool block = true);
77 void blockSeriesSignals(bool block = true);
78
78
79 private:
79 private:
80 QPieSeries *m_series;
80 QPieSeries *m_series;
81 QList<QPieSlice *> m_slices;
81 QList<QPieSlice *> m_slices;
82 QAbstractItemModel *m_model;
82 QAbstractItemModel *m_model;
83 int m_first;
83 int m_first;
84 int m_count;
84 int m_count;
85 Qt::Orientation m_orientation;
85 Qt::Orientation m_orientation;
86 int m_valuesSection;
86 int m_valuesSection;
87 int m_labelsSection;
87 int m_labelsSection;
88 bool m_seriesSignalsBlock;
88 bool m_seriesSignalsBlock;
89 bool m_modelSignalsBlock;
89 bool m_modelSignalsBlock;
90
90
91 private:
91 private:
92
92
93 QPieModelMapper *q_ptr;
93 QPieModelMapper *q_ptr;
94 Q_DECLARE_PUBLIC(QPieModelMapper)
94 Q_DECLARE_PUBLIC(QPieModelMapper)
95 };
95 };
96
96
97 QT_CHARTS_END_NAMESPACE
97 QT_CHARTS_END_NAMESPACE
98
98
99 #endif // QPIEMODELMAPPER_P_H
99 #endif // QPIEMODELMAPPER_P_H
@@ -1,95 +1,95
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QPIESERIES_P_H
28 #ifndef QPIESERIES_P_H
29 #define QPIESERIES_P_H
29 #define QPIESERIES_P_H
30
30
31 #include <QtCharts/QPieSeries>
31 #include <QtCharts/QPieSeries>
32 #include <private/qabstractseries_p.h>
32 #include <private/qabstractseries_p.h>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35 class QLegendPrivate;
35 class QLegendPrivate;
36
36
37 class QPieSeriesPrivate : public QAbstractSeriesPrivate
37 class QPieSeriesPrivate : public QAbstractSeriesPrivate
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40
40
41 public:
41 public:
42 QPieSeriesPrivate(QPieSeries *parent);
42 QPieSeriesPrivate(QPieSeries *parent);
43 ~QPieSeriesPrivate();
43 ~QPieSeriesPrivate();
44
44
45 void initializeDomain();
45 void initializeDomain();
46 void initializeAxes();
46 void initializeAxes();
47 void initializeGraphics(QGraphicsItem* parent);
47 void initializeGraphics(QGraphicsItem* parent);
48 void initializeAnimations(QtCharts::QChart::AnimationOptions options, int duration,
48 void initializeAnimations(QtCharts::QChart::AnimationOptions options, int duration,
49 QEasingCurve &curve);
49 QEasingCurve &curve);
50 void initializeTheme(int index, ChartTheme* theme, bool forced = false);
50 void initializeTheme(int index, ChartTheme* theme, bool forced = false);
51
51
52 QList<QLegendMarker *> createLegendMarkers(QLegend *legend);
52 QList<QLegendMarker *> createLegendMarkers(QLegend *legend);
53
53
54 QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
54 QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
55 QAbstractAxis* createDefaultAxis(Qt::Orientation orientation) const;
55 QAbstractAxis* createDefaultAxis(Qt::Orientation orientation) const;
56
56
57 void updateDerivativeData();
57 void updateDerivativeData();
58 void setSizes(qreal innerSize, qreal outerSize);
58 void setSizes(qreal innerSize, qreal outerSize);
59
59
60 static QPieSeriesPrivate *fromSeries(QPieSeries *series);
60 static QPieSeriesPrivate *fromSeries(QPieSeries *series);
61
61
62 Q_SIGNALS:
62 Q_SIGNALS:
63 void calculatedDataChanged();
63 void calculatedDataChanged();
64 void pieSizeChanged();
64 void pieSizeChanged();
65 void pieStartAngleChanged();
65 void pieStartAngleChanged();
66 void pieEndAngleChanged();
66 void pieEndAngleChanged();
67 void horizontalPositionChanged();
67 void horizontalPositionChanged();
68 void verticalPositionChanged();
68 void verticalPositionChanged();
69
69
70 public Q_SLOTS:
70 public Q_SLOTS:
71 void sliceValueChanged();
71 void sliceValueChanged();
72 void sliceClicked();
72 void sliceClicked();
73 void sliceHovered(bool state);
73 void sliceHovered(bool state);
74 void slicePressed();
74 void slicePressed();
75 void sliceReleased();
75 void sliceReleased();
76 void sliceDoubleClicked();
76 void sliceDoubleClicked();
77
77
78 private:
78 private:
79 QList<QPieSlice *> m_slices;
79 QList<QPieSlice *> m_slices;
80 qreal m_pieRelativeHorPos;
80 qreal m_pieRelativeHorPos;
81 qreal m_pieRelativeVerPos;
81 qreal m_pieRelativeVerPos;
82 qreal m_pieRelativeSize;
82 qreal m_pieRelativeSize;
83 qreal m_pieStartAngle;
83 qreal m_pieStartAngle;
84 qreal m_pieEndAngle;
84 qreal m_pieEndAngle;
85 qreal m_sum;
85 qreal m_sum;
86 qreal m_holeRelativeSize;
86 qreal m_holeRelativeSize;
87
87
88 public:
88 public:
89 friend class QLegendPrivate;
89 friend class QLegendPrivate;
90 Q_DECLARE_PUBLIC(QPieSeries)
90 Q_DECLARE_PUBLIC(QPieSeries)
91 };
91 };
92
92
93 QT_CHARTS_END_NAMESPACE
93 QT_CHARTS_END_NAMESPACE
94
94
95 #endif // QPIESERIES_P_H
95 #endif // QPIESERIES_P_H
@@ -1,78 +1,78
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QPIESLICE_P_H
28 #ifndef QPIESLICE_P_H
29 #define QPIESLICE_P_H
29 #define QPIESLICE_P_H
30
30
31 #include <QtCore/QObject>
31 #include <QtCore/QObject>
32 #include <QtCharts/QPieSlice>
32 #include <QtCharts/QPieSlice>
33 #include <private/pieslicedata_p.h>
33 #include <private/pieslicedata_p.h>
34
34
35 QT_CHARTS_BEGIN_NAMESPACE
35 QT_CHARTS_BEGIN_NAMESPACE
36 class QPieSeries;
36 class QPieSeries;
37
37
38 class QPieSlicePrivate : public QObject
38 class QPieSlicePrivate : public QObject
39 {
39 {
40 Q_OBJECT
40 Q_OBJECT
41
41
42 public:
42 public:
43 QPieSlicePrivate(QPieSlice *parent);
43 QPieSlicePrivate(QPieSlice *parent);
44 ~QPieSlicePrivate();
44 ~QPieSlicePrivate();
45
45
46 static QPieSlicePrivate *fromSlice(QPieSlice *slice);
46 static QPieSlicePrivate *fromSlice(QPieSlice *slice);
47
47
48 void setPen(const QPen &pen, bool themed);
48 void setPen(const QPen &pen, bool themed);
49 void setBrush(const QBrush &brush, bool themed);
49 void setBrush(const QBrush &brush, bool themed);
50 void setLabelBrush(const QBrush &brush, bool themed);
50 void setLabelBrush(const QBrush &brush, bool themed);
51 void setLabelFont(const QFont &font, bool themed);
51 void setLabelFont(const QFont &font, bool themed);
52
52
53 void setPercentage(qreal percentage);
53 void setPercentage(qreal percentage);
54 void setStartAngle(qreal angle);
54 void setStartAngle(qreal angle);
55 void setAngleSpan(qreal span);
55 void setAngleSpan(qreal span);
56
56
57 Q_SIGNALS:
57 Q_SIGNALS:
58 void labelPositionChanged();
58 void labelPositionChanged();
59 void explodedChanged();
59 void explodedChanged();
60 void labelArmLengthFactorChanged();
60 void labelArmLengthFactorChanged();
61 void explodeDistanceFactorChanged();
61 void explodeDistanceFactorChanged();
62
62
63 private:
63 private:
64 friend class QPieSeries;
64 friend class QPieSeries;
65 friend class QPieSeriesPrivate;
65 friend class QPieSeriesPrivate;
66 friend class ChartThemeManager;
66 friend class ChartThemeManager;
67 friend class PieChartItem;
67 friend class PieChartItem;
68
68
69 QPieSlice * const q_ptr;
69 QPieSlice * const q_ptr;
70 Q_DECLARE_PUBLIC(QPieSlice)
70 Q_DECLARE_PUBLIC(QPieSlice)
71
71
72 PieSliceData m_data;
72 PieSliceData m_data;
73 QPieSeries *m_series;
73 QPieSeries *m_series;
74 };
74 };
75
75
76 QT_CHARTS_END_NAMESPACE
76 QT_CHARTS_END_NAMESPACE
77
77
78 #endif // QPIESLICE_P_H
78 #endif // QPIESLICE_P_H
@@ -1,109 +1,109
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QABSTRACTSERIES_P_H
28 #ifndef QABSTRACTSERIES_P_H
29 #define QABSTRACTSERIES_P_H
29 #define QABSTRACTSERIES_P_H
30
30
31 #include <QtCharts/QAbstractSeries>
31 #include <QtCharts/QAbstractSeries>
32 #include <QtCharts/QChart>
32 #include <QtCharts/QChart>
33 #include <private/abstractdomain_p.h>
33 #include <private/abstractdomain_p.h>
34
34
35 QT_BEGIN_NAMESPACE
35 QT_BEGIN_NAMESPACE
36 class QGraphicsItem;
36 class QGraphicsItem;
37 QT_END_NAMESPACE
37 QT_END_NAMESPACE
38
38
39 QT_CHARTS_BEGIN_NAMESPACE
39 QT_CHARTS_BEGIN_NAMESPACE
40
40
41 class ChartPresenter;
41 class ChartPresenter;
42 class ChartElement;
42 class ChartElement;
43 class LegendMarker;
43 class LegendMarker;
44 class QLegend;
44 class QLegend;
45 class ChartDataSet;
45 class ChartDataSet;
46 class QAbstractAxis;
46 class QAbstractAxis;
47 class QLegendMarker;
47 class QLegendMarker;
48 class ChartTheme;
48 class ChartTheme;
49 class ChartAnimation;
49 class ChartAnimation;
50 class ChartItem;
50 class ChartItem;
51 class BoxPlotChartItem;
51 class BoxPlotChartItem;
52
52
53 class QAbstractSeriesPrivate : public QObject
53 class QAbstractSeriesPrivate : public QObject
54 {
54 {
55 Q_OBJECT
55 Q_OBJECT
56 public:
56 public:
57 QAbstractSeriesPrivate(QAbstractSeries *q);
57 QAbstractSeriesPrivate(QAbstractSeries *q);
58 ~QAbstractSeriesPrivate();
58 ~QAbstractSeriesPrivate();
59
59
60 virtual void initializeDomain() = 0;
60 virtual void initializeDomain() = 0;
61 virtual void initializeAxes() = 0;
61 virtual void initializeAxes() = 0;
62 virtual void initializeTheme(int index, ChartTheme* theme, bool forced = false) = 0;
62 virtual void initializeTheme(int index, ChartTheme* theme, bool forced = false) = 0;
63 virtual void initializeGraphics(QGraphicsItem* parent) = 0;
63 virtual void initializeGraphics(QGraphicsItem* parent) = 0;
64 virtual void initializeAnimations(QChart::AnimationOptions options, int duration,
64 virtual void initializeAnimations(QChart::AnimationOptions options, int duration,
65 QEasingCurve &curve) = 0;
65 QEasingCurve &curve) = 0;
66
66
67 virtual QList<QLegendMarker*> createLegendMarkers(QLegend* legend) = 0;
67 virtual QList<QLegendMarker*> createLegendMarkers(QLegend* legend) = 0;
68
68
69 virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation) const = 0;
69 virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation) const = 0;
70 virtual QAbstractAxis* createDefaultAxis(Qt::Orientation) const = 0;
70 virtual QAbstractAxis* createDefaultAxis(Qt::Orientation) const = 0;
71
71
72 ChartItem* chartItem() { return m_item.data(); }
72 ChartItem* chartItem() { return m_item.data(); }
73
73
74 virtual void setDomain(AbstractDomain* domain);
74 virtual void setDomain(AbstractDomain* domain);
75 AbstractDomain* domain() { return m_domain.data(); }
75 AbstractDomain* domain() { return m_domain.data(); }
76
76
77 virtual void setPresenter(ChartPresenter *presenter);
77 virtual void setPresenter(ChartPresenter *presenter);
78 ChartPresenter *presenter() const;
78 ChartPresenter *presenter() const;
79
79
80 QChart* chart() { return m_chart; }
80 QChart* chart() { return m_chart; }
81 bool reverseXAxis();
81 bool reverseXAxis();
82 bool reverseYAxis();
82 bool reverseYAxis();
83
83
84 Q_SIGNALS:
84 Q_SIGNALS:
85 void countChanged();
85 void countChanged();
86
86
87 protected:
87 protected:
88 QAbstractSeries *q_ptr;
88 QAbstractSeries *q_ptr;
89 QChart *m_chart;
89 QChart *m_chart;
90 QScopedPointer<ChartItem> m_item;
90 QScopedPointer<ChartItem> m_item;
91 QList<QAbstractAxis*> m_axes;
91 QList<QAbstractAxis*> m_axes;
92
92
93 private:
93 private:
94 QScopedPointer<AbstractDomain> m_domain;
94 QScopedPointer<AbstractDomain> m_domain;
95 QString m_name;
95 QString m_name;
96 bool m_visible;
96 bool m_visible;
97 qreal m_opacity;
97 qreal m_opacity;
98 ChartPresenter *m_presenter;
98 ChartPresenter *m_presenter;
99
99
100 friend class QAbstractSeries;
100 friend class QAbstractSeries;
101 friend class ChartDataSet;
101 friend class ChartDataSet;
102 friend class ChartPresenter;
102 friend class ChartPresenter;
103 friend class QLegendPrivate;
103 friend class QLegendPrivate;
104 friend class BoxPlotChartItem;
104 friend class BoxPlotChartItem;
105 };
105 };
106
106
107 QT_CHARTS_END_NAMESPACE
107 QT_CHARTS_END_NAMESPACE
108
108
109 #endif
109 #endif
@@ -1,68 +1,68
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QCHART_P_H
28 #ifndef QCHART_P_H
29 #define QCHART_P_H
29 #define QCHART_P_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <QtCharts/QChart>
32 #include <QtCharts/QChart>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class ChartThemeManager;
36 class ChartThemeManager;
37 class ChartPresenter;
37 class ChartPresenter;
38 class QLegend;
38 class QLegend;
39 class ChartDataSet;
39 class ChartDataSet;
40
40
41 class QChartPrivate
41 class QChartPrivate
42 {
42 {
43
43
44 public:
44 public:
45 QChartPrivate(QChart *q, QChart::ChartType type);
45 QChartPrivate(QChart *q, QChart::ChartType type);
46 ~QChartPrivate();
46 ~QChartPrivate();
47 QChart *q_ptr;
47 QChart *q_ptr;
48 QLegend *m_legend;
48 QLegend *m_legend;
49 ChartDataSet *m_dataset;
49 ChartDataSet *m_dataset;
50 ChartPresenter *m_presenter;
50 ChartPresenter *m_presenter;
51 ChartThemeManager *m_themeManager;
51 ChartThemeManager *m_themeManager;
52 QChart::ChartType m_type;
52 QChart::ChartType m_type;
53
53
54 static QPen &defaultPen();
54 static QPen &defaultPen();
55 static QBrush &defaultBrush();
55 static QBrush &defaultBrush();
56 static QFont &defaultFont();
56 static QFont &defaultFont();
57
57
58 void init();
58 void init();
59 void zoomIn(qreal factor);
59 void zoomIn(qreal factor);
60 void zoomOut(qreal factor);
60 void zoomOut(qreal factor);
61 void zoomIn(const QRectF &rect);
61 void zoomIn(const QRectF &rect);
62 void zoomReset();
62 void zoomReset();
63 bool isZoomed();
63 bool isZoomed();
64 void scroll(qreal dx, qreal dy);
64 void scroll(qreal dx, qreal dy);
65 };
65 };
66
66
67 QT_CHARTS_END_NAMESPACE
67 QT_CHARTS_END_NAMESPACE
68 #endif
68 #endif
@@ -1,65 +1,65
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QCHARTVIEW_P_H
28 #ifndef QCHARTVIEW_P_H
29 #define QCHARTVIEW_P_H
29 #define QCHARTVIEW_P_H
30
30
31 #include <QtCharts/QChartView>
31 #include <QtCharts/QChartView>
32
32
33 QT_BEGIN_NAMESPACE
33 QT_BEGIN_NAMESPACE
34 class QGraphicsScene;
34 class QGraphicsScene;
35 QT_END_NAMESPACE
35 QT_END_NAMESPACE
36
36
37 QT_CHARTS_BEGIN_NAMESPACE
37 QT_CHARTS_BEGIN_NAMESPACE
38
38
39 class QChart;
39 class QChart;
40 class ChartPresenter;
40 class ChartPresenter;
41 class QChartView;
41 class QChartView;
42
42
43 class QChartViewPrivate
43 class QChartViewPrivate
44 {
44 {
45 public:
45 public:
46 explicit QChartViewPrivate(QChartView *q, QChart *chart = 0);
46 explicit QChartViewPrivate(QChartView *q, QChart *chart = 0);
47 ~QChartViewPrivate();
47 ~QChartViewPrivate();
48 void setChart(QChart *chart);
48 void setChart(QChart *chart);
49 void resize();
49 void resize();
50
50
51 protected:
51 protected:
52 QChartView *q_ptr;
52 QChartView *q_ptr;
53
53
54 public:
54 public:
55 QGraphicsScene *m_scene;
55 QGraphicsScene *m_scene;
56 QChart *m_chart;
56 QChart *m_chart;
57 QPoint m_rubberBandOrigin;
57 QPoint m_rubberBandOrigin;
58 #ifndef QT_NO_RUBBERBAND
58 #ifndef QT_NO_RUBBERBAND
59 QRubberBand *m_rubberBand;
59 QRubberBand *m_rubberBand;
60 #endif
60 #endif
61 QChartView::RubberBands m_rubberBandFlags;
61 QChartView::RubberBands m_rubberBandFlags;
62 };
62 };
63
63
64 QT_CHARTS_END_NAMESPACE
64 QT_CHARTS_END_NAMESPACE
65 #endif
65 #endif
@@ -1,52 +1,52
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QSCATTERSERIES_P_H
28 #ifndef QSCATTERSERIES_P_H
29 #define QSCATTERSERIES_P_H
29 #define QSCATTERSERIES_P_H
30
30
31 #include <private/qxyseries_p.h>
31 #include <private/qxyseries_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QScatterSeriesPrivate: public QXYSeriesPrivate
35 class QScatterSeriesPrivate: public QXYSeriesPrivate
36 {
36 {
37 public:
37 public:
38 QScatterSeriesPrivate(QScatterSeries *q);
38 QScatterSeriesPrivate(QScatterSeries *q);
39 void initializeGraphics(QGraphicsItem* parent);
39 void initializeGraphics(QGraphicsItem* parent);
40 void initializeTheme(int index, ChartTheme* theme, bool forced = false);
40 void initializeTheme(int index, ChartTheme* theme, bool forced = false);
41 void initializeAnimations(QtCharts::QChart::AnimationOptions options, int duration,
41 void initializeAnimations(QtCharts::QChart::AnimationOptions options, int duration,
42 QEasingCurve &curve);
42 QEasingCurve &curve);
43
43
44 private:
44 private:
45 QScatterSeries::MarkerShape m_shape;
45 QScatterSeries::MarkerShape m_shape;
46 qreal m_size;
46 qreal m_size;
47 Q_DECLARE_PUBLIC(QScatterSeries)
47 Q_DECLARE_PUBLIC(QScatterSeries)
48 };
48 };
49
49
50 QT_CHARTS_END_NAMESPACE
50 QT_CHARTS_END_NAMESPACE
51
51
52 #endif
52 #endif
@@ -1,189 +1,189
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef SCATTERCHARTITEM_H
28 #ifndef SCATTERCHARTITEM_H
29 #define SCATTERCHARTITEM_H
29 #define SCATTERCHARTITEM_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <private/xychart_p.h>
32 #include <private/xychart_p.h>
33 #include <QtWidgets/QGraphicsEllipseItem>
33 #include <QtWidgets/QGraphicsEllipseItem>
34 #include <QtGui/QPen>
34 #include <QtGui/QPen>
35 #include <QtWidgets/QGraphicsSceneMouseEvent>
35 #include <QtWidgets/QGraphicsSceneMouseEvent>
36
36
37 QT_CHARTS_BEGIN_NAMESPACE
37 QT_CHARTS_BEGIN_NAMESPACE
38
38
39 class QScatterSeries;
39 class QScatterSeries;
40
40
41 class ScatterChartItem : public XYChart
41 class ScatterChartItem : public XYChart
42 {
42 {
43 Q_OBJECT
43 Q_OBJECT
44 Q_INTERFACES(QGraphicsItem)
44 Q_INTERFACES(QGraphicsItem)
45 public:
45 public:
46 explicit ScatterChartItem(QScatterSeries *series, QGraphicsItem *item = 0);
46 explicit ScatterChartItem(QScatterSeries *series, QGraphicsItem *item = 0);
47
47
48 public:
48 public:
49 //from QGraphicsItem
49 //from QGraphicsItem
50 QRectF boundingRect() const;
50 QRectF boundingRect() const;
51 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
51 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
52
52
53 void setPen(const QPen &pen);
53 void setPen(const QPen &pen);
54 void setBrush(const QBrush &brush);
54 void setBrush(const QBrush &brush);
55
55
56 void markerSelected(QGraphicsItem *item);
56 void markerSelected(QGraphicsItem *item);
57 void markerHovered(QGraphicsItem *item, bool state);
57 void markerHovered(QGraphicsItem *item, bool state);
58 void markerPressed(QGraphicsItem *item);
58 void markerPressed(QGraphicsItem *item);
59 void markerReleased(QGraphicsItem *item);
59 void markerReleased(QGraphicsItem *item);
60 void markerDoubleClicked(QGraphicsItem *item);
60 void markerDoubleClicked(QGraphicsItem *item);
61
61
62 void setMousePressed(bool pressed = true) {m_mousePressed = pressed;}
62 void setMousePressed(bool pressed = true) {m_mousePressed = pressed;}
63 bool mousePressed() {return m_mousePressed;}
63 bool mousePressed() {return m_mousePressed;}
64
64
65
65
66 public Q_SLOTS:
66 public Q_SLOTS:
67 void handleUpdated();
67 void handleUpdated();
68
68
69 private:
69 private:
70 void createPoints(int count);
70 void createPoints(int count);
71 void deletePoints(int count);
71 void deletePoints(int count);
72
72
73 protected:
73 protected:
74 void updateGeometry();
74 void updateGeometry();
75
75
76 private:
76 private:
77 QScatterSeries *m_series;
77 QScatterSeries *m_series;
78 QGraphicsItemGroup m_items;
78 QGraphicsItemGroup m_items;
79 bool m_visible;
79 bool m_visible;
80 int m_shape;
80 int m_shape;
81 int m_size;
81 int m_size;
82 QRectF m_rect;
82 QRectF m_rect;
83 QMap<QGraphicsItem *, QPointF> m_markerMap;
83 QMap<QGraphicsItem *, QPointF> m_markerMap;
84
84
85 bool m_pointLabelsVisible;
85 bool m_pointLabelsVisible;
86 QString m_pointLabelsFormat;
86 QString m_pointLabelsFormat;
87 QFont m_pointLabelsFont;
87 QFont m_pointLabelsFont;
88 QColor m_pointLabelsColor;
88 QColor m_pointLabelsColor;
89
89
90 bool m_mousePressed;
90 bool m_mousePressed;
91 };
91 };
92
92
93 class CircleMarker: public QGraphicsEllipseItem
93 class CircleMarker: public QGraphicsEllipseItem
94 {
94 {
95
95
96 public:
96 public:
97 CircleMarker(qreal x, qreal y, qreal w, qreal h, ScatterChartItem *parent)
97 CircleMarker(qreal x, qreal y, qreal w, qreal h, ScatterChartItem *parent)
98 : QGraphicsEllipseItem(x, y, w, h, parent),
98 : QGraphicsEllipseItem(x, y, w, h, parent),
99 m_parent(parent)
99 m_parent(parent)
100 {
100 {
101 setAcceptHoverEvents(true);
101 setAcceptHoverEvents(true);
102 setFlag(QGraphicsItem::ItemIsSelectable);
102 setFlag(QGraphicsItem::ItemIsSelectable);
103 }
103 }
104
104
105 protected:
105 protected:
106 void mousePressEvent(QGraphicsSceneMouseEvent *event)
106 void mousePressEvent(QGraphicsSceneMouseEvent *event)
107 {
107 {
108 QGraphicsEllipseItem::mousePressEvent(event);
108 QGraphicsEllipseItem::mousePressEvent(event);
109 m_parent->markerPressed(this);
109 m_parent->markerPressed(this);
110 m_parent->setMousePressed();
110 m_parent->setMousePressed();
111 }
111 }
112 void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
112 void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
113 {
113 {
114 QGraphicsEllipseItem::hoverEnterEvent(event);
114 QGraphicsEllipseItem::hoverEnterEvent(event);
115 m_parent->markerHovered(this, true);
115 m_parent->markerHovered(this, true);
116 }
116 }
117 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
117 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
118 {
118 {
119 QGraphicsEllipseItem::hoverLeaveEvent(event);
119 QGraphicsEllipseItem::hoverLeaveEvent(event);
120 m_parent->markerHovered(this, false);
120 m_parent->markerHovered(this, false);
121 }
121 }
122 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
122 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
123 {
123 {
124 QGraphicsEllipseItem::mouseReleaseEvent(event);
124 QGraphicsEllipseItem::mouseReleaseEvent(event);
125 m_parent->markerReleased(this);
125 m_parent->markerReleased(this);
126 if (m_parent->mousePressed())
126 if (m_parent->mousePressed())
127 m_parent->markerSelected(this);
127 m_parent->markerSelected(this);
128 m_parent->setMousePressed(false);
128 m_parent->setMousePressed(false);
129 }
129 }
130 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
130 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
131 {
131 {
132 QGraphicsEllipseItem::mouseDoubleClickEvent(event);
132 QGraphicsEllipseItem::mouseDoubleClickEvent(event);
133 m_parent->markerDoubleClicked(this);
133 m_parent->markerDoubleClicked(this);
134 }
134 }
135
135
136 private:
136 private:
137 ScatterChartItem *m_parent;
137 ScatterChartItem *m_parent;
138 };
138 };
139
139
140 class RectangleMarker: public QGraphicsRectItem
140 class RectangleMarker: public QGraphicsRectItem
141 {
141 {
142
142
143 public:
143 public:
144 RectangleMarker(qreal x, qreal y, qreal w, qreal h, ScatterChartItem *parent)
144 RectangleMarker(qreal x, qreal y, qreal w, qreal h, ScatterChartItem *parent)
145 : QGraphicsRectItem(x, y, w, h, parent),
145 : QGraphicsRectItem(x, y, w, h, parent),
146 m_parent(parent)
146 m_parent(parent)
147 {
147 {
148 setAcceptHoverEvents(true);
148 setAcceptHoverEvents(true);
149 setFlag(QGraphicsItem::ItemIsSelectable);
149 setFlag(QGraphicsItem::ItemIsSelectable);
150 }
150 }
151
151
152 protected:
152 protected:
153 void mousePressEvent(QGraphicsSceneMouseEvent *event)
153 void mousePressEvent(QGraphicsSceneMouseEvent *event)
154 {
154 {
155 QGraphicsRectItem::mousePressEvent(event);
155 QGraphicsRectItem::mousePressEvent(event);
156 m_parent->markerPressed(this);
156 m_parent->markerPressed(this);
157 m_parent->setMousePressed();
157 m_parent->setMousePressed();
158 }
158 }
159 void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
159 void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
160 {
160 {
161 QGraphicsRectItem::hoverEnterEvent(event);
161 QGraphicsRectItem::hoverEnterEvent(event);
162 m_parent->markerHovered(this, true);
162 m_parent->markerHovered(this, true);
163 }
163 }
164 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
164 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
165 {
165 {
166 QGraphicsRectItem::hoverLeaveEvent(event);
166 QGraphicsRectItem::hoverLeaveEvent(event);
167 m_parent->markerHovered(this, false);
167 m_parent->markerHovered(this, false);
168 }
168 }
169 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
169 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
170 {
170 {
171 QGraphicsRectItem::mouseReleaseEvent(event);
171 QGraphicsRectItem::mouseReleaseEvent(event);
172 m_parent->markerReleased(this);
172 m_parent->markerReleased(this);
173 if (m_parent->mousePressed())
173 if (m_parent->mousePressed())
174 m_parent->markerSelected(this);
174 m_parent->markerSelected(this);
175 m_parent->setMousePressed(false);
175 m_parent->setMousePressed(false);
176 }
176 }
177 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
177 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
178 {
178 {
179 QGraphicsRectItem::mouseDoubleClickEvent(event);
179 QGraphicsRectItem::mouseDoubleClickEvent(event);
180 m_parent->markerDoubleClicked(this);
180 m_parent->markerDoubleClicked(this);
181 }
181 }
182
182
183 private:
183 private:
184 ScatterChartItem *m_parent;
184 ScatterChartItem *m_parent;
185 };
185 };
186
186
187 QT_CHARTS_END_NAMESPACE
187 QT_CHARTS_END_NAMESPACE
188
188
189 #endif // SCATTERPRESENTER_H
189 #endif // SCATTERPRESENTER_H
@@ -1,110 +1,110
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef SCROLLER_P_H
28 #ifndef SCROLLER_P_H
29 #define SCROLLER_P_H
29 #define SCROLLER_P_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <QtCore/QObject>
32 #include <QtCore/QObject>
33 #include <QtCore/QBasicTimer>
33 #include <QtCore/QBasicTimer>
34 #include <QtCore/QTime>
34 #include <QtCore/QTime>
35 #include <QtCore/QPointF>
35 #include <QtCore/QPointF>
36
36
37 QT_BEGIN_NAMESPACE
37 QT_BEGIN_NAMESPACE
38 class QGraphicsSceneMouseEvent;
38 class QGraphicsSceneMouseEvent;
39 QT_END_NAMESPACE
39 QT_END_NAMESPACE
40
40
41 QT_CHARTS_BEGIN_NAMESPACE
41 QT_CHARTS_BEGIN_NAMESPACE
42
42
43 class Scroller;
43 class Scroller;
44 class QLegend;
44 class QLegend;
45
45
46 class ScrollTicker : public QObject
46 class ScrollTicker : public QObject
47 {
47 {
48 Q_OBJECT
48 Q_OBJECT
49 public:
49 public:
50 explicit ScrollTicker(Scroller *scroller, QObject *parent = 0);
50 explicit ScrollTicker(Scroller *scroller, QObject *parent = 0);
51 void start(int interval);
51 void start(int interval);
52 void stop();
52 void stop();
53 protected:
53 protected:
54 void timerEvent(QTimerEvent *event);
54 void timerEvent(QTimerEvent *event);
55
55
56 private:
56 private:
57 QBasicTimer m_timer;
57 QBasicTimer m_timer;
58 Scroller *m_scroller;
58 Scroller *m_scroller;
59 };
59 };
60
60
61 class Scroller
61 class Scroller
62 {
62 {
63 public:
63 public:
64 enum State {
64 enum State {
65 Idle,
65 Idle,
66 Pressed,
66 Pressed,
67 Move,
67 Move,
68 Scroll
68 Scroll
69 };
69 };
70
70
71 Scroller();
71 Scroller();
72 virtual ~Scroller();
72 virtual ~Scroller();
73
73
74 virtual void setOffset(const QPointF &point) = 0;
74 virtual void setOffset(const QPointF &point) = 0;
75 virtual QPointF offset() const = 0;
75 virtual QPointF offset() const = 0;
76
76
77 void move(const QPointF &delta);
77 void move(const QPointF &delta);
78 void scrollTo(const QPointF &delta);
78 void scrollTo(const QPointF &delta);
79
79
80 void handleMousePressEvent(QGraphicsSceneMouseEvent *event);
80 void handleMousePressEvent(QGraphicsSceneMouseEvent *event);
81 void handleMouseMoveEvent(QGraphicsSceneMouseEvent *event);
81 void handleMouseMoveEvent(QGraphicsSceneMouseEvent *event);
82 void handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event);
82 void handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event);
83
83
84 void scrollTick();
84 void scrollTick();
85
85
86 private:
86 private:
87 void startTicker(int interval);
87 void startTicker(int interval);
88 void stopTicker();
88 void stopTicker();
89
89
90 private:
90 private:
91 void calculateSpeed(const QPointF &position);
91 void calculateSpeed(const QPointF &position);
92 void lowerSpeed(QPointF &speed, qreal maxSpeed = 100);
92 void lowerSpeed(QPointF &speed, qreal maxSpeed = 100);
93
93
94 private:
94 private:
95 ScrollTicker m_ticker;
95 ScrollTicker m_ticker;
96 QTime m_timeStamp;
96 QTime m_timeStamp;
97 QPointF m_speed;
97 QPointF m_speed;
98 QPointF m_fraction;
98 QPointF m_fraction;
99 int m_timeTresholdMin;
99 int m_timeTresholdMin;
100 int m_timeTresholdMax;
100 int m_timeTresholdMax;
101
101
102 State m_state;
102 State m_state;
103 QPointF m_pressPos;
103 QPointF m_pressPos;
104 QPointF m_lastPos;
104 QPointF m_lastPos;
105 qreal m_treshold;
105 qreal m_treshold;
106 };
106 };
107
107
108 QT_CHARTS_END_NAMESPACE
108 QT_CHARTS_END_NAMESPACE
109
109
110 #endif /* SCROLLER_P_H */
110 #endif /* SCROLLER_P_H */
@@ -1,53 +1,53
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QSPLINESERIES_P_H
28 #ifndef QSPLINESERIES_P_H
29 #define QSPLINESERIES_P_H
29 #define QSPLINESERIES_P_H
30
30
31 #include <private/qlineseries_p.h>
31 #include <private/qlineseries_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35
35
36 class QSplineSeriesPrivate: public QLineSeriesPrivate
36 class QSplineSeriesPrivate: public QLineSeriesPrivate
37 {
37 {
38 Q_OBJECT
38 Q_OBJECT
39 public:
39 public:
40 QSplineSeriesPrivate(QSplineSeries *q);
40 QSplineSeriesPrivate(QSplineSeries *q);
41
41
42 void initializeTheme(int index, ChartTheme* theme, bool forced = false);
42 void initializeTheme(int index, ChartTheme* theme, bool forced = false);
43 void initializeGraphics(QGraphicsItem* parent);
43 void initializeGraphics(QGraphicsItem* parent);
44 void initializeAnimations(QtCharts::QChart::AnimationOptions options, int duration,
44 void initializeAnimations(QtCharts::QChart::AnimationOptions options, int duration,
45 QEasingCurve &curve);
45 QEasingCurve &curve);
46
46
47 private:
47 private:
48 Q_DECLARE_PUBLIC(QSplineSeries)
48 Q_DECLARE_PUBLIC(QSplineSeries)
49 };
49 };
50
50
51 QT_CHARTS_END_NAMESPACE
51 QT_CHARTS_END_NAMESPACE
52
52
53 #endif
53 #endif
@@ -1,97 +1,97
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef SPLINECHARTITEM_P_H
28 #ifndef SPLINECHARTITEM_P_H
29 #define SPLINECHARTITEM_P_H
29 #define SPLINECHARTITEM_P_H
30
30
31 #include <QtCharts/QSplineSeries>
31 #include <QtCharts/QSplineSeries>
32 #include <private/xychart_p.h>
32 #include <private/xychart_p.h>
33
33
34 QT_CHARTS_BEGIN_NAMESPACE
34 QT_CHARTS_BEGIN_NAMESPACE
35
35
36 class SplineAnimation;
36 class SplineAnimation;
37
37
38 class SplineChartItem : public XYChart
38 class SplineChartItem : public XYChart
39 {
39 {
40 Q_OBJECT
40 Q_OBJECT
41 Q_INTERFACES(QGraphicsItem)
41 Q_INTERFACES(QGraphicsItem)
42 public:
42 public:
43 SplineChartItem(QSplineSeries *series, QGraphicsItem *item = 0);
43 SplineChartItem(QSplineSeries *series, QGraphicsItem *item = 0);
44
44
45 //from QGraphicsItem
45 //from QGraphicsItem
46 QRectF boundingRect() const;
46 QRectF boundingRect() const;
47 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
47 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
48 QPainterPath shape() const;
48 QPainterPath shape() const;
49
49
50 void setControlGeometryPoints(QVector<QPointF>& points);
50 void setControlGeometryPoints(QVector<QPointF>& points);
51 QVector<QPointF> controlGeometryPoints() const;
51 QVector<QPointF> controlGeometryPoints() const;
52
52
53 void setAnimation(SplineAnimation *animation);
53 void setAnimation(SplineAnimation *animation);
54 ChartAnimation *animation() const;
54 ChartAnimation *animation() const;
55
55
56 public Q_SLOTS:
56 public Q_SLOTS:
57 void handleUpdated();
57 void handleUpdated();
58
58
59 protected:
59 protected:
60 void updateGeometry();
60 void updateGeometry();
61 QVector<QPointF> calculateControlPoints(const QVector<QPointF> &points);
61 QVector<QPointF> calculateControlPoints(const QVector<QPointF> &points);
62 QVector<qreal> firstControlPoints(const QVector<qreal>& vector);
62 QVector<qreal> firstControlPoints(const QVector<qreal>& vector);
63 void updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, int index);
63 void updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, int index);
64 void mousePressEvent(QGraphicsSceneMouseEvent *event);
64 void mousePressEvent(QGraphicsSceneMouseEvent *event);
65 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
65 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
66 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
66 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
67 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
67 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
68 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
68 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
69
69
70 private:
70 private:
71 QSplineSeries *m_series;
71 QSplineSeries *m_series;
72 QPainterPath m_path;
72 QPainterPath m_path;
73 QPainterPath m_pathPolarRight;
73 QPainterPath m_pathPolarRight;
74 QPainterPath m_pathPolarLeft;
74 QPainterPath m_pathPolarLeft;
75 QPainterPath m_fullPath;
75 QPainterPath m_fullPath;
76 QRectF m_rect;
76 QRectF m_rect;
77 QPen m_linePen;
77 QPen m_linePen;
78 QPen m_pointPen;
78 QPen m_pointPen;
79 bool m_pointsVisible;
79 bool m_pointsVisible;
80 QVector<QPointF> m_controlPoints;
80 QVector<QPointF> m_controlPoints;
81 QVector<QPointF> m_visiblePoints;
81 QVector<QPointF> m_visiblePoints;
82 SplineAnimation *m_animation;
82 SplineAnimation *m_animation;
83
83
84 bool m_pointLabelsVisible;
84 bool m_pointLabelsVisible;
85 QString m_pointLabelsFormat;
85 QString m_pointLabelsFormat;
86 QFont m_pointLabelsFont;
86 QFont m_pointLabelsFont;
87 QColor m_pointLabelsColor;
87 QColor m_pointLabelsColor;
88
88
89 QPointF m_lastMousePos;
89 QPointF m_lastMousePos;
90 bool m_mousePressed;
90 bool m_mousePressed;
91
91
92 friend class SplineAnimation;
92 friend class SplineAnimation;
93 };
93 };
94
94
95 QT_CHARTS_END_NAMESPACE
95 QT_CHARTS_END_NAMESPACE
96
96
97 #endif // SPLINECHARTITEM_P_H
97 #endif // SPLINECHARTITEM_P_H
@@ -1,93 +1,93
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTTHEME_H
28 #ifndef CHARTTHEME_H
29 #define CHARTTHEME_H
29 #define CHARTTHEME_H
30
30
31 #include <private/chartthememanager_p.h>
31 #include <private/chartthememanager_p.h>
32 #include <QtGui/QColor>
32 #include <QtGui/QColor>
33 #include <QtGui/QGradientStops>
33 #include <QtGui/QGradientStops>
34
34
35 QT_CHARTS_BEGIN_NAMESPACE
35 QT_CHARTS_BEGIN_NAMESPACE
36
36
37 class ChartTheme
37 class ChartTheme
38 {
38 {
39
39
40 public:
40 public:
41 enum BackgroundShadesMode {
41 enum BackgroundShadesMode {
42 BackgroundShadesNone = 0,
42 BackgroundShadesNone = 0,
43 BackgroundShadesVertical,
43 BackgroundShadesVertical,
44 BackgroundShadesHorizontal,
44 BackgroundShadesHorizontal,
45 BackgroundShadesBoth
45 BackgroundShadesBoth
46 };
46 };
47
47
48 protected:
48 protected:
49 explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeLight):m_id(id),
49 explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeLight):m_id(id),
50 m_backgroundShadesBrush(Qt::SolidPattern),
50 m_backgroundShadesBrush(Qt::SolidPattern),
51 m_backgroundShades(BackgroundShadesNone),
51 m_backgroundShades(BackgroundShadesNone),
52 m_backgroundDropShadowEnabled(false)
52 m_backgroundDropShadowEnabled(false)
53 {};
53 {};
54 public:
54 public:
55 QChart::ChartTheme id() const { return m_id; }
55 QChart::ChartTheme id() const { return m_id; }
56 QList<QGradient> seriesGradients() const { return m_seriesGradients; }
56 QList<QGradient> seriesGradients() const { return m_seriesGradients; }
57 QList<QColor> seriesColors() const { return m_seriesColors; }
57 QList<QColor> seriesColors() const { return m_seriesColors; }
58 QLinearGradient chartBackgroundGradient() const { return m_chartBackgroundGradient; }
58 QLinearGradient chartBackgroundGradient() const { return m_chartBackgroundGradient; }
59 QFont masterFont() const { return m_masterFont; }
59 QFont masterFont() const { return m_masterFont; }
60 QFont labelFont() const { return m_labelFont; }
60 QFont labelFont() const { return m_labelFont; }
61 QBrush labelBrush() const { return m_labelBrush; }
61 QBrush labelBrush() const { return m_labelBrush; }
62 QPen axisLinePen() const { return m_axisLinePen; }
62 QPen axisLinePen() const { return m_axisLinePen; }
63 QPen backgroundShadesPen() const { return m_backgroundShadesPen; }
63 QPen backgroundShadesPen() const { return m_backgroundShadesPen; }
64 QPen outlinePen() const { return m_outlinePen; }
64 QPen outlinePen() const { return m_outlinePen; }
65 QBrush backgroundShadesBrush() const { return m_backgroundShadesBrush; }
65 QBrush backgroundShadesBrush() const { return m_backgroundShadesBrush; }
66 BackgroundShadesMode backgroundShades() const { return m_backgroundShades; }
66 BackgroundShadesMode backgroundShades() const { return m_backgroundShades; }
67 bool isBackgroundDropShadowEnabled() const { return m_backgroundDropShadowEnabled; }
67 bool isBackgroundDropShadowEnabled() const { return m_backgroundDropShadowEnabled; }
68 QPen gridLinePen() const { return m_gridLinePen; }
68 QPen gridLinePen() const { return m_gridLinePen; }
69 QPen minorGridLinePen() const { return m_minorGridLinePen; }
69 QPen minorGridLinePen() const { return m_minorGridLinePen; }
70
70
71 protected:
71 protected:
72 QChart::ChartTheme m_id;
72 QChart::ChartTheme m_id;
73 QList<QColor> m_seriesColors;
73 QList<QColor> m_seriesColors;
74 QList<QGradient> m_seriesGradients;
74 QList<QGradient> m_seriesGradients;
75 QLinearGradient m_chartBackgroundGradient;
75 QLinearGradient m_chartBackgroundGradient;
76
76
77 QFont m_masterFont;
77 QFont m_masterFont;
78 QFont m_labelFont;
78 QFont m_labelFont;
79 QBrush m_labelBrush;
79 QBrush m_labelBrush;
80 QPen m_axisLinePen;
80 QPen m_axisLinePen;
81 QPen m_backgroundShadesPen;
81 QPen m_backgroundShadesPen;
82 QPen m_outlinePen;
82 QPen m_outlinePen;
83 QBrush m_backgroundShadesBrush;
83 QBrush m_backgroundShadesBrush;
84 BackgroundShadesMode m_backgroundShades;
84 BackgroundShadesMode m_backgroundShades;
85 bool m_backgroundDropShadowEnabled;
85 bool m_backgroundDropShadowEnabled;
86 QPen m_gridLinePen;
86 QPen m_gridLinePen;
87 QPen m_minorGridLinePen;
87 QPen m_minorGridLinePen;
88
88
89 };
89 };
90
90
91 QT_CHARTS_END_NAMESPACE
91 QT_CHARTS_END_NAMESPACE
92
92
93 #endif // CHARTTHEME_H
93 #endif // CHARTTHEME_H
@@ -1,71 +1,71
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTTHEMEBLUECERULEAN_P_H
28 #ifndef CHARTTHEMEBLUECERULEAN_P_H
29 #define CHARTTHEMEBLUECERULEAN_P_H
29 #define CHARTTHEMEBLUECERULEAN_P_H
30
30
31 #include <private/charttheme_p.h>
31 #include <private/charttheme_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class ChartThemeBlueCerulean: public ChartTheme
35 class ChartThemeBlueCerulean: public ChartTheme
36 {
36 {
37 public:
37 public:
38 ChartThemeBlueCerulean() : ChartTheme(QChart::ChartThemeBlueCerulean) {
38 ChartThemeBlueCerulean() : ChartTheme(QChart::ChartThemeBlueCerulean) {
39 // Series colors
39 // Series colors
40 m_seriesColors << QRgb(0xc7e85b);
40 m_seriesColors << QRgb(0xc7e85b);
41 m_seriesColors << QRgb(0x1cb54f);
41 m_seriesColors << QRgb(0x1cb54f);
42 m_seriesColors << QRgb(0x5cbf9b);
42 m_seriesColors << QRgb(0x5cbf9b);
43 m_seriesColors << QRgb(0x009fbf);
43 m_seriesColors << QRgb(0x009fbf);
44 m_seriesColors << QRgb(0xee7392);
44 m_seriesColors << QRgb(0xee7392);
45 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
45 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
46
46
47 // Background
47 // Background
48 QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
48 QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
49 backgroundGradient.setColorAt(0.0, QRgb(0x056189));
49 backgroundGradient.setColorAt(0.0, QRgb(0x056189));
50 backgroundGradient.setColorAt(1.0, QRgb(0x101a31));
50 backgroundGradient.setColorAt(1.0, QRgb(0x101a31));
51 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
51 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
52 m_chartBackgroundGradient = backgroundGradient;
52 m_chartBackgroundGradient = backgroundGradient;
53
53
54 // Axes and other
54 // Axes and other
55 m_labelBrush = QBrush(QRgb(0xffffff));
55 m_labelBrush = QBrush(QRgb(0xffffff));
56 m_axisLinePen = QPen(QRgb(0xd6d6d6));
56 m_axisLinePen = QPen(QRgb(0xd6d6d6));
57 m_axisLinePen.setWidth(2);
57 m_axisLinePen.setWidth(2);
58 m_gridLinePen = QPen(QRgb(0x84a2b0));
58 m_gridLinePen = QPen(QRgb(0x84a2b0));
59 m_gridLinePen.setWidth(1);
59 m_gridLinePen.setWidth(1);
60 m_minorGridLinePen = QPen(QRgb(0x84a2b0));
60 m_minorGridLinePen = QPen(QRgb(0x84a2b0));
61 m_minorGridLinePen.setWidth(1);
61 m_minorGridLinePen.setWidth(1);
62 m_minorGridLinePen.setStyle(Qt::DashLine);
62 m_minorGridLinePen.setStyle(Qt::DashLine);
63 m_backgroundShades = BackgroundShadesNone;
63 m_backgroundShades = BackgroundShadesNone;
64 m_outlinePen = QPen(QRgb(0xebebeb));
64 m_outlinePen = QPen(QRgb(0xebebeb));
65 m_outlinePen.setWidthF(2.0);
65 m_outlinePen.setWidthF(2.0);
66 }
66 }
67 };
67 };
68
68
69 QT_CHARTS_END_NAMESPACE
69 QT_CHARTS_END_NAMESPACE
70
70
71 #endif
71 #endif
@@ -1,73 +1,73
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTTHEMEBLUEICY_P_H
28 #ifndef CHARTTHEMEBLUEICY_P_H
29 #define CHARTTHEMEBLUEICY_P_H
29 #define CHARTTHEMEBLUEICY_P_H
30
30
31 #include <private/charttheme_p.h>
31 #include <private/charttheme_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class ChartThemeBlueIcy: public ChartTheme
35 class ChartThemeBlueIcy: public ChartTheme
36 {
36 {
37 public:
37 public:
38 ChartThemeBlueIcy() : ChartTheme(QChart::ChartThemeBlueIcy)
38 ChartThemeBlueIcy() : ChartTheme(QChart::ChartThemeBlueIcy)
39 {
39 {
40 // Series colors
40 // Series colors
41 m_seriesColors << QRgb(0x3daeda);
41 m_seriesColors << QRgb(0x3daeda);
42 m_seriesColors << QRgb(0x2685bf);
42 m_seriesColors << QRgb(0x2685bf);
43 m_seriesColors << QRgb(0x0c2673);
43 m_seriesColors << QRgb(0x0c2673);
44 m_seriesColors << QRgb(0x5f3dba);
44 m_seriesColors << QRgb(0x5f3dba);
45 m_seriesColors << QRgb(0x2fa3b4);
45 m_seriesColors << QRgb(0x2fa3b4);
46 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
46 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
47
47
48 // Background
48 // Background
49 QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
49 QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
50 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
50 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
51 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
51 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
52 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
52 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
53 m_chartBackgroundGradient = backgroundGradient;
53 m_chartBackgroundGradient = backgroundGradient;
54 m_backgroundDropShadowEnabled = true;
54 m_backgroundDropShadowEnabled = true;
55
55
56 // Axes and other
56 // Axes and other
57 m_labelBrush = QBrush(QRgb(0x404044));
57 m_labelBrush = QBrush(QRgb(0x404044));
58 m_axisLinePen = QPen(QRgb(0xd6d6d6));
58 m_axisLinePen = QPen(QRgb(0xd6d6d6));
59 m_axisLinePen.setWidth(2);
59 m_axisLinePen.setWidth(2);
60 m_gridLinePen = QPen(QRgb(0xe2e2e2));
60 m_gridLinePen = QPen(QRgb(0xe2e2e2));
61 m_gridLinePen.setWidth(1);
61 m_gridLinePen.setWidth(1);
62 m_minorGridLinePen = QPen(QRgb(0xe2e2e2));
62 m_minorGridLinePen = QPen(QRgb(0xe2e2e2));
63 m_minorGridLinePen.setWidth(1);
63 m_minorGridLinePen.setWidth(1);
64 m_minorGridLinePen.setStyle(Qt::DashLine);
64 m_minorGridLinePen.setStyle(Qt::DashLine);
65 m_backgroundShades = BackgroundShadesNone;
65 m_backgroundShades = BackgroundShadesNone;
66 m_outlinePen = QPen(QRgb(0x474747));
66 m_outlinePen = QPen(QRgb(0x474747));
67 m_outlinePen.setWidthF(2.0);
67 m_outlinePen.setWidthF(2.0);
68 }
68 }
69 };
69 };
70
70
71 QT_CHARTS_END_NAMESPACE
71 QT_CHARTS_END_NAMESPACE
72
72
73 #endif
73 #endif
@@ -1,72 +1,72
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTTHEMEBLUENCS_P_H
28 #ifndef CHARTTHEMEBLUENCS_P_H
29 #define CHARTTHEMEBLUENCS_P_H
29 #define CHARTTHEMEBLUENCS_P_H
30
30
31 #include <private/charttheme_p.h>
31 #include <private/charttheme_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class ChartThemeBlueNcs: public ChartTheme
35 class ChartThemeBlueNcs: public ChartTheme
36 {
36 {
37 public:
37 public:
38 ChartThemeBlueNcs() : ChartTheme(QChart::ChartThemeBlueNcs)
38 ChartThemeBlueNcs() : ChartTheme(QChart::ChartThemeBlueNcs)
39 {
39 {
40 // Series colors
40 // Series colors
41 m_seriesColors << QRgb(0x1db0da);
41 m_seriesColors << QRgb(0x1db0da);
42 m_seriesColors << QRgb(0x1341a6);
42 m_seriesColors << QRgb(0x1341a6);
43 m_seriesColors << QRgb(0x88d41e);
43 m_seriesColors << QRgb(0x88d41e);
44 m_seriesColors << QRgb(0xff8e1a);
44 m_seriesColors << QRgb(0xff8e1a);
45 m_seriesColors << QRgb(0x398ca3);
45 m_seriesColors << QRgb(0x398ca3);
46 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
46 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
47
47
48 // Background
48 // Background
49 QLinearGradient backgroundGradient;
49 QLinearGradient backgroundGradient;
50 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
50 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
51 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
51 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
52 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
52 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
53 m_chartBackgroundGradient = backgroundGradient;
53 m_chartBackgroundGradient = backgroundGradient;
54
54
55 // Axes and other
55 // Axes and other
56 m_labelBrush = QBrush(QRgb(0x404044));
56 m_labelBrush = QBrush(QRgb(0x404044));
57 m_axisLinePen = QPen(QRgb(0xd6d6d6));
57 m_axisLinePen = QPen(QRgb(0xd6d6d6));
58 m_axisLinePen.setWidth(2);
58 m_axisLinePen.setWidth(2);
59 m_gridLinePen = QPen(QRgb(0xe2e2e2));
59 m_gridLinePen = QPen(QRgb(0xe2e2e2));
60 m_gridLinePen.setWidth(1);
60 m_gridLinePen.setWidth(1);
61 m_minorGridLinePen = QPen(QRgb(0xe2e2e2));
61 m_minorGridLinePen = QPen(QRgb(0xe2e2e2));
62 m_minorGridLinePen.setWidth(1);
62 m_minorGridLinePen.setWidth(1);
63 m_minorGridLinePen.setStyle(Qt::DashLine);
63 m_minorGridLinePen.setStyle(Qt::DashLine);
64 m_backgroundShades = BackgroundShadesNone;
64 m_backgroundShades = BackgroundShadesNone;
65 m_outlinePen = QPen(QRgb(0x474747));
65 m_outlinePen = QPen(QRgb(0x474747));
66 m_outlinePen.setWidthF(2.0);
66 m_outlinePen.setWidthF(2.0);
67 }
67 }
68 };
68 };
69
69
70 QT_CHARTS_END_NAMESPACE
70 QT_CHARTS_END_NAMESPACE
71
71
72 #endif
72 #endif
@@ -1,72 +1,72
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTTHEMEBROWNSAND_P_H
28 #ifndef CHARTTHEMEBROWNSAND_P_H
29 #define CHARTTHEMEBROWNSAND_P_H
29 #define CHARTTHEMEBROWNSAND_P_H
30
30
31 #include <private/charttheme_p.h>
31 #include <private/charttheme_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class ChartThemeBrownSand: public ChartTheme
35 class ChartThemeBrownSand: public ChartTheme
36 {
36 {
37 public:
37 public:
38 ChartThemeBrownSand() : ChartTheme(QChart::ChartThemeBrownSand)
38 ChartThemeBrownSand() : ChartTheme(QChart::ChartThemeBrownSand)
39 {
39 {
40 // Series colors
40 // Series colors
41 m_seriesColors << QRgb(0xb39b72);
41 m_seriesColors << QRgb(0xb39b72);
42 m_seriesColors << QRgb(0xb3b376);
42 m_seriesColors << QRgb(0xb3b376);
43 m_seriesColors << QRgb(0xc35660);
43 m_seriesColors << QRgb(0xc35660);
44 m_seriesColors << QRgb(0x536780);
44 m_seriesColors << QRgb(0x536780);
45 m_seriesColors << QRgb(0x494345);
45 m_seriesColors << QRgb(0x494345);
46 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
46 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
47
47
48 // Background
48 // Background
49 QLinearGradient backgroundGradient;
49 QLinearGradient backgroundGradient;
50 backgroundGradient.setColorAt(0.0, QRgb(0xf3ece0));
50 backgroundGradient.setColorAt(0.0, QRgb(0xf3ece0));
51 backgroundGradient.setColorAt(1.0, QRgb(0xf3ece0));
51 backgroundGradient.setColorAt(1.0, QRgb(0xf3ece0));
52 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
52 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
53 m_chartBackgroundGradient = backgroundGradient;
53 m_chartBackgroundGradient = backgroundGradient;
54
54
55 // Axes and other
55 // Axes and other
56 m_labelBrush = QBrush(QRgb(0x404044));
56 m_labelBrush = QBrush(QRgb(0x404044));
57 m_axisLinePen = QPen(QRgb(0xb5b0a7));
57 m_axisLinePen = QPen(QRgb(0xb5b0a7));
58 m_axisLinePen.setWidth(2);
58 m_axisLinePen.setWidth(2);
59 m_gridLinePen = QPen(QRgb(0xd4cec3));
59 m_gridLinePen = QPen(QRgb(0xd4cec3));
60 m_gridLinePen.setWidth(1);
60 m_gridLinePen.setWidth(1);
61 m_minorGridLinePen = QPen(QRgb(0xd4cec3));
61 m_minorGridLinePen = QPen(QRgb(0xd4cec3));
62 m_minorGridLinePen.setWidth(1);
62 m_minorGridLinePen.setWidth(1);
63 m_minorGridLinePen.setStyle(Qt::DashLine);
63 m_minorGridLinePen.setStyle(Qt::DashLine);
64 m_backgroundShades = BackgroundShadesNone;
64 m_backgroundShades = BackgroundShadesNone;
65 m_outlinePen = QPen(QRgb(0x222222));
65 m_outlinePen = QPen(QRgb(0x222222));
66 m_outlinePen.setWidthF(2.0);
66 m_outlinePen.setWidthF(2.0);
67 }
67 }
68 };
68 };
69
69
70 QT_CHARTS_END_NAMESPACE
70 QT_CHARTS_END_NAMESPACE
71
71
72 #endif
72 #endif
@@ -1,72 +1,72
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTTHEMEDARK_P_H
28 #ifndef CHARTTHEMEDARK_P_H
29 #define CHARTTHEMEDARK_P_H
29 #define CHARTTHEMEDARK_P_H
30
30
31 #include <private/charttheme_p.h>
31 #include <private/charttheme_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class ChartThemeDark : public ChartTheme
35 class ChartThemeDark : public ChartTheme
36 {
36 {
37 public:
37 public:
38 ChartThemeDark() : ChartTheme(QChart::ChartThemeDark)
38 ChartThemeDark() : ChartTheme(QChart::ChartThemeDark)
39 {
39 {
40 // Series colors
40 // Series colors
41 m_seriesColors << QRgb(0x38ad6b);
41 m_seriesColors << QRgb(0x38ad6b);
42 m_seriesColors << QRgb(0x3c84a7);
42 m_seriesColors << QRgb(0x3c84a7);
43 m_seriesColors << QRgb(0xeb8817);
43 m_seriesColors << QRgb(0xeb8817);
44 m_seriesColors << QRgb(0x7b7f8c);
44 m_seriesColors << QRgb(0x7b7f8c);
45 m_seriesColors << QRgb(0xbf593e);
45 m_seriesColors << QRgb(0xbf593e);
46 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
46 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
47
47
48 // Background
48 // Background
49 QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
49 QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
50 backgroundGradient.setColorAt(0.0, QRgb(0x2e303a));
50 backgroundGradient.setColorAt(0.0, QRgb(0x2e303a));
51 backgroundGradient.setColorAt(1.0, QRgb(0x121218));
51 backgroundGradient.setColorAt(1.0, QRgb(0x121218));
52 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
52 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
53 m_chartBackgroundGradient = backgroundGradient;
53 m_chartBackgroundGradient = backgroundGradient;
54
54
55 // Axes and other
55 // Axes and other
56 m_labelBrush = QBrush(QRgb(0xffffff));
56 m_labelBrush = QBrush(QRgb(0xffffff));
57 m_axisLinePen = QPen(QRgb(0x86878c));
57 m_axisLinePen = QPen(QRgb(0x86878c));
58 m_axisLinePen.setWidth(2);
58 m_axisLinePen.setWidth(2);
59 m_gridLinePen = QPen(QRgb(0x86878c));
59 m_gridLinePen = QPen(QRgb(0x86878c));
60 m_gridLinePen.setWidth(1);
60 m_gridLinePen.setWidth(1);
61 m_minorGridLinePen = QPen(QRgb(0x86878c));
61 m_minorGridLinePen = QPen(QRgb(0x86878c));
62 m_minorGridLinePen.setWidth(1);
62 m_minorGridLinePen.setWidth(1);
63 m_minorGridLinePen.setStyle(Qt::DashLine);
63 m_minorGridLinePen.setStyle(Qt::DashLine);
64 m_backgroundShades = BackgroundShadesNone;
64 m_backgroundShades = BackgroundShadesNone;
65 m_outlinePen = QPen(QRgb(0xd6d6d6));
65 m_outlinePen = QPen(QRgb(0xd6d6d6));
66 m_outlinePen.setWidthF(2.0);
66 m_outlinePen.setWidthF(2.0);
67 }
67 }
68 };
68 };
69
69
70 QT_CHARTS_END_NAMESPACE
70 QT_CHARTS_END_NAMESPACE
71
71
72 #endif
72 #endif
@@ -1,74 +1,74
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTTHEMEHIGHCONTRAST_P_H
28 #ifndef CHARTTHEMEHIGHCONTRAST_P_H
29 #define CHARTTHEMEHIGHCONTRAST_P_H
29 #define CHARTTHEMEHIGHCONTRAST_P_H
30
30
31 #include <private/charttheme_p.h>
31 #include <private/charttheme_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class ChartThemeHighContrast : public ChartTheme
35 class ChartThemeHighContrast : public ChartTheme
36 {
36 {
37 public:
37 public:
38 ChartThemeHighContrast() : ChartTheme(QChart::ChartThemeHighContrast)
38 ChartThemeHighContrast() : ChartTheme(QChart::ChartThemeHighContrast)
39 {
39 {
40 // Series colors
40 // Series colors
41 m_seriesColors << QRgb(0x202020);
41 m_seriesColors << QRgb(0x202020);
42 m_seriesColors << QRgb(0x596a74);
42 m_seriesColors << QRgb(0x596a74);
43 m_seriesColors << QRgb(0xffab03);
43 m_seriesColors << QRgb(0xffab03);
44 m_seriesColors << QRgb(0x038e9b);
44 m_seriesColors << QRgb(0x038e9b);
45 m_seriesColors << QRgb(0xff4a41);
45 m_seriesColors << QRgb(0xff4a41);
46 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
46 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
47
47
48 // Background
48 // Background
49 QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
49 QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
50 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
50 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
51 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
51 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
52 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
52 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
53 m_chartBackgroundGradient = backgroundGradient;
53 m_chartBackgroundGradient = backgroundGradient;
54 m_backgroundDropShadowEnabled = true;
54 m_backgroundDropShadowEnabled = true;
55
55
56 // Axes and other
56 // Axes and other
57 m_labelBrush = QBrush(QRgb(0x181818));
57 m_labelBrush = QBrush(QRgb(0x181818));
58 m_axisLinePen = QPen(QRgb(0x8c8c8c));
58 m_axisLinePen = QPen(QRgb(0x8c8c8c));
59 m_axisLinePen.setWidth(2);
59 m_axisLinePen.setWidth(2);
60 m_gridLinePen = QPen(QRgb(0x8c8c8c));
60 m_gridLinePen = QPen(QRgb(0x8c8c8c));
61 m_gridLinePen.setWidth(1);
61 m_gridLinePen.setWidth(1);
62 m_minorGridLinePen = QPen(QRgb(0x8c8c8c));
62 m_minorGridLinePen = QPen(QRgb(0x8c8c8c));
63 m_minorGridLinePen.setWidth(1);
63 m_minorGridLinePen.setWidth(1);
64 m_minorGridLinePen.setStyle(Qt::DashLine);
64 m_minorGridLinePen.setStyle(Qt::DashLine);
65 m_backgroundShadesBrush = QBrush(QRgb(0xffeecd));
65 m_backgroundShadesBrush = QBrush(QRgb(0xffeecd));
66 m_backgroundShades = BackgroundShadesHorizontal;
66 m_backgroundShades = BackgroundShadesHorizontal;
67 m_outlinePen = QPen(QColor(Qt::black));
67 m_outlinePen = QPen(QColor(Qt::black));
68 m_outlinePen.setWidthF(2.0);
68 m_outlinePen.setWidthF(2.0);
69 }
69 }
70 };
70 };
71
71
72 QT_CHARTS_END_NAMESPACE
72 QT_CHARTS_END_NAMESPACE
73
73
74 #endif
74 #endif
@@ -1,74 +1,74
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTTHEMELIGHT_P_H
28 #ifndef CHARTTHEMELIGHT_P_H
29 #define CHARTTHEMELIGHT_P_H
29 #define CHARTTHEMELIGHT_P_H
30
30
31 #include <private/charttheme_p.h>
31 #include <private/charttheme_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class ChartThemeLight: public ChartTheme
35 class ChartThemeLight: public ChartTheme
36 {
36 {
37 public:
37 public:
38 ChartThemeLight() : ChartTheme(QChart::ChartThemeLight)
38 ChartThemeLight() : ChartTheme(QChart::ChartThemeLight)
39 {
39 {
40 // Series colors
40 // Series colors
41 m_seriesColors << QRgb(0x209fdf);
41 m_seriesColors << QRgb(0x209fdf);
42 m_seriesColors << QRgb(0x99ca53);
42 m_seriesColors << QRgb(0x99ca53);
43 m_seriesColors << QRgb(0xf6a625);
43 m_seriesColors << QRgb(0xf6a625);
44 m_seriesColors << QRgb(0x6d5fd5);
44 m_seriesColors << QRgb(0x6d5fd5);
45 m_seriesColors << QRgb(0xbf593e);
45 m_seriesColors << QRgb(0xbf593e);
46 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
46 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
47
47
48 // Background
48 // Background
49 QLinearGradient backgroundGradient;
49 QLinearGradient backgroundGradient;
50 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
50 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
51 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
51 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
52 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
52 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
53 m_chartBackgroundGradient = backgroundGradient;
53 m_chartBackgroundGradient = backgroundGradient;
54 // There is a performance issue in the drop shadow implementation, so disabled for now
54 // There is a performance issue in the drop shadow implementation, so disabled for now
55 // m_backgroundDropShadowEnabled = true;
55 // m_backgroundDropShadowEnabled = true;
56
56
57 // Axes and other
57 // Axes and other
58 m_axisLinePen = QPen(0xd6d6d6);
58 m_axisLinePen = QPen(0xd6d6d6);
59 m_axisLinePen.setWidth(1);
59 m_axisLinePen.setWidth(1);
60 m_labelBrush = QBrush(QRgb(0x404044));
60 m_labelBrush = QBrush(QRgb(0x404044));
61 m_gridLinePen = QPen(QRgb(0xe2e2e2));
61 m_gridLinePen = QPen(QRgb(0xe2e2e2));
62 m_gridLinePen.setWidth(1);
62 m_gridLinePen.setWidth(1);
63 m_minorGridLinePen = QPen(QRgb(0xe2e2e2));
63 m_minorGridLinePen = QPen(QRgb(0xe2e2e2));
64 m_minorGridLinePen.setWidth(1);
64 m_minorGridLinePen.setWidth(1);
65 m_minorGridLinePen.setStyle(Qt::DashLine);
65 m_minorGridLinePen.setStyle(Qt::DashLine);
66 m_backgroundShades = BackgroundShadesNone;
66 m_backgroundShades = BackgroundShadesNone;
67 m_outlinePen = QPen(0x4d4d4d);
67 m_outlinePen = QPen(0x4d4d4d);
68 m_outlinePen.setWidthF(2.0);
68 m_outlinePen.setWidthF(2.0);
69 }
69 }
70 };
70 };
71
71
72 QT_CHARTS_END_NAMESPACE
72 QT_CHARTS_END_NAMESPACE
73
73
74 #endif
74 #endif
@@ -1,75 +1,75
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTTHEMEQT_P_H
28 #ifndef CHARTTHEMEQT_P_H
29 #define CHARTTHEMEQT_P_H
29 #define CHARTTHEMEQT_P_H
30
30
31 #include <private/charttheme_p.h>
31 #include <private/charttheme_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class ChartThemeQt : public ChartTheme
35 class ChartThemeQt : public ChartTheme
36 {
36 {
37 public:
37 public:
38 ChartThemeQt() : ChartTheme(QChart::ChartThemeQt)
38 ChartThemeQt() : ChartTheme(QChart::ChartThemeQt)
39 {
39 {
40 // Series colors
40 // Series colors
41 m_seriesColors << QRgb(0x80c342);
41 m_seriesColors << QRgb(0x80c342);
42 m_seriesColors << QRgb(0x328930);
42 m_seriesColors << QRgb(0x328930);
43 m_seriesColors << QRgb(0x006325);
43 m_seriesColors << QRgb(0x006325);
44 m_seriesColors << QRgb(0x35322f);
44 m_seriesColors << QRgb(0x35322f);
45 m_seriesColors << QRgb(0x5d5b59);
45 m_seriesColors << QRgb(0x5d5b59);
46 m_seriesColors << QRgb(0x868482);
46 m_seriesColors << QRgb(0x868482);
47 m_seriesColors << QRgb(0xaeadac);
47 m_seriesColors << QRgb(0xaeadac);
48 m_seriesColors << QRgb(0xd7d6d5);
48 m_seriesColors << QRgb(0xd7d6d5);
49 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
49 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
50
50
51 // Background
51 // Background
52 QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
52 QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
53 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
53 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
54 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
54 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
55 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
55 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
56 m_chartBackgroundGradient = backgroundGradient;
56 m_chartBackgroundGradient = backgroundGradient;
57
57
58 // Axes and other
58 // Axes and other
59 m_labelBrush = QBrush(QRgb(0x35322f));
59 m_labelBrush = QBrush(QRgb(0x35322f));
60 m_axisLinePen = QPen(QRgb(0xd7d6d5));
60 m_axisLinePen = QPen(QRgb(0xd7d6d5));
61 m_axisLinePen.setWidth(1);
61 m_axisLinePen.setWidth(1);
62 m_gridLinePen = QPen(QRgb(0xd7d6d5));
62 m_gridLinePen = QPen(QRgb(0xd7d6d5));
63 m_gridLinePen.setWidth(1);
63 m_gridLinePen.setWidth(1);
64 m_minorGridLinePen = QPen(QRgb(0xd7d6d5));
64 m_minorGridLinePen = QPen(QRgb(0xd7d6d5));
65 m_minorGridLinePen.setWidth(1);
65 m_minorGridLinePen.setWidth(1);
66 m_minorGridLinePen.setStyle(Qt::DashLine);
66 m_minorGridLinePen.setStyle(Qt::DashLine);
67 m_backgroundShades = BackgroundShadesNone;
67 m_backgroundShades = BackgroundShadesNone;
68 m_outlinePen = QPen(QRgb(0x35322f));
68 m_outlinePen = QPen(QRgb(0x35322f));
69 m_outlinePen.setWidthF(2.0);
69 m_outlinePen.setWidthF(2.0);
70 }
70 }
71 };
71 };
72
72
73 QT_CHARTS_END_NAMESPACE
73 QT_CHARTS_END_NAMESPACE
74
74
75 #endif
75 #endif
@@ -1,187 +1,187
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTTHEMESYSTEM_P_H
28 #ifndef CHARTTHEMESYSTEM_P_H
29 #define CHARTTHEMESYSTEM_P_H
29 #define CHARTTHEMESYSTEM_P_H
30
30
31 #include <private/charttheme_p.h>
31 #include <private/charttheme_p.h>
32 #ifdef Q_OS_WIN
32 #ifdef Q_OS_WIN
33 #include <windows.h>
33 #include <windows.h>
34 #include <stdio.h>
34 #include <stdio.h>
35 #endif
35 #endif
36
36
37 QT_CHARTS_BEGIN_NAMESPACE
37 QT_CHARTS_BEGIN_NAMESPACE
38
38
39 class ChartThemeSystem: public ChartTheme
39 class ChartThemeSystem: public ChartTheme
40 {
40 {
41 public:
41 public:
42 // System theme not used at the moment (the user is not able to select this theme)
42 // System theme not used at the moment (the user is not able to select this theme)
43 ChartThemeSystem() : ChartTheme(QChart::ChartThemeLight /*QChart::ChartThemeSystem*/)
43 ChartThemeSystem() : ChartTheme(QChart::ChartThemeLight /*QChart::ChartThemeSystem*/)
44 {
44 {
45 #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
45 #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
46 // We could also use theme specific window frame color as a series base color (it would give more
46 // We could also use theme specific window frame color as a series base color (it would give more
47 // variation to the base colors in addition to the blue and black used now)
47 // variation to the base colors in addition to the blue and black used now)
48
48
49 // First series base color from COLOR_HIGHLIGHT
49 // First series base color from COLOR_HIGHLIGHT
50 DWORD colorHighlight;
50 DWORD colorHighlight;
51 colorHighlight = GetSysColor(COLOR_HIGHLIGHT);
51 colorHighlight = GetSysColor(COLOR_HIGHLIGHT);
52 m_seriesColors.append(QColor(GetRValue(colorHighlight),
52 m_seriesColors.append(QColor(GetRValue(colorHighlight),
53 GetGValue(colorHighlight),
53 GetGValue(colorHighlight),
54 GetBValue(colorHighlight)));
54 GetBValue(colorHighlight)));
55
55
56 // Second series base color from COLOR_WINDOWFRAME
56 // Second series base color from COLOR_WINDOWFRAME
57 DWORD colorWindowFrame;
57 DWORD colorWindowFrame;
58 colorWindowFrame = GetSysColor(COLOR_WINDOWFRAME);
58 colorWindowFrame = GetSysColor(COLOR_WINDOWFRAME);
59 m_seriesColors.append(QColor(GetRValue(colorWindowFrame),
59 m_seriesColors.append(QColor(GetRValue(colorWindowFrame),
60 GetGValue(colorWindowFrame),
60 GetGValue(colorWindowFrame),
61 GetBValue(colorWindowFrame)));
61 GetBValue(colorWindowFrame)));
62
62
63 // Third series base color from the middle of the COLOR_ACTIVECAPTION /
63 // Third series base color from the middle of the COLOR_ACTIVECAPTION /
64 // COLOR_GRADIENTACTIVECAPTION gradient
64 // COLOR_GRADIENTACTIVECAPTION gradient
65 DWORD colorGradientActiveCaptionLeft;
65 DWORD colorGradientActiveCaptionLeft;
66 colorGradientActiveCaptionLeft = GetSysColor(COLOR_ACTIVECAPTION);
66 colorGradientActiveCaptionLeft = GetSysColor(COLOR_ACTIVECAPTION);
67 DWORD colorGradientActiveCaptionRight;
67 DWORD colorGradientActiveCaptionRight;
68 colorGradientActiveCaptionRight = GetSysColor(COLOR_GRADIENTACTIVECAPTION);
68 colorGradientActiveCaptionRight = GetSysColor(COLOR_GRADIENTACTIVECAPTION);
69 QLinearGradient g;
69 QLinearGradient g;
70 QColor start = QColor(GetRValue(colorGradientActiveCaptionLeft),
70 QColor start = QColor(GetRValue(colorGradientActiveCaptionLeft),
71 GetGValue(colorGradientActiveCaptionLeft),
71 GetGValue(colorGradientActiveCaptionLeft),
72 GetBValue(colorGradientActiveCaptionLeft));
72 GetBValue(colorGradientActiveCaptionLeft));
73 g.setColorAt(0.0, start);
73 g.setColorAt(0.0, start);
74 QColor end = QColor(GetRValue(colorGradientActiveCaptionRight),
74 QColor end = QColor(GetRValue(colorGradientActiveCaptionRight),
75 GetGValue(colorGradientActiveCaptionRight),
75 GetGValue(colorGradientActiveCaptionRight),
76 GetBValue(colorGradientActiveCaptionRight));
76 GetBValue(colorGradientActiveCaptionRight));
77 g.setColorAt(1.0, end);
77 g.setColorAt(1.0, end);
78 m_seriesColors.append(ChartThemeManager::colorAt(g, 0.5));
78 m_seriesColors.append(ChartThemeManager::colorAt(g, 0.5));
79
79
80 // Generate gradients from the base colors
80 // Generate gradients from the base colors
81 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
81 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
82
82
83 // Background fill color from COLOR_WINDOW
83 // Background fill color from COLOR_WINDOW
84 QLinearGradient backgroundGradient;
84 QLinearGradient backgroundGradient;
85 DWORD colorWindow;
85 DWORD colorWindow;
86 colorWindow = GetSysColor(COLOR_WINDOW);
86 colorWindow = GetSysColor(COLOR_WINDOW);
87 backgroundGradient.setColorAt(0.0, QColor(GetRValue(colorWindow),
87 backgroundGradient.setColorAt(0.0, QColor(GetRValue(colorWindow),
88 GetGValue(colorWindow),
88 GetGValue(colorWindow),
89 GetBValue(colorWindow)));
89 GetBValue(colorWindow)));
90 backgroundGradient.setColorAt(1.0, QColor(GetRValue(colorWindow),
90 backgroundGradient.setColorAt(1.0, QColor(GetRValue(colorWindow),
91 GetGValue(colorWindow),
91 GetGValue(colorWindow),
92 GetBValue(colorWindow)));
92 GetBValue(colorWindow)));
93 // Axes and other
93 // Axes and other
94 m_axisLinePen = QPen(0xd6d6d6);
94 m_axisLinePen = QPen(0xd6d6d6);
95 m_axisLinePen.setWidth(1);
95 m_axisLinePen.setWidth(1);
96 m_labelBrush = QBrush(QRgb(0x404044));
96 m_labelBrush = QBrush(QRgb(0x404044));
97 m_gridLinePen = QPen(QRgb(0xe2e2e2));
97 m_gridLinePen = QPen(QRgb(0xe2e2e2));
98 m_gridLinePen.setWidth(1);
98 m_gridLinePen.setWidth(1);
99 m_minorGridLinePen = QPen(QRgb(0xe2e2e2));
99 m_minorGridLinePen = QPen(QRgb(0xe2e2e2));
100 m_minorGridLinePen.setWidth(1);
100 m_minorGridLinePen.setWidth(1);
101 m_minorGridLinePen.setStyle(Qt::DashLine);
101 m_minorGridLinePen.setStyle(Qt::DashLine);
102 m_backgroundShades = BackgroundShadesNone;
102 m_backgroundShades = BackgroundShadesNone;
103
103
104 #elif defined(Q_OS_LINUX)
104 #elif defined(Q_OS_LINUX)
105 // Using a hard coded theme for Linux system theme
105 // Using a hard coded theme for Linux system theme
106 m_seriesColors << QRgb(0x60a6e6);
106 m_seriesColors << QRgb(0x60a6e6);
107 m_seriesColors << QRgb(0x92ca66);
107 m_seriesColors << QRgb(0x92ca66);
108 m_seriesColors << QRgb(0xeba85f);
108 m_seriesColors << QRgb(0xeba85f);
109 m_seriesColors << QRgb(0xfc5751);
109 m_seriesColors << QRgb(0xfc5751);
110 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
110 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
111
111
112 // Background
112 // Background
113 QLinearGradient backgroundGradient;
113 QLinearGradient backgroundGradient;
114 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
114 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
115 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
115 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
116 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
116 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
117 m_chartBackgroundGradient = backgroundGradient;
117 m_chartBackgroundGradient = backgroundGradient;
118
118
119 // Axes and other
119 // Axes and other
120 m_axisLinePen = QPen(0xd6d6d6);
120 m_axisLinePen = QPen(0xd6d6d6);
121 m_axisLinePen.setWidth(1);
121 m_axisLinePen.setWidth(1);
122 m_labelBrush = QBrush(QRgb(0x404044));
122 m_labelBrush = QBrush(QRgb(0x404044));
123 m_gridLinePen = QPen(QRgb(0xe2e2e2));
123 m_gridLinePen = QPen(QRgb(0xe2e2e2));
124 m_gridLinePen.setWidth(1);
124 m_gridLinePen.setWidth(1);
125 m_minorGridLinePen = QPen(QRgb(0x404044));
125 m_minorGridLinePen = QPen(QRgb(0x404044));
126 m_minorGridLinePen.setWidth(1);
126 m_minorGridLinePen.setWidth(1);
127 m_minorGridLinePen.setStyle(Qt::DashLine);
127 m_minorGridLinePen.setStyle(Qt::DashLine);
128 m_backgroundShades = BackgroundShadesNone;
128 m_backgroundShades = BackgroundShadesNone;
129
129
130 #elif defined(Q_OS_MAC)
130 #elif defined(Q_OS_MAC)
131 // Using a hard coded theme for OSX system theme; the colors match the OSX 10.7 colors
131 // Using a hard coded theme for OSX system theme; the colors match the OSX 10.7 colors
132 m_seriesColors << QRgb(0x60a6e6);
132 m_seriesColors << QRgb(0x60a6e6);
133 m_seriesColors << QRgb(0x92ca66);
133 m_seriesColors << QRgb(0x92ca66);
134 m_seriesColors << QRgb(0xeba85f);
134 m_seriesColors << QRgb(0xeba85f);
135 m_seriesColors << QRgb(0xfc5751);
135 m_seriesColors << QRgb(0xfc5751);
136 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
136 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
137
137
138 // Background
138 // Background
139 QLinearGradient backgroundGradient;
139 QLinearGradient backgroundGradient;
140 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
140 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
141 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
141 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
142 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
142 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
143 m_chartBackgroundGradient = backgroundGradient;
143 m_chartBackgroundGradient = backgroundGradient;
144
144
145 // Axes and other
145 // Axes and other
146 m_axisLinePen = QPen(0xd6d6d6);
146 m_axisLinePen = QPen(0xd6d6d6);
147 m_axisLinePen.setWidth(1);
147 m_axisLinePen.setWidth(1);
148 m_labelBrush = QBrush(QRgb(0x404044));
148 m_labelBrush = QBrush(QRgb(0x404044));
149 m_gridLinePen = QPen(QRgb(0xe2e2e2));
149 m_gridLinePen = QPen(QRgb(0xe2e2e2));
150 m_gridLinePen.setWidth(1);
150 m_gridLinePen.setWidth(1);
151 m_minorGridLinePen = QPen(QRgb(0xe2e2e2));
151 m_minorGridLinePen = QPen(QRgb(0xe2e2e2));
152 m_minorGridLinePen.setWidth(1);
152 m_minorGridLinePen.setWidth(1);
153 m_minorGridLinePen.setStyle(Qt::DashLine);
153 m_minorGridLinePen.setStyle(Qt::DashLine);
154 m_backgroundShades = BackgroundShadesNone;
154 m_backgroundShades = BackgroundShadesNone;
155
155
156 #else
156 #else
157 // Hard coded theme
157 // Hard coded theme
158 m_seriesColors << QRgb(0x60a6e6);
158 m_seriesColors << QRgb(0x60a6e6);
159 m_seriesColors << QRgb(0x92ca66);
159 m_seriesColors << QRgb(0x92ca66);
160 m_seriesColors << QRgb(0xeba85f);
160 m_seriesColors << QRgb(0xeba85f);
161 m_seriesColors << QRgb(0xfc5751);
161 m_seriesColors << QRgb(0xfc5751);
162 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
162 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
163
163
164 // Background
164 // Background
165 QLinearGradient backgroundGradient;
165 QLinearGradient backgroundGradient;
166 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
166 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
167 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
167 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
168 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
168 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
169 m_chartBackgroundGradient = backgroundGradient;
169 m_chartBackgroundGradient = backgroundGradient;
170
170
171 // Axes and other
171 // Axes and other
172 m_axisLinePen = QPen(0xd6d6d6);
172 m_axisLinePen = QPen(0xd6d6d6);
173 m_axisLinePen.setWidth(1);
173 m_axisLinePen.setWidth(1);
174 m_labelBrush = QBrush(QRgb(0x404044));
174 m_labelBrush = QBrush(QRgb(0x404044));
175 m_gridLinePen = QPen(QRgb(0xe2e2e2));
175 m_gridLinePen = QPen(QRgb(0xe2e2e2));
176 m_gridLinePen.setWidth(1);
176 m_gridLinePen.setWidth(1);
177 m_minorGridLinePen = QPen(QRgb(0xe2e2e2));
177 m_minorGridLinePen = QPen(QRgb(0xe2e2e2));
178 m_minorGridLinePen.setWidth(1);
178 m_minorGridLinePen.setWidth(1);
179 m_minorGridLinePen.setStyle(Qt::DashLine);
179 m_minorGridLinePen.setStyle(Qt::DashLine);
180 m_backgroundShades = BackgroundShadesNone;
180 m_backgroundShades = BackgroundShadesNone;
181 #endif
181 #endif
182 }
182 }
183 };
183 };
184
184
185 QT_CHARTS_END_NAMESPACE
185 QT_CHARTS_END_NAMESPACE
186
186
187 #endif // CHARTTHEMESYSTEM_P_H
187 #endif // CHARTTHEMESYSTEM_P_H
@@ -1,98 +1,98
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QXYMODELMAPPER_P_H
28 #ifndef QXYMODELMAPPER_P_H
29 #define QXYMODELMAPPER_P_H
29 #define QXYMODELMAPPER_P_H
30
30
31 #include <QtCharts/QXYModelMapper>
31 #include <QtCharts/QXYModelMapper>
32 #include <QtCore/QObject>
32 #include <QtCore/QObject>
33
33
34 QT_BEGIN_NAMESPACE
34 QT_BEGIN_NAMESPACE
35 class QModelIndex;
35 class QModelIndex;
36 class QAbstractItemModel;
36 class QAbstractItemModel;
37 class QPointF;
37 class QPointF;
38 QT_END_NAMESPACE
38 QT_END_NAMESPACE
39
39
40 QT_CHARTS_BEGIN_NAMESPACE
40 QT_CHARTS_BEGIN_NAMESPACE
41
41
42 class QXYModelMapper;
42 class QXYModelMapper;
43 class QXYSeries;
43 class QXYSeries;
44
44
45 class QXYModelMapperPrivate : public QObject
45 class QXYModelMapperPrivate : public QObject
46 {
46 {
47 Q_OBJECT
47 Q_OBJECT
48
48
49 public:
49 public:
50 QXYModelMapperPrivate(QXYModelMapper *q);
50 QXYModelMapperPrivate(QXYModelMapper *q);
51
51
52 public Q_SLOTS:
52 public Q_SLOTS:
53 // for the model
53 // for the model
54 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
54 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
55 void modelRowsAdded(QModelIndex parent, int start, int end);
55 void modelRowsAdded(QModelIndex parent, int start, int end);
56 void modelRowsRemoved(QModelIndex parent, int start, int end);
56 void modelRowsRemoved(QModelIndex parent, int start, int end);
57 void modelColumnsAdded(QModelIndex parent, int start, int end);
57 void modelColumnsAdded(QModelIndex parent, int start, int end);
58 void modelColumnsRemoved(QModelIndex parent, int start, int end);
58 void modelColumnsRemoved(QModelIndex parent, int start, int end);
59 void handleModelDestroyed();
59 void handleModelDestroyed();
60
60
61 // for the series
61 // for the series
62 void handlePointAdded(int pointPos);
62 void handlePointAdded(int pointPos);
63 void handlePointRemoved(int pointPos);
63 void handlePointRemoved(int pointPos);
64 void handlePointsRemoved(int pointPos, int count);
64 void handlePointsRemoved(int pointPos, int count);
65 void handlePointReplaced(int pointPos);
65 void handlePointReplaced(int pointPos);
66 void handleSeriesDestroyed();
66 void handleSeriesDestroyed();
67
67
68 void initializeXYFromModel();
68 void initializeXYFromModel();
69
69
70 private:
70 private:
71 QModelIndex xModelIndex(int xPos);
71 QModelIndex xModelIndex(int xPos);
72 QModelIndex yModelIndex(int yPos);
72 QModelIndex yModelIndex(int yPos);
73 void insertData(int start, int end);
73 void insertData(int start, int end);
74 void removeData(int start, int end);
74 void removeData(int start, int end);
75 void blockModelSignals(bool block = true);
75 void blockModelSignals(bool block = true);
76 void blockSeriesSignals(bool block = true);
76 void blockSeriesSignals(bool block = true);
77 qreal valueFromModel(QModelIndex index);
77 qreal valueFromModel(QModelIndex index);
78 void setValueToModel(QModelIndex index, qreal value);
78 void setValueToModel(QModelIndex index, qreal value);
79
79
80 private:
80 private:
81 QXYSeries *m_series;
81 QXYSeries *m_series;
82 QAbstractItemModel *m_model;
82 QAbstractItemModel *m_model;
83 int m_first;
83 int m_first;
84 int m_count;
84 int m_count;
85 Qt::Orientation m_orientation;
85 Qt::Orientation m_orientation;
86 int m_xSection;
86 int m_xSection;
87 int m_ySection;
87 int m_ySection;
88 bool m_seriesSignalsBlock;
88 bool m_seriesSignalsBlock;
89 bool m_modelSignalsBlock;
89 bool m_modelSignalsBlock;
90
90
91 private:
91 private:
92 QXYModelMapper *q_ptr;
92 QXYModelMapper *q_ptr;
93 Q_DECLARE_PUBLIC(QXYModelMapper)
93 Q_DECLARE_PUBLIC(QXYModelMapper)
94 };
94 };
95
95
96 QT_CHARTS_END_NAMESPACE
96 QT_CHARTS_END_NAMESPACE
97
97
98 #endif // QXYMODELMAPPER_P_H
98 #endif // QXYMODELMAPPER_P_H
@@ -1,78 +1,78
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QXYSERIES_P_H
28 #ifndef QXYSERIES_P_H
29 #define QXYSERIES_P_H
29 #define QXYSERIES_P_H
30
30
31 #include <private/qabstractseries_p.h>
31 #include <private/qabstractseries_p.h>
32
32
33 QT_CHARTS_BEGIN_NAMESPACE
33 QT_CHARTS_BEGIN_NAMESPACE
34
34
35 class QXYSeries;
35 class QXYSeries;
36 class QAbstractAxis;
36 class QAbstractAxis;
37
37
38 class QXYSeriesPrivate: public QAbstractSeriesPrivate
38 class QXYSeriesPrivate: public QAbstractSeriesPrivate
39 {
39 {
40 Q_OBJECT
40 Q_OBJECT
41
41
42 public:
42 public:
43 QXYSeriesPrivate(QXYSeries *q);
43 QXYSeriesPrivate(QXYSeries *q);
44
44
45 void initializeDomain();
45 void initializeDomain();
46 void initializeAxes();
46 void initializeAxes();
47 void initializeAnimations(QtCharts::QChart::AnimationOptions options, int duration,
47 void initializeAnimations(QtCharts::QChart::AnimationOptions options, int duration,
48 QEasingCurve &curve);
48 QEasingCurve &curve);
49
49
50 QList<QLegendMarker*> createLegendMarkers(QLegend* legend);
50 QList<QLegendMarker*> createLegendMarkers(QLegend* legend);
51
51
52 QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
52 QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
53 QAbstractAxis* createDefaultAxis(Qt::Orientation orientation) const;
53 QAbstractAxis* createDefaultAxis(Qt::Orientation orientation) const;
54
54
55 void drawSeriesPointLabels(QPainter *painter, const QVector<QPointF> &points,
55 void drawSeriesPointLabels(QPainter *painter, const QVector<QPointF> &points,
56 const int offset = 0);
56 const int offset = 0);
57
57
58 Q_SIGNALS:
58 Q_SIGNALS:
59 void updated();
59 void updated();
60
60
61 protected:
61 protected:
62 QVector<QPointF> m_points;
62 QVector<QPointF> m_points;
63 QPen m_pen;
63 QPen m_pen;
64 QBrush m_brush;
64 QBrush m_brush;
65 bool m_pointsVisible;
65 bool m_pointsVisible;
66 QString m_pointLabelsFormat;
66 QString m_pointLabelsFormat;
67 bool m_pointLabelsVisible;
67 bool m_pointLabelsVisible;
68 QFont m_pointLabelsFont;
68 QFont m_pointLabelsFont;
69 QColor m_pointLabelsColor;
69 QColor m_pointLabelsColor;
70
70
71 private:
71 private:
72 Q_DECLARE_PUBLIC(QXYSeries)
72 Q_DECLARE_PUBLIC(QXYSeries)
73 friend class QScatterSeries;
73 friend class QScatterSeries;
74 };
74 };
75
75
76 QT_CHARTS_END_NAMESPACE
76 QT_CHARTS_END_NAMESPACE
77
77
78 #endif
78 #endif
@@ -1,94 +1,94
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef XYCHART_H
28 #ifndef XYCHART_H
29 #define XYCHART_H
29 #define XYCHART_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <private/chartitem_p.h>
32 #include <private/chartitem_p.h>
33 #include <private/xyanimation_p.h>
33 #include <private/xyanimation_p.h>
34 #include <QtCharts/QValueAxis>
34 #include <QtCharts/QValueAxis>
35 #include <QtGui/QPen>
35 #include <QtGui/QPen>
36
36
37 QT_CHARTS_BEGIN_NAMESPACE
37 QT_CHARTS_BEGIN_NAMESPACE
38
38
39 class ChartPresenter;
39 class ChartPresenter;
40 class QXYSeries;
40 class QXYSeries;
41
41
42 class XYChart : public ChartItem
42 class XYChart : public ChartItem
43 {
43 {
44 Q_OBJECT
44 Q_OBJECT
45 public:
45 public:
46 explicit XYChart(QXYSeries *series,QGraphicsItem *item = 0);
46 explicit XYChart(QXYSeries *series,QGraphicsItem *item = 0);
47 ~XYChart() {}
47 ~XYChart() {}
48
48
49 void setGeometryPoints(const QVector<QPointF> &points);
49 void setGeometryPoints(const QVector<QPointF> &points);
50 QVector<QPointF> geometryPoints() const { return m_points; }
50 QVector<QPointF> geometryPoints() const { return m_points; }
51
51
52 void setAnimation(XYAnimation *animation);
52 void setAnimation(XYAnimation *animation);
53 ChartAnimation *animation() const { return m_animation; }
53 ChartAnimation *animation() const { return m_animation; }
54 virtual void updateGeometry() = 0;
54 virtual void updateGeometry() = 0;
55
55
56 bool isDirty() const { return m_dirty; }
56 bool isDirty() const { return m_dirty; }
57 void setDirty(bool dirty);
57 void setDirty(bool dirty);
58
58
59 void getSeriesRanges(qreal &minX, qreal &maxX, qreal &minY, qreal &maxY);
59 void getSeriesRanges(qreal &minX, qreal &maxX, qreal &minY, qreal &maxY);
60 QVector<bool> offGridStatusVector();
60 QVector<bool> offGridStatusVector();
61
61
62 public Q_SLOTS:
62 public Q_SLOTS:
63 void handlePointAdded(int index);
63 void handlePointAdded(int index);
64 void handlePointRemoved(int index);
64 void handlePointRemoved(int index);
65 void handlePointsRemoved(int index, int count);
65 void handlePointsRemoved(int index, int count);
66 void handlePointReplaced(int index);
66 void handlePointReplaced(int index);
67 void handlePointsReplaced();
67 void handlePointsReplaced();
68 void handleDomainUpdated();
68 void handleDomainUpdated();
69
69
70 Q_SIGNALS:
70 Q_SIGNALS:
71 void clicked(const QPointF &point);
71 void clicked(const QPointF &point);
72 void hovered(const QPointF &point, bool state);
72 void hovered(const QPointF &point, bool state);
73 void pressed(const QPointF &point);
73 void pressed(const QPointF &point);
74 void released(const QPointF &point);
74 void released(const QPointF &point);
75 void doubleClicked(const QPointF &point);
75 void doubleClicked(const QPointF &point);
76
76
77 protected:
77 protected:
78 virtual void updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, int index = -1);
78 virtual void updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, int index = -1);
79
79
80 private:
80 private:
81 inline bool isEmpty();
81 inline bool isEmpty();
82
82
83 protected:
83 protected:
84 QXYSeries *m_series;
84 QXYSeries *m_series;
85 QVector<QPointF> m_points;
85 QVector<QPointF> m_points;
86 XYAnimation *m_animation;
86 XYAnimation *m_animation;
87 bool m_dirty;
87 bool m_dirty;
88
88
89 friend class AreaChartItem;
89 friend class AreaChartItem;
90 };
90 };
91
91
92 QT_CHARTS_END_NAMESPACE
92 QT_CHARTS_END_NAMESPACE
93
93
94 #endif
94 #endif
General Comments 0
You need to be logged in to leave comments. Login now