##// END OF EJS Templates
Added Z value for BoxPlot...
Mika Salmela -
r2469:a8d7539d111a
parent child
Show More
@@ -1,166 +1,167
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2013 Digia Plc
3 ** Copyright (C) 2013 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 // W A R N I N G
21 // W A R N I N G
22 // -------------
22 // -------------
23 //
23 //
24 // This file is not part of the QtCommercial Chart API. It exists purely as an
24 // This file is not part of the QtCommercial Chart API. It exists purely as an
25 // implementation detail. This header file may change from version to
25 // implementation detail. This header file may change from version to
26 // version without notice, or even be removed.
26 // version without notice, or even be removed.
27 //
27 //
28 // We mean it.
28 // We mean it.
29
29
30 #ifndef CHARTPRESENTER_H
30 #ifndef CHARTPRESENTER_H
31 #define CHARTPRESENTER_H
31 #define CHARTPRESENTER_H
32
32
33 #include "qchartglobal.h"
33 #include "qchartglobal.h"
34 #include "qchart.h" //because of QChart::ChartThemeId
34 #include "qchart.h" //because of QChart::ChartThemeId
35 #include <QRectF>
35 #include <QRectF>
36 #include <QMargins>
36 #include <QMargins>
37
37
38 QTCOMMERCIALCHART_BEGIN_NAMESPACE
38 QTCOMMERCIALCHART_BEGIN_NAMESPACE
39
39
40 class ChartItem;
40 class ChartItem;
41 class AxisItem;
41 class AxisItem;
42 class QAbstractSeries;
42 class QAbstractSeries;
43 class ChartDataSet;
43 class ChartDataSet;
44 class AbstractDomain;
44 class AbstractDomain;
45 class ChartAxis;
45 class ChartAxis;
46 class ChartAnimator;
46 class ChartAnimator;
47 class ChartBackground;
47 class ChartBackground;
48 class ChartTitle;
48 class ChartTitle;
49 class ChartAnimation;
49 class ChartAnimation;
50 class ChartLayout;
50 class ChartLayout;
51
51
52 class ChartPresenter: public QObject
52 class ChartPresenter: public QObject
53 {
53 {
54 Q_OBJECT
54 Q_OBJECT
55 public:
55 public:
56 enum ZValues {
56 enum ZValues {
57 BackgroundZValue = -1,
57 BackgroundZValue = -1,
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 LegendZValue,
68 LegendZValue,
68 TopMostZValue
69 TopMostZValue
69 };
70 };
70
71
71 enum State {
72 enum State {
72 ShowState,
73 ShowState,
73 ScrollUpState,
74 ScrollUpState,
74 ScrollDownState,
75 ScrollDownState,
75 ScrollLeftState,
76 ScrollLeftState,
76 ScrollRightState,
77 ScrollRightState,
77 ZoomInState,
78 ZoomInState,
78 ZoomOutState
79 ZoomOutState
79 };
80 };
80
81
81 ChartPresenter(QChart *chart);
82 ChartPresenter(QChart *chart);
82 virtual ~ChartPresenter();
83 virtual ~ChartPresenter();
83
84
84
85
85 void setGeometry(QRectF rect);
86 void setGeometry(QRectF rect);
86 QRectF geometry() const;
87 QRectF geometry() const;
87
88
88 QGraphicsItem *rootItem(){ return m_chart; }
89 QGraphicsItem *rootItem(){ return m_chart; }
89 ChartBackground *backgroundElement();
90 ChartBackground *backgroundElement();
90 ChartTitle *titleElement();
91 ChartTitle *titleElement();
91 QList<ChartAxis *> axisItems() const;
92 QList<ChartAxis *> axisItems() const;
92 QList<ChartItem *> chartItems() const;
93 QList<ChartItem *> chartItems() const;
93
94
94 ChartItem* chartElement(QAbstractSeries* series) const;
95 ChartItem* chartElement(QAbstractSeries* series) const;
95 ChartAxis* chartElement(QAbstractAxis* axis) const;
96 ChartAxis* chartElement(QAbstractAxis* axis) const;
96
97
97 QLegend *legend();
98 QLegend *legend();
98
99
99 void setBackgroundBrush(const QBrush &brush);
100 void setBackgroundBrush(const QBrush &brush);
100 QBrush backgroundBrush() const;
101 QBrush backgroundBrush() const;
101
102
102 void setBackgroundPen(const QPen &pen);
103 void setBackgroundPen(const QPen &pen);
103 QPen backgroundPen() const;
104 QPen backgroundPen() const;
104
105
105 void setTitle(const QString &title);
106 void setTitle(const QString &title);
106 QString title() const;
107 QString title() const;
107
108
108 void setTitleFont(const QFont &font);
109 void setTitleFont(const QFont &font);
109 QFont titleFont() const;
110 QFont titleFont() const;
110
111
111 void setTitleBrush(const QBrush &brush);
112 void setTitleBrush(const QBrush &brush);
112 QBrush titleBrush() const;
113 QBrush titleBrush() const;
113
114
114 void setBackgroundVisible(bool visible);
115 void setBackgroundVisible(bool visible);
115 bool isBackgroundVisible() const;
116 bool isBackgroundVisible() const;
116
117
117 void setBackgroundDropShadowEnabled(bool enabled);
118 void setBackgroundDropShadowEnabled(bool enabled);
118 bool isBackgroundDropShadowEnabled() const;
119 bool isBackgroundDropShadowEnabled() const;
119
120
120 void setVisible(bool visible);
121 void setVisible(bool visible);
121
122
122 void setAnimationOptions(QChart::AnimationOptions options);
123 void setAnimationOptions(QChart::AnimationOptions options);
123 QChart::AnimationOptions animationOptions() const;
124 QChart::AnimationOptions animationOptions() const;
124
125
125 void startAnimation(ChartAnimation *animation);
126 void startAnimation(ChartAnimation *animation);
126
127
127 void setState(State state,QPointF point);
128 void setState(State state,QPointF point);
128 State state() const { return m_state; }
129 State state() const { return m_state; }
129 QPointF statePoint() const { return m_statePoint; }
130 QPointF statePoint() const { return m_statePoint; }
130 ChartLayout *layout();
131 ChartLayout *layout();
131
132
132 private:
133 private:
133 void createBackgroundItem();
134 void createBackgroundItem();
134 void createTitleItem();
135 void createTitleItem();
135
136
136 public Q_SLOTS:
137 public Q_SLOTS:
137 void handleSeriesAdded(QAbstractSeries *series);
138 void handleSeriesAdded(QAbstractSeries *series);
138 void handleSeriesRemoved(QAbstractSeries *series);
139 void handleSeriesRemoved(QAbstractSeries *series);
139 void handleAxisAdded(QAbstractAxis *axis);
140 void handleAxisAdded(QAbstractAxis *axis);
140 void handleAxisRemoved(QAbstractAxis *axis);
141 void handleAxisRemoved(QAbstractAxis *axis);
141
142
142 private Q_SLOTS:
143 private Q_SLOTS:
143 void handleAnimationFinished();
144 void handleAnimationFinished();
144
145
145 Q_SIGNALS:
146 Q_SIGNALS:
146 void animationsFinished();
147 void animationsFinished();
147
148
148 private:
149 private:
149 QChart *m_chart;
150 QChart *m_chart;
150 QList<ChartItem *> m_chartItems;
151 QList<ChartItem *> m_chartItems;
151 QList<ChartAxis *> m_axisItems;
152 QList<ChartAxis *> m_axisItems;
152 QList<QAbstractSeries *> m_series;
153 QList<QAbstractSeries *> m_series;
153 QList<QAbstractAxis *> m_axes;
154 QList<QAbstractAxis *> m_axes;
154 QChart::AnimationOptions m_options;
155 QChart::AnimationOptions m_options;
155 State m_state;
156 State m_state;
156 QPointF m_statePoint;
157 QPointF m_statePoint;
157 QList<ChartAnimation *> m_animations;
158 QList<ChartAnimation *> m_animations;
158 ChartLayout *m_layout;
159 ChartLayout *m_layout;
159 ChartBackground *m_background;
160 ChartBackground *m_background;
160 ChartTitle *m_title;
161 ChartTitle *m_title;
161 QRectF m_rect;
162 QRectF m_rect;
162 };
163 };
163
164
164 QTCOMMERCIALCHART_END_NAMESPACE
165 QTCOMMERCIALCHART_END_NAMESPACE
165
166
166 #endif /* CHARTPRESENTER_H */
167 #endif /* CHARTPRESENTER_H */
General Comments 0
You need to be logged in to leave comments. Login now