@@ -28,7 +28,7 m_domainIndex(0), | |||||
28 | m_marginSize(0), |
|
28 | m_marginSize(0), | |
29 | m_rect(QRectF(QPoint(0,0),m_chart->size())) |
|
29 | m_rect(QRectF(QPoint(0,0),m_chart->size())) | |
30 | { |
|
30 | { | |
31 | setTheme(QChart::ChartThemeDefault); |
|
31 | setChartTheme(QChart::ChartThemeDefault); | |
32 | createConnections(); |
|
32 | createConnections(); | |
33 | createDeafultAxis(); |
|
33 | createDeafultAxis(); | |
34 | } |
|
34 | } | |
@@ -203,7 +203,7 void ChartPresenter::zoomReset() | |||||
203 | m_dataset->clearDomains(); |
|
203 | m_dataset->clearDomains(); | |
204 | } |
|
204 | } | |
205 |
|
205 | |||
206 |
void ChartPresenter::setTheme(QChart::ChartTheme |
|
206 | void ChartPresenter::setChartTheme(QChart::ChartTheme theme) | |
207 | { |
|
207 | { | |
208 | delete m_chartTheme; |
|
208 | delete m_chartTheme; | |
209 |
|
209 | |||
@@ -221,9 +221,19 void ChartPresenter::setTheme(QChart::ChartThemeId theme) | |||||
221 | } |
|
221 | } | |
222 |
|
222 | |||
223 |
|
223 | |||
224 |
QChart::ChartTheme |
|
224 | QChart::ChartTheme ChartPresenter::chartTheme() | |
225 | { |
|
225 | { | |
226 |
return ( |
|
226 | return m_chartTheme->id(); | |
|
227 | } | |||
|
228 | ||||
|
229 | void ChartPresenter::setAxisX(QChartAxis* axis) | |||
|
230 | { | |||
|
231 | ||||
|
232 | } | |||
|
233 | ||||
|
234 | void ChartPresenter::addAxisY(QChartAxis* axis) | |||
|
235 | { | |||
|
236 | ||||
227 | } |
|
237 | } | |
228 |
|
238 | |||
229 | /* |
|
239 | /* |
@@ -21,13 +21,6 class ChartPresenter: public QObject | |||||
21 | public: |
|
21 | public: | |
22 | ChartPresenter(QChart* chart,ChartDataSet *dataset); |
|
22 | ChartPresenter(QChart* chart,ChartDataSet *dataset); | |
23 | virtual ~ChartPresenter(); |
|
23 | virtual ~ChartPresenter(); | |
24 | /* |
|
|||
25 | void setAxisX(const QChartAxis& axis); |
|
|||
26 | void setAxisY(const QChartAxis& axis); |
|
|||
27 | void setAxisY(const QList<QChartAxis>& axis); |
|
|||
28 |
|
||||
29 |
|
||||
30 | */ |
|
|||
31 |
|
24 | |||
32 | void setMargin(int margin); |
|
25 | void setMargin(int margin); | |
33 | int margin() const; |
|
26 | int margin() const; | |
@@ -37,9 +30,11 public: | |||||
37 | void zoomOut(); |
|
30 | void zoomOut(); | |
38 | void zoomReset(); |
|
31 | void zoomReset(); | |
39 |
|
32 | |||
40 |
void setTheme(QChart::ChartTheme |
|
33 | void setChartTheme(QChart::ChartTheme theme); | |
41 |
QChart::ChartTheme |
|
34 | QChart::ChartTheme chartTheme(); | |
42 |
|
35 | |||
|
36 | void setAxisX(QChartAxis* axis); | |||
|
37 | void addAxisY(QChartAxis* axis); | |||
43 | private: |
|
38 | private: | |
44 | void createConnections(); |
|
39 | void createConnections(); | |
45 | void createDeafultAxis(); |
|
40 | void createDeafultAxis(); |
@@ -35,8 +35,9 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
35 | m_gradientEndColor = QColor(QRgb(0xffafafaf)); |
|
35 | m_gradientEndColor = QColor(QRgb(0xffafafaf)); | |
36 | */ |
|
36 | */ | |
37 |
|
37 | |||
38 | ChartTheme::ChartTheme() |
|
38 | ChartTheme::ChartTheme(QChart::ChartTheme id) | |
39 | { |
|
39 | { | |
|
40 | m_id = id; | |||
40 | m_seriesColor.append(QRgb(0xff000000)); |
|
41 | m_seriesColor.append(QRgb(0xff000000)); | |
41 | m_seriesColor.append(QRgb(0xff707070)); |
|
42 | m_seriesColor.append(QRgb(0xff707070)); | |
42 | m_gradientStartColor = QColor(QRgb(0xffffffff)); |
|
43 | m_gradientStartColor = QColor(QRgb(0xffffffff)); | |
@@ -44,7 +45,7 ChartTheme::ChartTheme() | |||||
44 | } |
|
45 | } | |
45 |
|
46 | |||
46 |
|
47 | |||
47 |
ChartTheme* ChartTheme::createTheme(QChart::ChartTheme |
|
48 | ChartTheme* ChartTheme::createTheme(QChart::ChartTheme theme) | |
48 | { |
|
49 | { | |
49 | switch(theme) { |
|
50 | switch(theme) { | |
50 | case QChart::ChartThemeDefault: |
|
51 | case QChart::ChartThemeDefault: |
@@ -21,9 +21,10 class PercentBarGroup; | |||||
21 | class ChartTheme |
|
21 | class ChartTheme | |
22 | { |
|
22 | { | |
23 | protected: |
|
23 | protected: | |
24 | explicit ChartTheme(); |
|
24 | explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeDefault); | |
25 | public: |
|
25 | public: | |
26 |
static ChartTheme* createTheme(QChart::ChartTheme |
|
26 | static ChartTheme* createTheme(QChart::ChartTheme theme); | |
|
27 | QChart::ChartTheme id() const {return m_id;} | |||
27 | void decorate(QChart* chart); |
|
28 | void decorate(QChart* chart); | |
28 | void decorate(ChartItem* item, QChartSeries* series,int count); |
|
29 | void decorate(ChartItem* item, QChartSeries* series,int count); | |
29 | void decorate(LineChartItem* item, QLineChartSeries*, int count); |
|
30 | void decorate(LineChartItem* item, QLineChartSeries*, int count); | |
@@ -32,6 +33,7 public: | |||||
32 | void decorate(PercentBarGroup* item, PercentBarChartSeries* series,int count); |
|
33 | void decorate(PercentBarGroup* item, PercentBarChartSeries* series,int count); | |
33 |
|
34 | |||
34 | protected: |
|
35 | protected: | |
|
36 | QChart::ChartTheme m_id; | |||
35 | QColor m_gradientStartColor; |
|
37 | QColor m_gradientStartColor; | |
36 | QColor m_gradientEndColor; |
|
38 | QColor m_gradientEndColor; | |
37 | QList<QColor> m_seriesColor; |
|
39 | QList<QColor> m_seriesColor; |
@@ -115,14 +115,14 void QChart::setMargin(int margin) | |||||
115 | m_presenter->setMargin(margin); |
|
115 | m_presenter->setMargin(margin); | |
116 | } |
|
116 | } | |
117 |
|
117 | |||
118 |
void QChart::setTheme(QChart::ChartTheme |
|
118 | void QChart::setChartTheme(QChart::ChartTheme theme) | |
119 | { |
|
119 | { | |
120 | m_presenter->setTheme(theme); |
|
120 | m_presenter->setChartTheme(theme); | |
121 | } |
|
121 | } | |
122 |
|
122 | |||
123 |
QChart::ChartTheme |
|
123 | QChart::ChartTheme QChart::chartTheme() const | |
124 | { |
|
124 | { | |
125 | return m_presenter->theme(); |
|
125 | return m_presenter->chartTheme(); | |
126 | } |
|
126 | } | |
127 |
|
127 | |||
128 | void QChart::zoomInToRect(const QRectF& rectangle) |
|
128 | void QChart::zoomInToRect(const QRectF& rectangle) | |
@@ -145,23 +145,13 void QChart::zoomReset() | |||||
145 | m_presenter->zoomReset(); |
|
145 | m_presenter->zoomReset(); | |
146 | } |
|
146 | } | |
147 |
|
147 | |||
148 |
void QChart::setAxisX( |
|
148 | void QChart::setAxisX(QChartAxis* axis) | |
149 | { |
|
149 | { | |
150 |
|
150 | m_presenter->setAxisX(axis); | ||
151 | } |
|
151 | } | |
152 |
void QChart:: |
|
152 | void QChart::addAxisY(QChartAxis* axis) | |
153 | { |
|
|||
154 |
|
||||
155 | } |
|
|||
156 |
|
||||
157 | void QChart::setAxisY(const QList<QChartAxis>& axis) |
|
|||
158 | { |
|
153 | { | |
159 | //TODO not implemented |
|
154 | m_presenter->addAxisY(axis); | |
160 | } |
|
|||
161 |
|
||||
162 | void QChart::setAxis(AxisItem *item, const QChartAxis& axis) |
|
|||
163 | { |
|
|||
164 |
|
||||
165 | } |
|
155 | } | |
166 |
|
156 | |||
167 | void QChart::resizeEvent(QGraphicsSceneResizeEvent *event) |
|
157 | void QChart::resizeEvent(QGraphicsSceneResizeEvent *event) |
@@ -33,8 +33,7 class QTCOMMERCIALCHART_EXPORT QChart : public QGraphicsWidget | |||||
33 | { |
|
33 | { | |
34 | Q_OBJECT |
|
34 | Q_OBJECT | |
35 | public: |
|
35 | public: | |
36 |
enum ChartTheme |
|
36 | enum ChartTheme { | |
37 | ChartThemeInvalid = -1, |
|
|||
38 | /*! The default theme follows the GUI style of the Operating System */ |
|
37 | /*! The default theme follows the GUI style of the Operating System */ | |
39 | ChartThemeDefault, |
|
38 | ChartThemeDefault, | |
40 | ChartThemeVanilla, |
|
39 | ChartThemeVanilla, | |
@@ -56,8 +55,8 public: | |||||
56 |
|
55 | |||
57 | void setMargin(int margin); |
|
56 | void setMargin(int margin); | |
58 | int margin() const; |
|
57 | int margin() const; | |
59 |
void setTheme(QChart::ChartTheme |
|
58 | void setChartTheme(QChart::ChartTheme theme); | |
60 |
QChart::ChartTheme |
|
59 | QChart::ChartTheme chartTheme() const; | |
61 |
|
60 | |||
62 | void setTitle(const QString& title,const QFont& font = QFont()); |
|
61 | void setTitle(const QString& title,const QFont& font = QFont()); | |
63 | void setChartBackgroundBrush(const QBrush& brush); |
|
62 | void setChartBackgroundBrush(const QBrush& brush); | |
@@ -68,9 +67,8 public: | |||||
68 | void zoomOut(); |
|
67 | void zoomOut(); | |
69 | void zoomReset(); |
|
68 | void zoomReset(); | |
70 |
|
69 | |||
71 |
void setAxisX( |
|
70 | void setAxisX(QChartAxis* axis); | |
72 |
void |
|
71 | void addAxisY(QChartAxis* axis); | |
73 | void setAxisY(const QList<QChartAxis>& axis); |
|
|||
74 |
|
72 | |||
75 | protected: |
|
73 | protected: | |
76 | void resizeEvent(QGraphicsSceneResizeEvent *event); |
|
74 | void resizeEvent(QGraphicsSceneResizeEvent *event); |
@@ -189,10 +189,14 void QChartView::keyPressEvent(QKeyEvent *event) | |||||
189 | } |
|
189 | } | |
190 | } |
|
190 | } | |
191 |
|
191 | |||
192 |
void QChartView::setTheme(QChart::ChartTheme |
|
192 | void QChartView::setChartTheme(QChart::ChartTheme theme) | |
193 | { |
|
193 | { | |
194 | m_chart->setTheme(theme); |
|
194 | m_chart->setChartTheme(theme); | |
195 | } |
|
195 | } | |
196 |
|
196 | |||
|
197 | QChart::ChartTheme QChartView::chartTheme() const | |||
|
198 | { | |||
|
199 | return m_chart->chartTheme(); | |||
|
200 | } | |||
197 |
|
201 | |||
198 | QTCOMMERCIALCHART_END_NAMESPACE |
|
202 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -42,7 +42,8 public: | |||||
42 | void setRubberBandPolicy(const RubberBandPolicy ); |
|
42 | void setRubberBandPolicy(const RubberBandPolicy ); | |
43 | RubberBandPolicy rubberBandPolicy() const; |
|
43 | RubberBandPolicy rubberBandPolicy() const; | |
44 |
|
44 | |||
45 |
void setTheme(QChart::ChartTheme |
|
45 | void setChartTheme(QChart::ChartTheme theme); | |
|
46 | QChart::ChartTheme chartTheme() const; | |||
46 |
|
47 | |||
47 | protected: |
|
48 | protected: | |
48 | void mousePressEvent(QMouseEvent *event); |
|
49 | void mousePressEvent(QMouseEvent *event); |
@@ -5,7 +5,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
5 | class ChartThemeGrayscale: public ChartTheme |
|
5 | class ChartThemeGrayscale: public ChartTheme | |
6 | { |
|
6 | { | |
7 | public: |
|
7 | public: | |
8 | ChartThemeGrayscale() |
|
8 | ChartThemeGrayscale():ChartTheme(QChart::ChartThemeGrayscale) | |
9 | { |
|
9 | { | |
10 | m_seriesColor.append(QRgb(0xFF869299)); |
|
10 | m_seriesColor.append(QRgb(0xFF869299)); | |
11 | m_seriesColor.append(QRgb(0xFFA5BDCC)); |
|
11 | m_seriesColor.append(QRgb(0xFFA5BDCC)); |
@@ -5,7 +5,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
5 | class ChartThemeIcy: public ChartTheme |
|
5 | class ChartThemeIcy: public ChartTheme | |
6 | { |
|
6 | { | |
7 | public: |
|
7 | public: | |
8 | ChartThemeIcy() |
|
8 | ChartThemeIcy():ChartTheme(QChart::ChartThemeIcy) | |
9 | { |
|
9 | { | |
10 | m_seriesColor.append(QRgb(0xFF0D2673)); |
|
10 | m_seriesColor.append(QRgb(0xFF0D2673)); | |
11 | m_seriesColor.append(QRgb(0xFF2685BF)); |
|
11 | m_seriesColor.append(QRgb(0xFF2685BF)); |
@@ -5,7 +5,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
5 | class ChartThemeScientific: public ChartTheme |
|
5 | class ChartThemeScientific: public ChartTheme | |
6 | { |
|
6 | { | |
7 | public: |
|
7 | public: | |
8 | ChartThemeScientific() |
|
8 | ChartThemeScientific():ChartTheme(QChart::ChartThemeScientific) | |
9 | { |
|
9 | { | |
10 | m_seriesColor.append(QRgb(0xFF000000)); |
|
10 | m_seriesColor.append(QRgb(0xFF000000)); | |
11 | m_seriesColor.append(QRgb(0xFFFFAD00)); |
|
11 | m_seriesColor.append(QRgb(0xFFFFAD00)); |
@@ -5,7 +5,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
5 | class ChartThemeVanilla: public ChartTheme |
|
5 | class ChartThemeVanilla: public ChartTheme | |
6 | { |
|
6 | { | |
7 | public: |
|
7 | public: | |
8 | ChartThemeVanilla() |
|
8 | ChartThemeVanilla():ChartTheme(QChart::ChartThemeVanilla) | |
9 | { |
|
9 | { | |
10 | m_seriesColor.append(QColor(217, 197, 116)); |
|
10 | m_seriesColor.append(QColor(217, 197, 116)); | |
11 | m_seriesColor.append(QColor(214, 168, 150)); |
|
11 | m_seriesColor.append(QColor(214, 168, 150)); |
General Comments 0
You need to be logged in to leave comments.
Login now