@@ -1,280 +1,285 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 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 | #include "qboxplotseries.h" |
|
21 | #include "qboxplotseries.h" | |
22 | #include "qboxplotseries_p.h" |
|
22 | #include "qboxplotseries_p.h" | |
23 | #include "qboxplotlegendmarker.h" |
|
23 | #include "qboxplotlegendmarker.h" | |
24 | #include "boxplotchartitem_p.h" |
|
24 | #include "boxplotchartitem_p.h" | |
25 | #include "chartdataset_p.h" |
|
25 | #include "chartdataset_p.h" | |
26 | #include "charttheme_p.h" |
|
26 | #include "charttheme_p.h" | |
27 | #include "qvalueaxis.h" |
|
27 | #include "qvalueaxis.h" | |
28 | #include "charttheme_p.h" |
|
28 | #include "charttheme_p.h" | |
29 | #include "boxplotanimation_p.h" |
|
29 | #include "boxplotanimation_p.h" | |
30 | #include "qchart_p.h" |
|
30 | #include "qchart_p.h" | |
31 |
|
31 | |||
32 | #include <QDebug> |
|
32 | #include <QDebug> | |
33 |
|
33 | |||
34 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
34 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
35 |
|
35 | |||
36 | /*! |
|
36 | /*! | |
37 | \class QBoxPlotSeries |
|
37 | \class QBoxPlotSeries | |
38 | \brief Series for creating stacked bar chart |
|
38 | \brief Series for creating stacked bar chart | |
39 | \mainclass |
|
39 | \mainclass | |
40 |
|
40 | |||
41 | QBoxPlotSeries represents a series of data shown as bars. The purpose of this class is to draw bars |
|
41 | QBoxPlotSeries represents a series of data shown as bars. The purpose of this class is to draw bars | |
42 | as stacks, where bars in same category are stacked on top of each other. |
|
42 | as stacks, where bars in same category are stacked on top of each other. | |
43 | QBoxPlotSeries groups the data from sets to categories, which are defined by QStringList. |
|
43 | QBoxPlotSeries groups the data from sets to categories, which are defined by QStringList. | |
44 |
|
44 | |||
45 | See the \l {BoxPlotChart Example} {stacked bar chart example} to learn how to create a stacked bar chart. |
|
45 | See the \l {BoxPlotChart Example} {stacked bar chart example} to learn how to create a stacked bar chart. | |
46 | \image examples_boxplotchart.png |
|
46 | \image examples_boxplotchart.png | |
47 |
|
47 | |||
48 | \sa QBarSet, QPercentBarSeries, QAbstractBarSeries |
|
48 | \sa QBarSet, QPercentBarSeries, QAbstractBarSeries | |
49 | */ |
|
49 | */ | |
50 |
|
50 | |||
51 | /*! |
|
51 | /*! | |
52 | \qmlclass BoxPlotSeries QBoxPlotSeries |
|
52 | \qmlclass BoxPlotSeries QBoxPlotSeries | |
53 | \inherits AbstractBarSeries |
|
53 | \inherits AbstractBarSeries | |
54 |
|
54 | |||
55 | The following QML shows how to create a simple stacked bar chart: |
|
55 | The following QML shows how to create a simple stacked bar chart: | |
56 | \snippet ../demos/qmlchart/qml/qmlchart/View7.qml 1 |
|
56 | \snippet ../demos/qmlchart/qml/qmlchart/View7.qml 1 | |
57 | \beginfloatleft |
|
57 | \beginfloatleft | |
58 | \image demos_qmlchart7.png |
|
58 | \image demos_qmlchart7.png | |
59 | \endfloat |
|
59 | \endfloat | |
60 | \clearfloat |
|
60 | \clearfloat | |
61 | */ |
|
61 | */ | |
62 |
|
62 | |||
63 | /*! |
|
63 | /*! | |
64 | Constructs empty QBoxPlotSeries. |
|
64 | Constructs empty QBoxPlotSeries. | |
65 | QBoxPlotSeries is QObject which is a child of a \a parent. |
|
65 | QBoxPlotSeries is QObject which is a child of a \a parent. | |
66 | */ |
|
66 | */ | |
67 | QBoxPlotSeries::QBoxPlotSeries(QObject *parent) |
|
67 | QBoxPlotSeries::QBoxPlotSeries(QObject *parent) | |
68 | : QAbstractBarSeries(*new QBoxPlotSeriesPrivate(this), parent) |
|
68 | : QAbstractBarSeries(*new QBoxPlotSeriesPrivate(this), parent) | |
69 | { |
|
69 | { | |
70 | } |
|
70 | } | |
71 |
|
71 | |||
72 | /*! |
|
72 | /*! | |
73 | Destructor. Removes series from chart. |
|
73 | Destructor. Removes series from chart. | |
74 | */ |
|
74 | */ | |
75 | QBoxPlotSeries::~QBoxPlotSeries() |
|
75 | QBoxPlotSeries::~QBoxPlotSeries() | |
76 | { |
|
76 | { | |
77 | qDebug() << "QBoxPlotSeries::~QBoxPlotSeries"; |
|
77 | qDebug() << "QBoxPlotSeries::~QBoxPlotSeries"; | |
78 |
|
78 | |||
79 | Q_D(QBoxPlotSeries); |
|
79 | Q_D(QBoxPlotSeries); | |
80 | if (d->m_chart) |
|
80 | if (d->m_chart) | |
81 | d->m_chart->removeSeries(this); |
|
81 | d->m_chart->removeSeries(this); | |
82 | } |
|
82 | } | |
83 |
|
83 | |||
84 | /*! |
|
84 | /*! | |
85 | Returns QChartSeries::SeriesTypeBoxPlot. |
|
85 | Returns QChartSeries::SeriesTypeBoxPlot. | |
86 | */ |
|
86 | */ | |
87 | QAbstractSeries::SeriesType QBoxPlotSeries::type() const |
|
87 | QAbstractSeries::SeriesType QBoxPlotSeries::type() const | |
88 | { |
|
88 | { | |
89 | return QAbstractSeries::SeriesTypeBoxPlot; |
|
89 | return QAbstractSeries::SeriesTypeBoxPlot; | |
90 | } |
|
90 | } | |
91 |
|
91 | |||
92 | void QBoxPlotSeries::setBrush(const QBrush &brush) |
|
92 | void QBoxPlotSeries::setBrush(const QBrush &brush) | |
93 | { |
|
93 | { | |
94 | Q_D(QBoxPlotSeries); |
|
94 | Q_D(QBoxPlotSeries); | |
95 |
|
95 | |||
96 | if (d->m_brush != brush) { |
|
96 | if (d->m_brush != brush) { | |
97 | d->m_brush = brush; |
|
97 | d->m_brush = brush; | |
98 | emit d->updated(); |
|
98 | emit d->updated(); | |
99 | } |
|
99 | } | |
100 | } |
|
100 | } | |
101 |
|
101 | |||
102 | QBrush QBoxPlotSeries::brush() const |
|
102 | QBrush QBoxPlotSeries::brush() const | |
103 | { |
|
103 | { | |
104 | Q_D(const QBoxPlotSeries); |
|
104 | Q_D(const QBoxPlotSeries); | |
105 |
|
105 | |||
106 | return d->m_brush; |
|
106 | return d->m_brush; | |
107 | } |
|
107 | } | |
108 |
|
108 | |||
109 | void QBoxPlotSeries::setPen(const QPen &pen) |
|
109 | void QBoxPlotSeries::setPen(const QPen &pen) | |
110 | { |
|
110 | { | |
111 | Q_D(QBoxPlotSeries); |
|
111 | Q_D(QBoxPlotSeries); | |
112 |
|
112 | |||
113 | if (d->m_pen != pen) { |
|
113 | if (d->m_pen != pen) { | |
114 | d->m_pen = pen; |
|
114 | d->m_pen = pen; | |
115 | emit d->updated(); |
|
115 | emit d->updated(); | |
116 | } |
|
116 | } | |
117 | } |
|
117 | } | |
118 |
|
118 | |||
119 | QPen QBoxPlotSeries::pen() const |
|
119 | QPen QBoxPlotSeries::pen() const | |
120 | { |
|
120 | { | |
121 | Q_D(const QBoxPlotSeries); |
|
121 | Q_D(const QBoxPlotSeries); | |
122 |
|
122 | |||
123 | return d->m_pen; |
|
123 | return d->m_pen; | |
124 | } |
|
124 | } | |
125 |
|
125 | |||
126 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
126 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
127 |
|
127 | |||
128 | QBoxPlotSeriesPrivate::QBoxPlotSeriesPrivate(QBoxPlotSeries *q) |
|
128 | QBoxPlotSeriesPrivate::QBoxPlotSeriesPrivate(QBoxPlotSeries *q) | |
129 | : QAbstractBarSeriesPrivate(q), |
|
129 | : QAbstractBarSeriesPrivate(q), | |
130 | m_pen(QPen(Qt::NoPen)), |
|
130 | m_pen(QPen(Qt::NoPen)), | |
131 | m_brush(QBrush(Qt::NoBrush)) |
|
131 | m_brush(QBrush(Qt::NoBrush)) | |
132 | { |
|
132 | { | |
133 | } |
|
133 | } | |
134 |
|
134 | |||
135 | QBoxPlotSeriesPrivate::~QBoxPlotSeriesPrivate() |
|
135 | QBoxPlotSeriesPrivate::~QBoxPlotSeriesPrivate() | |
136 | { |
|
136 | { | |
137 | qDebug() << "QBoxPlotSeriesPrivate::~QBoxPlotSeriesPrivate()"; |
|
137 | qDebug() << "QBoxPlotSeriesPrivate::~QBoxPlotSeriesPrivate()"; | |
138 | disconnect(this, 0, 0, 0); |
|
138 | disconnect(this, 0, 0, 0); | |
139 | } |
|
139 | } | |
140 |
|
140 | |||
141 | void QBoxPlotSeriesPrivate::initializeDomain() |
|
141 | void QBoxPlotSeriesPrivate::initializeDomain() | |
142 | { |
|
142 | { | |
143 | qreal minX(domain()->minX()); |
|
143 | qreal minX(domain()->minX()); | |
144 | qreal minY(domain()->minY()); |
|
144 | qreal minY(domain()->minY()); | |
145 | qreal maxX(domain()->maxX()); |
|
145 | qreal maxX(domain()->maxX()); | |
146 | qreal maxY(domain()->maxY()); |
|
146 | qreal maxY(domain()->maxY()); | |
147 |
|
147 | |||
148 | qreal x = categoryCount(); |
|
148 | qreal x = categoryCount(); | |
149 | minX = qMin(minX, - (qreal)0.5); |
|
149 | minX = qMin(minX, - (qreal)0.5); | |
150 | minY = qMin(minY, bottom()); |
|
150 | minY = qMin(minY, bottom()); | |
151 | maxX = qMax(maxX, x - (qreal)0.5); |
|
151 | maxX = qMax(maxX, x - (qreal)0.5); | |
152 | //maxY = qMax(maxY, top()); |
|
152 | //maxY = qMax(maxY, top()); | |
153 | maxY = qMax(maxY, max()); |
|
153 | maxY = qMax(maxY, max()); | |
154 |
|
154 | |||
155 | domain()->setRange(minX, maxX, minY, maxY); |
|
155 | domain()->setRange(minX, maxX, minY, maxY); | |
156 | } |
|
156 | } | |
157 |
|
157 | |||
158 | void QBoxPlotSeriesPrivate::initializeGraphics(QGraphicsItem* parent) |
|
158 | void QBoxPlotSeriesPrivate::initializeGraphics(QGraphicsItem* parent) | |
159 | { |
|
159 | { | |
160 | Q_Q(QBoxPlotSeries); |
|
160 | Q_Q(QBoxPlotSeries); | |
161 |
|
161 | |||
162 | BoxPlotChartItem *boxPlot = new BoxPlotChartItem(q,parent); |
|
162 | BoxPlotChartItem *boxPlot = new BoxPlotChartItem(q,parent); | |
163 | m_item.reset(boxPlot); |
|
163 | m_item.reset(boxPlot); | |
164 | QAbstractSeriesPrivate::initializeGraphics(parent); |
|
164 | QAbstractSeriesPrivate::initializeGraphics(parent); | |
165 |
|
165 | |||
166 | if (m_chart) { |
|
166 | if (m_chart) { | |
167 | connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), this, SLOT(handleSeriesChange(QAbstractSeries*)) ); |
|
167 | connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), this, SLOT(handleSeriesChange(QAbstractSeries*)) ); | |
168 | connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), this, SLOT(handleSeriesRemove(QAbstractSeries*)) ); |
|
168 | connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), this, SLOT(handleSeriesRemove(QAbstractSeries*)) ); | |
169 |
|
169 | |||
170 | QList<QAbstractSeries *> serieses = m_chart->series(); |
|
170 | QList<QAbstractSeries *> serieses = m_chart->series(); | |
171 | boxPlot->m_seriesCount = serieses.count(); |
|
171 | boxPlot->m_seriesCount = serieses.count(); | |
172 |
|
172 | |||
173 | // Tries to find this series from the Chart's list of serieses and deduce the index |
|
173 | // Tries to find this series from the Chart's list of serieses and deduce the index | |
174 | int index = 0; |
|
174 | int index = 0; | |
175 | foreach (QAbstractSeries *s, serieses) { |
|
175 | foreach (QAbstractSeries *s, serieses) { | |
176 | if (q == static_cast<QBoxPlotSeries *>(s)) { |
|
176 | if (q == static_cast<QBoxPlotSeries *>(s)) { | |
177 | boxPlot->m_seriesIndex = index; |
|
177 | boxPlot->m_seriesIndex = index; | |
178 | m_index = index; |
|
178 | m_index = index; | |
179 | } |
|
179 | } | |
180 | index++; |
|
180 | index++; | |
181 | } |
|
181 | } | |
182 | } |
|
182 | } | |
183 |
|
183 | |||
184 | // Make BoxPlotChartItem to instantiate box & whisker items |
|
184 | // Make BoxPlotChartItem to instantiate box & whisker items | |
185 | boxPlot->handleDataStructureChanged(); |
|
185 | boxPlot->handleDataStructureChanged(); | |
186 | } |
|
186 | } | |
187 |
|
187 | |||
188 | void QBoxPlotSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced) |
|
188 | void QBoxPlotSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced) | |
189 | { |
|
189 | { | |
190 | Q_Q(QBoxPlotSeries); |
|
190 | Q_Q(QBoxPlotSeries); | |
|
191 | qDebug() << "QBoxPlotSeriesPrivate::initializeTheme"; | |||
191 |
|
192 | |||
192 | const QList<QGradient> gradients = theme->seriesGradients(); |
|
193 | const QList<QGradient> gradients = theme->seriesGradients(); | |
193 |
|
194 | |||
194 | if (forced || m_brush == QBrush(Qt::NoBrush)) { |
|
195 | if (forced || m_brush == QBrush(Qt::NoBrush)) { | |
195 |
QColor brushColor = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0. |
|
196 | QColor brushColor = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.5); | |
196 | q->setBrush(brushColor); |
|
197 | q->setBrush(brushColor); | |
197 | } |
|
198 | } | |
198 |
|
199 | |||
199 | if (forced || m_pen == QPen(Qt::NoPen)) { |
|
200 | if (forced || m_pen == QPen(Qt::NoPen)) { | |
200 | QPen pen; |
|
201 | QPen pen = theme->outlinePen(); | |
201 | pen.setColor(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 1.0)); |
|
|||
202 | pen.setWidthF(1.0); |
|
|||
203 | pen.setCosmetic(true); |
|
202 | pen.setCosmetic(true); | |
|
203 | ||||
|
204 | // QPen pen; | |||
|
205 | // pen.setColor(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 1.0)); | |||
|
206 | // pen.setWidthF(2.0); | |||
|
207 | // pen.setCosmetic(true); | |||
|
208 | ||||
204 | q->setPen(pen); |
|
209 | q->setPen(pen); | |
205 | } |
|
210 | } | |
206 | } |
|
211 | } | |
207 |
|
212 | |||
208 | void QBoxPlotSeriesPrivate::initializeAnimations(QtCommercialChart::QChart::AnimationOptions options) |
|
213 | void QBoxPlotSeriesPrivate::initializeAnimations(QtCommercialChart::QChart::AnimationOptions options) | |
209 | { |
|
214 | { | |
210 | BoxPlotChartItem *item = static_cast<BoxPlotChartItem *>(m_item.data()); |
|
215 | BoxPlotChartItem *item = static_cast<BoxPlotChartItem *>(m_item.data()); | |
211 | Q_ASSERT(item); |
|
216 | Q_ASSERT(item); | |
212 | if (options.testFlag(QChart::SeriesAnimations)) { |
|
217 | if (options.testFlag(QChart::SeriesAnimations)) { | |
213 | item->setAnimation(new BoxPlotAnimation(item)); |
|
218 | item->setAnimation(new BoxPlotAnimation(item)); | |
214 | }else{ |
|
219 | }else{ | |
215 | item->setAnimation((BoxPlotAnimation *)0); |
|
220 | item->setAnimation((BoxPlotAnimation *)0); | |
216 | } |
|
221 | } | |
217 | QAbstractSeriesPrivate::initializeAnimations(options); |
|
222 | QAbstractSeriesPrivate::initializeAnimations(options); | |
218 | } |
|
223 | } | |
219 |
|
224 | |||
220 | QList<QLegendMarker*> QBoxPlotSeriesPrivate::createLegendMarkers(QLegend *legend) |
|
225 | QList<QLegendMarker*> QBoxPlotSeriesPrivate::createLegendMarkers(QLegend *legend) | |
221 | { |
|
226 | { | |
222 | Q_Q(QBoxPlotSeries); |
|
227 | Q_Q(QBoxPlotSeries); | |
223 | QList<QLegendMarker*> list; |
|
228 | QList<QLegendMarker*> list; | |
224 | return list << new QBoxPlotLegendMarker(q, legend); |
|
229 | return list << new QBoxPlotLegendMarker(q, legend); | |
225 | } |
|
230 | } | |
226 |
|
231 | |||
227 | void QBoxPlotSeriesPrivate::handleSeriesRemove(QAbstractSeries *series) |
|
232 | void QBoxPlotSeriesPrivate::handleSeriesRemove(QAbstractSeries *series) | |
228 | { |
|
233 | { | |
229 | qDebug() << "QBoxPlotSeriesPrivate::handleSeriesRemove"; |
|
234 | qDebug() << "QBoxPlotSeriesPrivate::handleSeriesRemove"; | |
230 | Q_Q(QBoxPlotSeries); |
|
235 | Q_Q(QBoxPlotSeries); | |
231 |
|
236 | |||
232 | QBoxPlotSeries *removedSeries = static_cast<QBoxPlotSeries *>(series); |
|
237 | QBoxPlotSeries *removedSeries = static_cast<QBoxPlotSeries *>(series); | |
233 | QObject::disconnect(m_chart->d_ptr->m_dataset, 0, removedSeries->d_func(), 0); |
|
238 | QObject::disconnect(m_chart->d_ptr->m_dataset, 0, removedSeries->d_func(), 0); | |
234 |
|
239 | |||
235 | // Test if series removed is me, then don't do anything |
|
240 | // Test if series removed is me, then don't do anything | |
236 | if (q != removedSeries) { |
|
241 | if (q != removedSeries) { | |
237 | BoxPlotChartItem *item = static_cast<BoxPlotChartItem *>(m_item.data()); |
|
242 | BoxPlotChartItem *item = static_cast<BoxPlotChartItem *>(m_item.data()); | |
238 | if (item) { |
|
243 | if (item) { | |
239 | item->m_seriesCount = item->m_seriesCount - 1; |
|
244 | item->m_seriesCount = item->m_seriesCount - 1; | |
240 | if (removedSeries->d_func()->m_index < m_index) { |
|
245 | if (removedSeries->d_func()->m_index < m_index) { | |
241 | m_index--; |
|
246 | m_index--; | |
242 | item->m_seriesIndex = m_index; |
|
247 | item->m_seriesIndex = m_index; | |
243 | } |
|
248 | } | |
244 |
|
249 | |||
245 | item->handleDataStructureChanged(); |
|
250 | item->handleDataStructureChanged(); | |
246 | } |
|
251 | } | |
247 | } |
|
252 | } | |
248 | } |
|
253 | } | |
249 |
|
254 | |||
250 | void QBoxPlotSeriesPrivate::handleSeriesChange(QAbstractSeries *series) |
|
255 | void QBoxPlotSeriesPrivate::handleSeriesChange(QAbstractSeries *series) | |
251 | { |
|
256 | { | |
252 | Q_UNUSED(series); |
|
257 | Q_UNUSED(series); | |
253 |
|
258 | |||
254 | Q_Q(QBoxPlotSeries); |
|
259 | Q_Q(QBoxPlotSeries); | |
255 |
|
260 | |||
256 | BoxPlotChartItem *boxPlot = static_cast<BoxPlotChartItem *>(m_item.data()); |
|
261 | BoxPlotChartItem *boxPlot = static_cast<BoxPlotChartItem *>(m_item.data()); | |
257 |
|
262 | |||
258 | if (m_chart) { |
|
263 | if (m_chart) { | |
259 | QList<QAbstractSeries *> serieses = m_chart->series(); |
|
264 | QList<QAbstractSeries *> serieses = m_chart->series(); | |
260 | boxPlot->m_seriesCount = serieses.count(); |
|
265 | boxPlot->m_seriesCount = serieses.count(); | |
261 |
|
266 | |||
262 | // Tries to find this series from the Chart's list of serieses and deduce the index |
|
267 | // Tries to find this series from the Chart's list of serieses and deduce the index | |
263 | int index = 0; |
|
268 | int index = 0; | |
264 | foreach (QAbstractSeries *s, serieses) { |
|
269 | foreach (QAbstractSeries *s, serieses) { | |
265 | if (q == static_cast<QBoxPlotSeries *>(s)) { |
|
270 | if (q == static_cast<QBoxPlotSeries *>(s)) { | |
266 | boxPlot->m_seriesIndex = index; |
|
271 | boxPlot->m_seriesIndex = index; | |
267 | m_index = index; |
|
272 | m_index = index; | |
268 | } |
|
273 | } | |
269 | index++; |
|
274 | index++; | |
270 | } |
|
275 | } | |
271 | } |
|
276 | } | |
272 |
|
277 | |||
273 | boxPlot->handleDataStructureChanged(); |
|
278 | boxPlot->handleDataStructureChanged(); | |
274 | } |
|
279 | } | |
275 |
|
280 | |||
276 | #include "moc_qboxplotseries.cpp" |
|
281 | #include "moc_qboxplotseries.cpp" | |
277 | #include "moc_qboxplotseries_p.cpp" |
|
282 | #include "moc_qboxplotseries_p.cpp" | |
278 |
|
283 | |||
279 | QTCOMMERCIALCHART_END_NAMESPACE |
|
284 | QTCOMMERCIALCHART_END_NAMESPACE | |
280 |
|
285 |
@@ -1,57 +1,55 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 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 | #ifndef QBOXPLOTSERIES_H |
|
21 | #ifndef QBOXPLOTSERIES_H | |
22 | #define QBOXPLOTSERIES_H |
|
22 | #define QBOXPLOTSERIES_H | |
23 |
|
23 | |||
24 | #include <qchartglobal.h> |
|
24 | #include <qchartglobal.h> | |
25 | #include <qabstractbarseries.h> |
|
25 | #include <qabstractbarseries.h> | |
26 |
|
26 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
28 | |||
29 | class QBoxPlotSeriesPrivate; |
|
29 | class QBoxPlotSeriesPrivate; | |
30 | //class QBarSet; |
|
30 | //class QBarSet; | |
31 |
|
31 | |||
32 | class QTCOMMERCIALCHART_EXPORT QBoxPlotSeries : public QAbstractBarSeries |
|
32 | class QTCOMMERCIALCHART_EXPORT QBoxPlotSeries : public QAbstractBarSeries | |
33 | { |
|
33 | { | |
34 | Q_OBJECT |
|
34 | Q_OBJECT | |
35 | public: |
|
35 | public: | |
36 | explicit QBoxPlotSeries(QObject *parent = 0); |
|
36 | explicit QBoxPlotSeries(QObject *parent = 0); | |
37 | ~QBoxPlotSeries(); |
|
37 | ~QBoxPlotSeries(); | |
38 |
|
38 | |||
39 | QAbstractSeries::SeriesType type() const; |
|
39 | QAbstractSeries::SeriesType type() const; | |
40 |
|
40 | |||
41 | void mika(); |
|
|||
42 |
|
||||
43 | void setBrush(const QBrush &brush); |
|
41 | void setBrush(const QBrush &brush); | |
44 | QBrush brush() const; |
|
42 | QBrush brush() const; | |
45 | void setPen(const QPen &pen); |
|
43 | void setPen(const QPen &pen); | |
46 | QPen pen() const; |
|
44 | QPen pen() const; | |
47 |
|
45 | |||
48 | private: |
|
46 | private: | |
49 | Q_DECLARE_PRIVATE(QBoxPlotSeries) |
|
47 | Q_DECLARE_PRIVATE(QBoxPlotSeries) | |
50 | Q_DISABLE_COPY(QBoxPlotSeries) |
|
48 | Q_DISABLE_COPY(QBoxPlotSeries) | |
51 | friend class BoxPlotChartItem; |
|
49 | friend class BoxPlotChartItem; | |
52 | friend class QBoxPlotLegendMarkerPrivate; |
|
50 | friend class QBoxPlotLegendMarkerPrivate; | |
53 | }; |
|
51 | }; | |
54 |
|
52 | |||
55 | QTCOMMERCIALCHART_END_NAMESPACE |
|
53 | QTCOMMERCIALCHART_END_NAMESPACE | |
56 |
|
54 | |||
57 | #endif // QBOXPLOTSERIES_H |
|
55 | #endif // QBOXPLOTSERIES_H |
@@ -1,89 +1,91 | |||||
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 CHARTTHEME_H |
|
30 | #ifndef CHARTTHEME_H | |
31 | #define CHARTTHEME_H |
|
31 | #define CHARTTHEME_H | |
32 |
|
32 | |||
33 | #include "chartthememanager_p.h" |
|
33 | #include "chartthememanager_p.h" | |
34 | #include <QColor> |
|
34 | #include <QColor> | |
35 | #include <QGradientStops> |
|
35 | #include <QGradientStops> | |
36 |
|
36 | |||
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
38 |
|
38 | |||
39 | class ChartTheme |
|
39 | class ChartTheme | |
40 | { |
|
40 | { | |
41 |
|
41 | |||
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 | protected: |
|
50 | protected: | |
51 | explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeLight):m_id(id), |
|
51 | explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeLight):m_id(id), | |
52 | m_backgroundShades(BackgroundShadesNone), |
|
52 | m_backgroundShades(BackgroundShadesNone), | |
53 | m_backgroundDropShadowEnabled(false){}; |
|
53 | m_backgroundDropShadowEnabled(false){}; | |
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 | QBrush backgroundShadesBrush() const { return m_backgroundShadesBrush; } |
|
65 | QBrush backgroundShadesBrush() const { return m_backgroundShadesBrush; } | |
65 | BackgroundShadesMode backgroundShades() const { return m_backgroundShades; } |
|
66 | BackgroundShadesMode backgroundShades() const { return m_backgroundShades; } | |
66 | bool isBackgroundDropShadowEnabled() const { return m_backgroundDropShadowEnabled; } |
|
67 | bool isBackgroundDropShadowEnabled() const { return m_backgroundDropShadowEnabled; } | |
67 | QPen girdLinePen() const { return m_gridLinePen; } |
|
68 | QPen girdLinePen() const { return m_gridLinePen; } | |
68 |
|
69 | |||
69 | protected: |
|
70 | protected: | |
70 | QChart::ChartTheme m_id; |
|
71 | QChart::ChartTheme m_id; | |
71 | QList<QColor> m_seriesColors; |
|
72 | QList<QColor> m_seriesColors; | |
72 | QList<QGradient> m_seriesGradients; |
|
73 | QList<QGradient> m_seriesGradients; | |
73 | QLinearGradient m_chartBackgroundGradient; |
|
74 | QLinearGradient m_chartBackgroundGradient; | |
74 |
|
75 | |||
75 | QFont m_masterFont; |
|
76 | QFont m_masterFont; | |
76 | QFont m_labelFont; |
|
77 | QFont m_labelFont; | |
77 | QBrush m_labelBrush; |
|
78 | QBrush m_labelBrush; | |
78 | QPen m_axisLinePen; |
|
79 | QPen m_axisLinePen; | |
79 | QPen m_backgroundShadesPen; |
|
80 | QPen m_backgroundShadesPen; | |
|
81 | QPen m_outlinePen; | |||
80 | QBrush m_backgroundShadesBrush; |
|
82 | QBrush m_backgroundShadesBrush; | |
81 | BackgroundShadesMode m_backgroundShades; |
|
83 | BackgroundShadesMode m_backgroundShades; | |
82 | bool m_backgroundDropShadowEnabled; |
|
84 | bool m_backgroundDropShadowEnabled; | |
83 | QPen m_gridLinePen; |
|
85 | QPen m_gridLinePen; | |
84 |
|
86 | |||
85 | }; |
|
87 | }; | |
86 |
|
88 | |||
87 | QTCOMMERCIALCHART_END_NAMESPACE |
|
89 | QTCOMMERCIALCHART_END_NAMESPACE | |
88 |
|
90 | |||
89 | #endif // CHARTTHEME_H |
|
91 | #endif // CHARTTHEME_H |
@@ -1,68 +1,70 | |||||
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 CHARTTHEMEBLUECERULEAN_P_H |
|
30 | #ifndef CHARTTHEMEBLUECERULEAN_P_H | |
31 | #define CHARTTHEMEBLUECERULEAN_P_H |
|
31 | #define CHARTTHEMEBLUECERULEAN_P_H | |
32 |
|
32 | |||
33 | #include "charttheme_p.h" |
|
33 | #include "charttheme_p.h" | |
34 |
|
34 | |||
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
36 |
|
36 | |||
37 | class ChartThemeBlueCerulean: public ChartTheme |
|
37 | class ChartThemeBlueCerulean: public ChartTheme | |
38 | { |
|
38 | { | |
39 | public: |
|
39 | public: | |
40 | ChartThemeBlueCerulean() : ChartTheme(QChart::ChartThemeBlueCerulean) { |
|
40 | ChartThemeBlueCerulean() : ChartTheme(QChart::ChartThemeBlueCerulean) { | |
41 | // Series colors |
|
41 | // Series colors | |
42 | m_seriesColors << QRgb(0xc7e85b); |
|
42 | m_seriesColors << QRgb(0xc7e85b); | |
43 | m_seriesColors << QRgb(0x1cb54f); |
|
43 | m_seriesColors << QRgb(0x1cb54f); | |
44 | m_seriesColors << QRgb(0x5cbf9b); |
|
44 | m_seriesColors << QRgb(0x5cbf9b); | |
45 | m_seriesColors << QRgb(0x009fbf); |
|
45 | m_seriesColors << QRgb(0x009fbf); | |
46 | m_seriesColors << QRgb(0xee7392); |
|
46 | m_seriesColors << QRgb(0xee7392); | |
47 | m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors); |
|
47 | m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors); | |
48 |
|
48 | |||
49 | // Background |
|
49 | // Background | |
50 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); |
|
50 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); | |
51 | backgroundGradient.setColorAt(0.0, QRgb(0x056189)); |
|
51 | backgroundGradient.setColorAt(0.0, QRgb(0x056189)); | |
52 | backgroundGradient.setColorAt(1.0, QRgb(0x101a31)); |
|
52 | backgroundGradient.setColorAt(1.0, QRgb(0x101a31)); | |
53 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
53 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
54 | m_chartBackgroundGradient = backgroundGradient; |
|
54 | m_chartBackgroundGradient = backgroundGradient; | |
55 |
|
55 | |||
56 | // Axes and other |
|
56 | // Axes and other | |
57 | m_labelBrush = QBrush(QRgb(0xffffff)); |
|
57 | m_labelBrush = QBrush(QRgb(0xffffff)); | |
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(0x84a2b0)); |
|
60 | m_gridLinePen = QPen(QRgb(0x84a2b0)); | |
61 | m_gridLinePen.setWidth(1); |
|
61 | m_gridLinePen.setWidth(1); | |
62 | m_backgroundShades = BackgroundShadesNone; |
|
62 | m_backgroundShades = BackgroundShadesNone; | |
|
63 | m_outlinePen = QPen(QRgb(0xd6d6d6)); | |||
|
64 | m_outlinePen.setWidthF(2.0); | |||
63 | } |
|
65 | } | |
64 | }; |
|
66 | }; | |
65 |
|
67 | |||
66 | QTCOMMERCIALCHART_END_NAMESPACE |
|
68 | QTCOMMERCIALCHART_END_NAMESPACE | |
67 |
|
69 | |||
68 | #endif |
|
70 | #endif |
@@ -1,70 +1,72 | |||||
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 CHARTTHEMEBLUEICY_P_H |
|
30 | #ifndef CHARTTHEMEBLUEICY_P_H | |
31 | #define CHARTTHEMEBLUEICY_P_H |
|
31 | #define CHARTTHEMEBLUEICY_P_H | |
32 |
|
32 | |||
33 | #include "charttheme_p.h" |
|
33 | #include "charttheme_p.h" | |
34 |
|
34 | |||
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
36 |
|
36 | |||
37 | class ChartThemeBlueIcy: public ChartTheme |
|
37 | class ChartThemeBlueIcy: public ChartTheme | |
38 | { |
|
38 | { | |
39 | public: |
|
39 | public: | |
40 | ChartThemeBlueIcy() : ChartTheme(QChart::ChartThemeBlueIcy) |
|
40 | ChartThemeBlueIcy() : ChartTheme(QChart::ChartThemeBlueIcy) | |
41 | { |
|
41 | { | |
42 | // Series colors |
|
42 | // Series colors | |
43 | m_seriesColors << QRgb(0x3daeda); |
|
43 | m_seriesColors << QRgb(0x3daeda); | |
44 | m_seriesColors << QRgb(0x2685bf); |
|
44 | m_seriesColors << QRgb(0x2685bf); | |
45 | m_seriesColors << QRgb(0x0c2673); |
|
45 | m_seriesColors << QRgb(0x0c2673); | |
46 | m_seriesColors << QRgb(0x5f3dba); |
|
46 | m_seriesColors << QRgb(0x5f3dba); | |
47 | m_seriesColors << QRgb(0x2fa3b4); |
|
47 | m_seriesColors << QRgb(0x2fa3b4); | |
48 | m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors); |
|
48 | m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors); | |
49 |
|
49 | |||
50 | // Background |
|
50 | // Background | |
51 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); |
|
51 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); | |
52 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
52 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); | |
53 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
53 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); | |
54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
55 | m_chartBackgroundGradient = backgroundGradient; |
|
55 | m_chartBackgroundGradient = backgroundGradient; | |
56 | m_backgroundDropShadowEnabled = true; |
|
56 | m_backgroundDropShadowEnabled = true; | |
57 |
|
57 | |||
58 | // Axes and other |
|
58 | // Axes and other | |
59 | m_labelBrush = QBrush(QRgb(0x404044)); |
|
59 | m_labelBrush = QBrush(QRgb(0x404044)); | |
60 | m_axisLinePen = QPen(QRgb(0xd6d6d6)); |
|
60 | m_axisLinePen = QPen(QRgb(0xd6d6d6)); | |
61 | m_axisLinePen.setWidth(2); |
|
61 | m_axisLinePen.setWidth(2); | |
62 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
62 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); | |
63 | m_gridLinePen.setWidth(1); |
|
63 | m_gridLinePen.setWidth(1); | |
64 | m_backgroundShades = BackgroundShadesNone; |
|
64 | m_backgroundShades = BackgroundShadesNone; | |
|
65 | m_outlinePen = QPen(QColor(Qt::black)); | |||
|
66 | m_outlinePen.setWidthF(2.0); | |||
65 | } |
|
67 | } | |
66 | }; |
|
68 | }; | |
67 |
|
69 | |||
68 | QTCOMMERCIALCHART_END_NAMESPACE |
|
70 | QTCOMMERCIALCHART_END_NAMESPACE | |
69 |
|
71 | |||
70 | #endif |
|
72 | #endif |
@@ -1,69 +1,71 | |||||
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 CHARTTHEMEBLUENCS_P_H |
|
30 | #ifndef CHARTTHEMEBLUENCS_P_H | |
31 | #define CHARTTHEMEBLUENCS_P_H |
|
31 | #define CHARTTHEMEBLUENCS_P_H | |
32 |
|
32 | |||
33 | #include "charttheme_p.h" |
|
33 | #include "charttheme_p.h" | |
34 |
|
34 | |||
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
36 |
|
36 | |||
37 | class ChartThemeBlueNcs: public ChartTheme |
|
37 | class ChartThemeBlueNcs: public ChartTheme | |
38 | { |
|
38 | { | |
39 | public: |
|
39 | public: | |
40 | ChartThemeBlueNcs() : ChartTheme(QChart::ChartThemeBlueNcs) |
|
40 | ChartThemeBlueNcs() : ChartTheme(QChart::ChartThemeBlueNcs) | |
41 | { |
|
41 | { | |
42 | // Series colors |
|
42 | // Series colors | |
43 | m_seriesColors << QRgb(0x1db0da); |
|
43 | m_seriesColors << QRgb(0x1db0da); | |
44 | m_seriesColors << QRgb(0x1341a6); |
|
44 | m_seriesColors << QRgb(0x1341a6); | |
45 | m_seriesColors << QRgb(0x88d41e); |
|
45 | m_seriesColors << QRgb(0x88d41e); | |
46 | m_seriesColors << QRgb(0xff8e1a); |
|
46 | m_seriesColors << QRgb(0xff8e1a); | |
47 | m_seriesColors << QRgb(0x398ca3); |
|
47 | m_seriesColors << QRgb(0x398ca3); | |
48 | m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors); |
|
48 | m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors); | |
49 |
|
49 | |||
50 | // Background |
|
50 | // Background | |
51 | QLinearGradient backgroundGradient; |
|
51 | QLinearGradient backgroundGradient; | |
52 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
52 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); | |
53 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
53 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); | |
54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
55 | m_chartBackgroundGradient = backgroundGradient; |
|
55 | m_chartBackgroundGradient = backgroundGradient; | |
56 |
|
56 | |||
57 | // Axes and other |
|
57 | // Axes and other | |
58 | m_labelBrush = QBrush(QRgb(0x404044)); |
|
58 | m_labelBrush = QBrush(QRgb(0x404044)); | |
59 | m_axisLinePen = QPen(QRgb(0xd6d6d6)); |
|
59 | m_axisLinePen = QPen(QRgb(0xd6d6d6)); | |
60 | m_axisLinePen.setWidth(2); |
|
60 | m_axisLinePen.setWidth(2); | |
61 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
61 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); | |
62 | m_gridLinePen.setWidth(1); |
|
62 | m_gridLinePen.setWidth(1); | |
63 | m_backgroundShades = BackgroundShadesNone; |
|
63 | m_backgroundShades = BackgroundShadesNone; | |
|
64 | m_outlinePen = QPen(QColor(Qt::black)); | |||
|
65 | m_outlinePen.setWidthF(2.0); | |||
64 | } |
|
66 | } | |
65 | }; |
|
67 | }; | |
66 |
|
68 | |||
67 | QTCOMMERCIALCHART_END_NAMESPACE |
|
69 | QTCOMMERCIALCHART_END_NAMESPACE | |
68 |
|
70 | |||
69 | #endif |
|
71 | #endif |
@@ -1,69 +1,71 | |||||
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 CHARTTHEMEBROWNSAND_P_H |
|
30 | #ifndef CHARTTHEMEBROWNSAND_P_H | |
31 | #define CHARTTHEMEBROWNSAND_P_H |
|
31 | #define CHARTTHEMEBROWNSAND_P_H | |
32 |
|
32 | |||
33 | #include "charttheme_p.h" |
|
33 | #include "charttheme_p.h" | |
34 |
|
34 | |||
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
36 |
|
36 | |||
37 | class ChartThemeBrownSand: public ChartTheme |
|
37 | class ChartThemeBrownSand: public ChartTheme | |
38 | { |
|
38 | { | |
39 | public: |
|
39 | public: | |
40 | ChartThemeBrownSand() : ChartTheme(QChart::ChartThemeBrownSand) |
|
40 | ChartThemeBrownSand() : ChartTheme(QChart::ChartThemeBrownSand) | |
41 | { |
|
41 | { | |
42 | // Series colors |
|
42 | // Series colors | |
43 | m_seriesColors << QRgb(0xb39b72); |
|
43 | m_seriesColors << QRgb(0xb39b72); | |
44 | m_seriesColors << QRgb(0xb3b376); |
|
44 | m_seriesColors << QRgb(0xb3b376); | |
45 | m_seriesColors << QRgb(0xc35660); |
|
45 | m_seriesColors << QRgb(0xc35660); | |
46 | m_seriesColors << QRgb(0x536780); |
|
46 | m_seriesColors << QRgb(0x536780); | |
47 | m_seriesColors << QRgb(0x494345); |
|
47 | m_seriesColors << QRgb(0x494345); | |
48 | m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors); |
|
48 | m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors); | |
49 |
|
49 | |||
50 | // Background |
|
50 | // Background | |
51 | QLinearGradient backgroundGradient; |
|
51 | QLinearGradient backgroundGradient; | |
52 | backgroundGradient.setColorAt(0.0, QRgb(0xf3ece0)); |
|
52 | backgroundGradient.setColorAt(0.0, QRgb(0xf3ece0)); | |
53 | backgroundGradient.setColorAt(1.0, QRgb(0xf3ece0)); |
|
53 | backgroundGradient.setColorAt(1.0, QRgb(0xf3ece0)); | |
54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
55 | m_chartBackgroundGradient = backgroundGradient; |
|
55 | m_chartBackgroundGradient = backgroundGradient; | |
56 |
|
56 | |||
57 | // Axes and other |
|
57 | // Axes and other | |
58 | m_labelBrush = QBrush(QRgb(0x404044)); |
|
58 | m_labelBrush = QBrush(QRgb(0x404044)); | |
59 | m_axisLinePen = QPen(QRgb(0xb5b0a7)); |
|
59 | m_axisLinePen = QPen(QRgb(0xb5b0a7)); | |
60 | m_axisLinePen.setWidth(2); |
|
60 | m_axisLinePen.setWidth(2); | |
61 | m_gridLinePen = QPen(QRgb(0xd4cec3)); |
|
61 | m_gridLinePen = QPen(QRgb(0xd4cec3)); | |
62 | m_gridLinePen.setWidth(1); |
|
62 | m_gridLinePen.setWidth(1); | |
63 | m_backgroundShades = BackgroundShadesNone; |
|
63 | m_backgroundShades = BackgroundShadesNone; | |
|
64 | m_outlinePen = QPen(QColor(Qt::black)); | |||
|
65 | m_outlinePen.setWidthF(2.0); | |||
64 | } |
|
66 | } | |
65 | }; |
|
67 | }; | |
66 |
|
68 | |||
67 | QTCOMMERCIALCHART_END_NAMESPACE |
|
69 | QTCOMMERCIALCHART_END_NAMESPACE | |
68 |
|
70 | |||
69 | #endif |
|
71 | #endif |
@@ -1,69 +1,71 | |||||
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 CHARTTHEMEDARK_P_H |
|
30 | #ifndef CHARTTHEMEDARK_P_H | |
31 | #define CHARTTHEMEDARK_P_H |
|
31 | #define CHARTTHEMEDARK_P_H | |
32 |
|
32 | |||
33 | #include "charttheme_p.h" |
|
33 | #include "charttheme_p.h" | |
34 |
|
34 | |||
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
36 |
|
36 | |||
37 | class ChartThemeDark : public ChartTheme |
|
37 | class ChartThemeDark : public ChartTheme | |
38 | { |
|
38 | { | |
39 | public: |
|
39 | public: | |
40 | ChartThemeDark() : ChartTheme(QChart::ChartThemeDark) |
|
40 | ChartThemeDark() : ChartTheme(QChart::ChartThemeDark) | |
41 | { |
|
41 | { | |
42 | // Series colors |
|
42 | // Series colors | |
43 | m_seriesColors << QRgb(0x38ad6b); |
|
43 | m_seriesColors << QRgb(0x38ad6b); | |
44 | m_seriesColors << QRgb(0x3c84a7); |
|
44 | m_seriesColors << QRgb(0x3c84a7); | |
45 | m_seriesColors << QRgb(0xeb8817); |
|
45 | m_seriesColors << QRgb(0xeb8817); | |
46 | m_seriesColors << QRgb(0x7b7f8c); |
|
46 | m_seriesColors << QRgb(0x7b7f8c); | |
47 | m_seriesColors << QRgb(0xbf593e); |
|
47 | m_seriesColors << QRgb(0xbf593e); | |
48 | m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors); |
|
48 | m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors); | |
49 |
|
49 | |||
50 | // Background |
|
50 | // Background | |
51 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); |
|
51 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); | |
52 | backgroundGradient.setColorAt(0.0, QRgb(0x2e303a)); |
|
52 | backgroundGradient.setColorAt(0.0, QRgb(0x2e303a)); | |
53 | backgroundGradient.setColorAt(1.0, QRgb(0x121218)); |
|
53 | backgroundGradient.setColorAt(1.0, QRgb(0x121218)); | |
54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
55 | m_chartBackgroundGradient = backgroundGradient; |
|
55 | m_chartBackgroundGradient = backgroundGradient; | |
56 |
|
56 | |||
57 | // Axes and other |
|
57 | // Axes and other | |
58 | m_labelBrush = QBrush(QRgb(0xffffff)); |
|
58 | m_labelBrush = QBrush(QRgb(0xffffff)); | |
59 | m_axisLinePen = QPen(QRgb(0x86878c)); |
|
59 | m_axisLinePen = QPen(QRgb(0x86878c)); | |
60 | m_axisLinePen.setWidth(2); |
|
60 | m_axisLinePen.setWidth(2); | |
61 | m_gridLinePen = QPen(QRgb(0x86878c)); |
|
61 | m_gridLinePen = QPen(QRgb(0x86878c)); | |
62 | m_gridLinePen.setWidth(1); |
|
62 | m_gridLinePen.setWidth(1); | |
63 | m_backgroundShades = BackgroundShadesNone; |
|
63 | m_backgroundShades = BackgroundShadesNone; | |
|
64 | m_outlinePen = QPen(QRgb(0xd6d6d6)); | |||
|
65 | m_outlinePen.setWidthF(1.0); | |||
64 | } |
|
66 | } | |
65 | }; |
|
67 | }; | |
66 |
|
68 | |||
67 | QTCOMMERCIALCHART_END_NAMESPACE |
|
69 | QTCOMMERCIALCHART_END_NAMESPACE | |
68 |
|
70 | |||
69 | #endif |
|
71 | #endif |
@@ -1,71 +1,73 | |||||
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 CHARTTHEMEHIGHCONTRAST_P_H |
|
30 | #ifndef CHARTTHEMEHIGHCONTRAST_P_H | |
31 | #define CHARTTHEMEHIGHCONTRAST_P_H |
|
31 | #define CHARTTHEMEHIGHCONTRAST_P_H | |
32 |
|
32 | |||
33 | #include "charttheme_p.h" |
|
33 | #include "charttheme_p.h" | |
34 |
|
34 | |||
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
36 |
|
36 | |||
37 | class ChartThemeHighContrast : public ChartTheme |
|
37 | class ChartThemeHighContrast : public ChartTheme | |
38 | { |
|
38 | { | |
39 | public: |
|
39 | public: | |
40 | ChartThemeHighContrast() : ChartTheme(QChart::ChartThemeHighContrast) |
|
40 | ChartThemeHighContrast() : ChartTheme(QChart::ChartThemeHighContrast) | |
41 | { |
|
41 | { | |
42 | // Series colors |
|
42 | // Series colors | |
43 | m_seriesColors << QRgb(0x202020); |
|
43 | m_seriesColors << QRgb(0x202020); | |
44 | m_seriesColors << QRgb(0x596a74); |
|
44 | m_seriesColors << QRgb(0x596a74); | |
45 | m_seriesColors << QRgb(0xffab03); |
|
45 | m_seriesColors << QRgb(0xffab03); | |
46 | m_seriesColors << QRgb(0x038e9b); |
|
46 | m_seriesColors << QRgb(0x038e9b); | |
47 | m_seriesColors << QRgb(0xff4a41); |
|
47 | m_seriesColors << QRgb(0xff4a41); | |
48 | m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors); |
|
48 | m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors); | |
49 |
|
49 | |||
50 | // Background |
|
50 | // Background | |
51 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); |
|
51 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); | |
52 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
52 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); | |
53 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
53 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); | |
54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
55 | m_chartBackgroundGradient = backgroundGradient; |
|
55 | m_chartBackgroundGradient = backgroundGradient; | |
56 | m_backgroundDropShadowEnabled = true; |
|
56 | m_backgroundDropShadowEnabled = true; | |
57 |
|
57 | |||
58 | // Axes and other |
|
58 | // Axes and other | |
59 | m_labelBrush = QBrush(QRgb(0x181818)); |
|
59 | m_labelBrush = QBrush(QRgb(0x181818)); | |
60 | m_axisLinePen = QPen(QRgb(0x8c8c8c)); |
|
60 | m_axisLinePen = QPen(QRgb(0x8c8c8c)); | |
61 | m_axisLinePen.setWidth(2); |
|
61 | m_axisLinePen.setWidth(2); | |
62 | m_gridLinePen = QPen(QRgb(0x8c8c8c)); |
|
62 | m_gridLinePen = QPen(QRgb(0x8c8c8c)); | |
63 | m_gridLinePen.setWidth(1); |
|
63 | m_gridLinePen.setWidth(1); | |
64 | m_backgroundShadesBrush = QBrush(QRgb(0xffeecd)); |
|
64 | m_backgroundShadesBrush = QBrush(QRgb(0xffeecd)); | |
65 | m_backgroundShades = BackgroundShadesHorizontal; |
|
65 | m_backgroundShades = BackgroundShadesHorizontal; | |
|
66 | m_outlinePen = QPen(QColor(Qt::black)); | |||
|
67 | m_outlinePen.setWidthF(1.0); | |||
66 | } |
|
68 | } | |
67 | }; |
|
69 | }; | |
68 |
|
70 | |||
69 | QTCOMMERCIALCHART_END_NAMESPACE |
|
71 | QTCOMMERCIALCHART_END_NAMESPACE | |
70 |
|
72 | |||
71 | #endif |
|
73 | #endif |
@@ -1,71 +1,73 | |||||
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 CHARTTHEMELIGHT_P_H |
|
30 | #ifndef CHARTTHEMELIGHT_P_H | |
31 | #define CHARTTHEMELIGHT_P_H |
|
31 | #define CHARTTHEMELIGHT_P_H | |
32 |
|
32 | |||
33 | #include "charttheme_p.h" |
|
33 | #include "charttheme_p.h" | |
34 |
|
34 | |||
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
36 |
|
36 | |||
37 | class ChartThemeLight: public ChartTheme |
|
37 | class ChartThemeLight: public ChartTheme | |
38 | { |
|
38 | { | |
39 | public: |
|
39 | public: | |
40 | ChartThemeLight() : ChartTheme(QChart::ChartThemeLight) |
|
40 | ChartThemeLight() : ChartTheme(QChart::ChartThemeLight) | |
41 | { |
|
41 | { | |
42 | // Series colors |
|
42 | // Series colors | |
43 | m_seriesColors << QRgb(0x209fdf); |
|
43 | m_seriesColors << QRgb(0x209fdf); | |
44 | m_seriesColors << QRgb(0x99ca53); |
|
44 | m_seriesColors << QRgb(0x99ca53); | |
45 | m_seriesColors << QRgb(0xf6a625); |
|
45 | m_seriesColors << QRgb(0xf6a625); | |
46 | m_seriesColors << QRgb(0x6d5fd5); |
|
46 | m_seriesColors << QRgb(0x6d5fd5); | |
47 | m_seriesColors << QRgb(0xbf593e); |
|
47 | m_seriesColors << QRgb(0xbf593e); | |
48 | m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors); |
|
48 | m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors); | |
49 |
|
49 | |||
50 | // Background |
|
50 | // Background | |
51 | QLinearGradient backgroundGradient; |
|
51 | QLinearGradient backgroundGradient; | |
52 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
52 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); | |
53 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
53 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); | |
54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
55 | m_chartBackgroundGradient = backgroundGradient; |
|
55 | m_chartBackgroundGradient = backgroundGradient; | |
56 | // There is a performance issue in the drop shadow implementation, so disabled for now |
|
56 | // There is a performance issue in the drop shadow implementation, so disabled for now | |
57 | // m_backgroundDropShadowEnabled = true; |
|
57 | // m_backgroundDropShadowEnabled = true; | |
58 |
|
58 | |||
59 | // Axes and other |
|
59 | // Axes and other | |
60 | m_axisLinePen = QPen(0xd6d6d6); |
|
60 | m_axisLinePen = QPen(0xd6d6d6); | |
61 | m_axisLinePen.setWidth(1); |
|
61 | m_axisLinePen.setWidth(1); | |
62 | m_labelBrush = QBrush(QRgb(0x404044)); |
|
62 | m_labelBrush = QBrush(QRgb(0x404044)); | |
63 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
63 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); | |
64 | m_gridLinePen.setWidth(1); |
|
64 | m_gridLinePen.setWidth(1); | |
65 | m_backgroundShades = BackgroundShadesNone; |
|
65 | m_backgroundShades = BackgroundShadesNone; | |
|
66 | m_outlinePen = QPen(QColor(Qt::black)); | |||
|
67 | m_outlinePen.setWidthF(2.0); | |||
66 | } |
|
68 | } | |
67 | }; |
|
69 | }; | |
68 |
|
70 | |||
69 | QTCOMMERCIALCHART_END_NAMESPACE |
|
71 | QTCOMMERCIALCHART_END_NAMESPACE | |
70 |
|
72 | |||
71 | #endif |
|
73 | #endif |
@@ -1,227 +1,239 | |||||
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 | #include "mainwidget.h" |
|
21 | #include "mainwidget.h" | |
22 | #include <QChartView> |
|
22 | #include <QChartView> | |
23 | #include <QBoxPlotSeries> |
|
23 | #include <QBoxPlotSeries> | |
24 | #include <QBarSet> |
|
24 | #include <QBarSet> | |
25 | #include <QLegend> |
|
25 | #include <QLegend> | |
26 | #include <QBarCategoryAxis> |
|
26 | #include <QBarCategoryAxis> | |
27 | #include <QBrush> |
|
27 | #include <QBrush> | |
28 | #include <QColor> |
|
28 | #include <QColor> | |
29 | #include <QPushButton> |
|
29 | #include <QPushButton> | |
30 | #include <QComboBox> |
|
30 | #include <QComboBox> | |
31 | #include <QSpinBox> |
|
31 | #include <QSpinBox> | |
32 | #include <QCheckBox> |
|
32 | #include <QCheckBox> | |
33 | #include <QGridLayout> |
|
33 | #include <QGridLayout> | |
34 | #include <QHBoxLayout> |
|
34 | #include <QHBoxLayout> | |
35 | #include <QLabel> |
|
35 | #include <QLabel> | |
36 | #include <QSpacerItem> |
|
36 | #include <QSpacerItem> | |
37 | #include <QMessageBox> |
|
37 | #include <QMessageBox> | |
38 | #include <cmath> |
|
38 | #include <cmath> | |
39 | #include <QDebug> |
|
39 | #include <QDebug> | |
40 | #include <QStandardItemModel> |
|
40 | #include <QStandardItemModel> | |
41 | #include <QBarCategoryAxis> |
|
41 | #include <QBarCategoryAxis> | |
42 |
|
42 | |||
43 |
|
43 | |||
44 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
44 | QTCOMMERCIALCHART_USE_NAMESPACE | |
45 |
|
45 | |||
|
46 | QString addCategories[] = {"Jul", "Aug", "Sep", "Nov", "Dec"}; | |||
|
47 | ||||
46 | MainWidget::MainWidget(QWidget *parent) : |
|
48 | MainWidget::MainWidget(QWidget *parent) : | |
47 | QWidget(parent), |
|
49 | QWidget(parent), | |
48 | m_chart(0), |
|
50 | m_chart(0), | |
49 | rowPos(0), |
|
51 | rowPos(0), | |
50 | nSeries(0) |
|
52 | nSeries(0), | |
|
53 | nNewBoxes(0) | |||
51 | { |
|
54 | { | |
52 | m_chart = new QChart(); |
|
55 | m_chart = new QChart(); | |
53 |
|
56 | |||
54 | // Grid layout for the controls for configuring the chart widget |
|
57 | // Grid layout for the controls for configuring the chart widget | |
55 | QGridLayout *grid = new QGridLayout(); |
|
58 | QGridLayout *grid = new QGridLayout(); | |
56 |
|
59 | |||
57 | // Create add a series button |
|
60 | // Create add a series button | |
58 | QPushButton *addSeriesButton = new QPushButton("Add a series"); |
|
61 | QPushButton *addSeriesButton = new QPushButton("Add a series"); | |
59 | connect(addSeriesButton, SIGNAL(clicked()), this, SLOT(addSeries())); |
|
62 | connect(addSeriesButton, SIGNAL(clicked()), this, SLOT(addSeries())); | |
60 | grid->addWidget(addSeriesButton, rowPos++, 1); |
|
63 | grid->addWidget(addSeriesButton, rowPos++, 1); | |
61 |
|
64 | |||
62 | // Create remove a series button |
|
65 | // Create remove a series button | |
63 | QPushButton *removeSeriesButton = new QPushButton("Remove a series"); |
|
66 | QPushButton *removeSeriesButton = new QPushButton("Remove a series"); | |
64 | connect(removeSeriesButton, SIGNAL(clicked()), this, SLOT(removeSeries())); |
|
67 | connect(removeSeriesButton, SIGNAL(clicked()), this, SLOT(removeSeries())); | |
65 | grid->addWidget(removeSeriesButton, rowPos++, 1); |
|
68 | grid->addWidget(removeSeriesButton, rowPos++, 1); | |
66 |
|
69 | |||
67 |
|
70 | |||
68 | // Create add a single box button |
|
71 | // Create add a single box button | |
69 | QPushButton *addBoxButton = new QPushButton("Add a box"); |
|
72 | QPushButton *addBoxButton = new QPushButton("Add a box"); | |
70 | connect(addBoxButton, SIGNAL(clicked()), this, SLOT(addBox())); |
|
73 | connect(addBoxButton, SIGNAL(clicked()), this, SLOT(addBox())); | |
71 | grid->addWidget(addBoxButton, rowPos++, 1); |
|
74 | grid->addWidget(addBoxButton, rowPos++, 1); | |
72 |
|
75 | |||
73 | initThemeCombo(grid); |
|
76 | initThemeCombo(grid); | |
74 | initCheckboxes(grid); |
|
77 | initCheckboxes(grid); | |
75 |
|
78 | |||
76 | // add row with empty label to make all the other rows static |
|
79 | // add row with empty label to make all the other rows static | |
77 | grid->addWidget(new QLabel(""), grid->rowCount(), 0); |
|
80 | grid->addWidget(new QLabel(""), grid->rowCount(), 0); | |
78 | grid->setRowStretch(grid->rowCount() - 1, 1); |
|
81 | grid->setRowStretch(grid->rowCount() - 1, 1); | |
79 |
|
82 | |||
80 | // Create chart view with the chart |
|
83 | // Create chart view with the chart | |
81 | m_chartView = new QChartView(m_chart, this); |
|
84 | m_chartView = new QChartView(m_chart, this); | |
82 | //m_chartView->setRubberBand(QChartView::HorizonalRubberBand); |
|
85 | //m_chartView->setRubberBand(QChartView::HorizonalRubberBand); | |
83 |
|
86 | |||
84 | // Another grid layout as a main layout |
|
87 | // Another grid layout as a main layout | |
85 | QGridLayout *mainLayout = new QGridLayout(); |
|
88 | QGridLayout *mainLayout = new QGridLayout(); | |
86 | mainLayout->addLayout(grid, 0, 0); |
|
89 | mainLayout->addLayout(grid, 0, 0); | |
87 | mainLayout->addWidget(m_chartView, 0, 1, 3, 1); |
|
90 | mainLayout->addWidget(m_chartView, 0, 1, 3, 1); | |
88 | setLayout(mainLayout); |
|
91 | setLayout(mainLayout); | |
89 |
|
92 | |||
90 | legendToggled(false); |
|
93 | legendToggled(false); | |
91 | animationToggled(false); |
|
94 | animationToggled(false); | |
92 | } |
|
95 | } | |
93 |
|
96 | |||
94 | // Combo box for selecting theme |
|
97 | // Combo box for selecting theme | |
95 | void MainWidget::initThemeCombo(QGridLayout *grid) |
|
98 | void MainWidget::initThemeCombo(QGridLayout *grid) | |
96 | { |
|
99 | { | |
97 | QComboBox *chartTheme = new QComboBox(); |
|
100 | QComboBox *chartTheme = new QComboBox(); | |
98 | chartTheme->addItem("Default"); |
|
101 | chartTheme->addItem("Default"); | |
99 | chartTheme->addItem("Light"); |
|
102 | chartTheme->addItem("Light"); | |
100 | chartTheme->addItem("Blue Cerulean"); |
|
103 | chartTheme->addItem("Blue Cerulean"); | |
101 | chartTheme->addItem("Dark"); |
|
104 | chartTheme->addItem("Dark"); | |
102 | chartTheme->addItem("Brown Sand"); |
|
105 | chartTheme->addItem("Brown Sand"); | |
103 | chartTheme->addItem("Blue NCS"); |
|
106 | chartTheme->addItem("Blue NCS"); | |
104 | chartTheme->addItem("High Contrast"); |
|
107 | chartTheme->addItem("High Contrast"); | |
105 | chartTheme->addItem("Blue Icy"); |
|
108 | chartTheme->addItem("Blue Icy"); | |
106 | connect(chartTheme, SIGNAL(currentIndexChanged(int)), |
|
109 | connect(chartTheme, SIGNAL(currentIndexChanged(int)), | |
107 | this, SLOT(changeChartTheme(int))); |
|
110 | this, SLOT(changeChartTheme(int))); | |
108 | grid->addWidget(new QLabel("Chart theme:"), rowPos, 0); |
|
111 | grid->addWidget(new QLabel("Chart theme:"), rowPos, 0); | |
109 | grid->addWidget(chartTheme, rowPos++, 1); |
|
112 | grid->addWidget(chartTheme, rowPos++, 1); | |
110 | } |
|
113 | } | |
111 |
|
114 | |||
112 | // Different check boxes for customizing chart |
|
115 | // Different check boxes for customizing chart | |
113 | void MainWidget::initCheckboxes(QGridLayout *grid) |
|
116 | void MainWidget::initCheckboxes(QGridLayout *grid) | |
114 | { |
|
117 | { | |
115 | QCheckBox *animationCheckBox = new QCheckBox("Animation"); |
|
118 | QCheckBox *animationCheckBox = new QCheckBox("Animation"); | |
116 | connect(animationCheckBox, SIGNAL(toggled(bool)), this, SLOT(animationToggled(bool))); |
|
119 | connect(animationCheckBox, SIGNAL(toggled(bool)), this, SLOT(animationToggled(bool))); | |
117 | animationCheckBox->setChecked(false); |
|
120 | animationCheckBox->setChecked(false); | |
118 | grid->addWidget(animationCheckBox, rowPos++, 0); |
|
121 | grid->addWidget(animationCheckBox, rowPos++, 0); | |
119 |
|
122 | |||
120 | QCheckBox *legendCheckBox = new QCheckBox("Legend"); |
|
123 | QCheckBox *legendCheckBox = new QCheckBox("Legend"); | |
121 | connect(legendCheckBox, SIGNAL(toggled(bool)), this, SLOT(legendToggled(bool))); |
|
124 | connect(legendCheckBox, SIGNAL(toggled(bool)), this, SLOT(legendToggled(bool))); | |
122 | legendCheckBox->setChecked(false); |
|
125 | legendCheckBox->setChecked(false); | |
123 | grid->addWidget(legendCheckBox, rowPos++, 0); |
|
126 | grid->addWidget(legendCheckBox, rowPos++, 0); | |
124 |
|
127 | |||
125 | QCheckBox *titleCheckBox = new QCheckBox("Title"); |
|
128 | QCheckBox *titleCheckBox = new QCheckBox("Title"); | |
126 | connect(titleCheckBox, SIGNAL(toggled(bool)), this, SLOT(titleToggled(bool))); |
|
129 | connect(titleCheckBox, SIGNAL(toggled(bool)), this, SLOT(titleToggled(bool))); | |
127 | titleCheckBox->setChecked(false); |
|
130 | titleCheckBox->setChecked(false); | |
128 | grid->addWidget(titleCheckBox, rowPos++, 0); |
|
131 | grid->addWidget(titleCheckBox, rowPos++, 0); | |
129 | } |
|
132 | } | |
130 |
|
133 | |||
131 | void MainWidget::addSeries() |
|
134 | void MainWidget::addSeries() | |
132 | { |
|
135 | { | |
133 | qDebug() << "BoxPlotTester::MainWidget::addSeries()"; |
|
136 | qDebug() << "BoxPlotTester::MainWidget::addSeries()"; | |
134 |
|
137 | |||
135 | if (nSeries > 9) |
|
138 | if (nSeries > 9) | |
136 | return; |
|
139 | return; | |
137 |
|
140 | |||
138 | // Initial data |
|
141 | // Initial data | |
139 | //![1] |
|
142 | //![1] | |
140 | QBarSet *set0 = new QBarSet("Jan"); |
|
143 | QBarSet *set0 = new QBarSet("Jan"); | |
141 | QBarSet *set1 = new QBarSet("Feb"); |
|
144 | QBarSet *set1 = new QBarSet("Feb"); | |
142 | QBarSet *set2 = new QBarSet("Mar"); |
|
145 | QBarSet *set2 = new QBarSet("Mar"); | |
143 | QBarSet *set3 = new QBarSet("Apr"); |
|
146 | QBarSet *set3 = new QBarSet("Apr"); | |
144 | QBarSet *set4 = new QBarSet("May"); |
|
147 | QBarSet *set4 = new QBarSet("May"); | |
145 | QBarSet *set5 = new QBarSet("Jun"); |
|
148 | QBarSet *set5 = new QBarSet("Jun"); | |
146 |
|
149 | |||
147 | // low bot med top upp |
|
150 | // low bot med top upp | |
148 | *set0 << 3 << 4 << 4.4 << 6 << 7; |
|
151 | *set0 << 3 << 4 << 4.4 << 6 << 7; | |
149 | *set1 << 5 << 6 << 7.5 << 8 << 12; |
|
152 | *set1 << 5 << 6 << 7.5 << 8 << 12; | |
150 | *set2 << 3 << 5 << 5.7 << 8 << 9; |
|
153 | *set2 << 3 << 5 << 5.7 << 8 << 9; | |
151 | *set3 << 5 << 6 << 6.8 << 7 << 8; |
|
154 | *set3 << 5 << 6 << 6.8 << 7 << 8; | |
152 | *set4 << 4 << 5 << 5.2 << 6 << 7; |
|
155 | *set4 << 4 << 5 << 5.2 << 6 << 7; | |
153 | *set5 << 4 << 7 << 8.2 << 9 << 10; |
|
156 | *set5 << 4 << 7 << 8.2 << 9 << 10; | |
154 |
|
157 | |||
155 | m_series[nSeries] = new QBoxPlotSeries(); |
|
158 | m_series[nSeries] = new QBoxPlotSeries(); | |
156 | m_series[nSeries]->append(set0); |
|
159 | m_series[nSeries]->append(set0); | |
157 | m_series[nSeries]->append(set1); |
|
160 | m_series[nSeries]->append(set1); | |
158 | m_series[nSeries]->append(set2); |
|
161 | m_series[nSeries]->append(set2); | |
159 | m_series[nSeries]->append(set3); |
|
162 | m_series[nSeries]->append(set3); | |
160 | m_series[nSeries]->append(set4); |
|
163 | m_series[nSeries]->append(set4); | |
161 | m_series[nSeries]->append(set5); |
|
164 | m_series[nSeries]->append(set5); | |
162 | m_series[nSeries]->type(); |
|
165 | m_series[nSeries]->type(); | |
163 | m_series[nSeries]->setName("Box & Whiskers"); |
|
166 | m_series[nSeries]->setName("Box & Whiskers"); | |
164 |
|
167 | |||
165 | m_chart->addSeries(m_series[nSeries]); |
|
168 | m_chart->addSeries(m_series[nSeries]); | |
166 |
|
169 | |||
167 | QStringList categories; |
|
170 | if (nSeries == 0) { | |
168 | categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; |
|
171 | QStringList categories; | |
169 | QBarCategoryAxis *axis = new QBarCategoryAxis(); |
|
172 | categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; | |
170 | axis->append(categories); |
|
173 | m_axis = new QBarCategoryAxis(); | |
171 | m_chart->createDefaultAxes(); |
|
174 | m_axis->append(categories); | |
172 | m_chart->setAxisX(axis, m_series[nSeries]); |
|
175 | m_chart->createDefaultAxes(); | |
|
176 | m_chart->setAxisX(m_axis, m_series[nSeries]); | |||
|
177 | } | |||
173 |
|
178 | |||
174 | nSeries++; |
|
179 | nSeries++; | |
175 | } |
|
180 | } | |
176 |
|
181 | |||
177 | void MainWidget::removeSeries() |
|
182 | void MainWidget::removeSeries() | |
178 | { |
|
183 | { | |
179 | if (nSeries > 0) { |
|
184 | if (nSeries > 0) { | |
180 | nSeries--; |
|
185 | nSeries--; | |
181 | m_chart->removeSeries(m_series[nSeries]); |
|
186 | m_chart->removeSeries(m_series[nSeries]); | |
182 | delete m_series[nSeries]; |
|
187 | delete m_series[nSeries]; | |
183 | } |
|
188 | } | |
184 | } |
|
189 | } | |
185 |
|
190 | |||
186 | void MainWidget::addBox() |
|
191 | void MainWidget::addBox() | |
187 | { |
|
192 | { | |
188 | qDebug() << "BoxPlotTester::MainWidget::addBox()"; |
|
193 | qDebug() << "BoxPlotTester::MainWidget::addBox()"; | |
189 |
|
194 | |||
190 | QBarSet *newSet = new QBarSet("New"); |
|
195 | QBarSet *newSet = new QBarSet("New"); | |
191 | *newSet << 5 << 6 << 6.8 << 7 << 8; |
|
196 | *newSet << 5 << 6 << 6.8 << 7 << 8; | |
192 |
|
197 | |||
193 | m_series[0]->append(newSet); |
|
198 | m_series[0]->append(newSet); | |
|
199 | ||||
|
200 | m_axis->append(addCategories[nNewBoxes]); | |||
|
201 | ||||
|
202 | nNewBoxes++; | |||
194 | } |
|
203 | } | |
195 |
|
204 | |||
196 | void MainWidget::animationToggled(bool enabled) |
|
205 | void MainWidget::animationToggled(bool enabled) | |
197 | { |
|
206 | { | |
198 | qDebug() << "BoxPlotTester::Animation toggled to " << enabled; |
|
207 | qDebug() << "BoxPlotTester::Animation toggled to " << enabled; | |
199 | if (enabled) |
|
208 | if (enabled) | |
200 | m_chart->setAnimationOptions(QChart::SeriesAnimations); |
|
209 | m_chart->setAnimationOptions(QChart::SeriesAnimations); | |
201 | else |
|
210 | else | |
202 | m_chart->setAnimationOptions(QChart::NoAnimation); |
|
211 | m_chart->setAnimationOptions(QChart::NoAnimation); | |
203 | } |
|
212 | } | |
204 |
|
213 | |||
205 | void MainWidget::legendToggled(bool enabled) |
|
214 | void MainWidget::legendToggled(bool enabled) | |
206 | { |
|
215 | { | |
207 | qDebug() << "BoxPlotTester::Legend toggled to " << enabled; |
|
216 | qDebug() << "BoxPlotTester::Legend toggled to " << enabled; | |
208 | m_chart->legend()->setVisible(enabled); |
|
217 | m_chart->legend()->setVisible(enabled); | |
209 | if (enabled) |
|
218 | if (enabled) | |
210 | m_chart->legend()->setAlignment(Qt::AlignBottom); |
|
219 | m_chart->legend()->setAlignment(Qt::AlignBottom); | |
211 | } |
|
220 | } | |
212 |
|
221 | |||
213 | void MainWidget::titleToggled(bool enabled) |
|
222 | void MainWidget::titleToggled(bool enabled) | |
214 | { |
|
223 | { | |
215 | qDebug() << "BoxPlotTester::Title toggled to " << enabled; |
|
224 | qDebug() << "BoxPlotTester::Title toggled to " << enabled; | |
216 | if (enabled) |
|
225 | if (enabled) | |
217 | m_chart->setTitle("Simple boxplotchart example"); |
|
226 | m_chart->setTitle("Simple boxplotchart example"); | |
218 | else |
|
227 | else | |
219 | m_chart->setTitle(""); |
|
228 | m_chart->setTitle(""); | |
220 | } |
|
229 | } | |
221 |
|
230 | |||
222 |
|
231 | |||
223 | void MainWidget::changeChartTheme(int themeIndex) |
|
232 | void MainWidget::changeChartTheme(int themeIndex) | |
224 | { |
|
233 | { | |
225 | qDebug() << "BoxPlotTester::changeChartTheme: " << themeIndex; |
|
234 | qDebug() << "BoxPlotTester::changeChartTheme: " << themeIndex; | |
226 | m_chart->setTheme((QChart::ChartTheme) themeIndex); |
|
235 | if (themeIndex == 0) | |
|
236 | m_chart->setTheme(QChart::ChartThemeLight); | |||
|
237 | else | |||
|
238 | m_chart->setTheme((QChart::ChartTheme) (themeIndex - 1)); | |||
227 | } |
|
239 | } |
@@ -1,64 +1,67 | |||||
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 | #ifndef MAINWIDGET_H |
|
21 | #ifndef MAINWIDGET_H | |
22 | #define MAINWIDGET_H |
|
22 | #define MAINWIDGET_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
24 | #include "qchartglobal.h" | |
25 | #include "qchart.h" |
|
25 | #include "qchart.h" | |
26 | #include "qchartview.h" |
|
26 | #include "qchartview.h" | |
27 | #include <QWidget> |
|
27 | #include <QWidget> | |
28 | #include <QBoxPlotSeries> |
|
28 | #include <QBoxPlotSeries> | |
|
29 | #include <QBarCategoryAxis> | |||
29 |
|
30 | |||
30 | class QGridLayout; |
|
31 | class QGridLayout; | |
31 |
|
32 | |||
32 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
33 | QTCOMMERCIALCHART_USE_NAMESPACE | |
33 |
|
34 | |||
34 | class MainWidget : public QWidget |
|
35 | class MainWidget : public QWidget | |
35 | { |
|
36 | { | |
36 | Q_OBJECT |
|
37 | Q_OBJECT | |
37 | public: |
|
38 | public: | |
38 | explicit MainWidget(QWidget *parent = 0); |
|
39 | explicit MainWidget(QWidget *parent = 0); | |
39 |
|
40 | |||
40 | signals: |
|
41 | signals: | |
41 |
|
42 | |||
42 | private: |
|
43 | private: | |
43 | void initThemeCombo(QGridLayout *grid); |
|
44 | void initThemeCombo(QGridLayout *grid); | |
44 | void initCheckboxes(QGridLayout *grid); |
|
45 | void initCheckboxes(QGridLayout *grid); | |
45 |
|
46 | |||
46 | private slots: |
|
47 | private slots: | |
47 | void addSeries(); |
|
48 | void addSeries(); | |
48 | void removeSeries(); |
|
49 | void removeSeries(); | |
49 | void addBox(); |
|
50 | void addBox(); | |
50 | void animationToggled(bool enabled); |
|
51 | void animationToggled(bool enabled); | |
51 | void legendToggled(bool enabled); |
|
52 | void legendToggled(bool enabled); | |
52 | void titleToggled(bool enabled); |
|
53 | void titleToggled(bool enabled); | |
53 | void changeChartTheme(int themeIndex); |
|
54 | void changeChartTheme(int themeIndex); | |
54 |
|
55 | |||
55 | private: |
|
56 | private: | |
56 | QChart *m_chart; |
|
57 | QChart *m_chart; | |
57 | QChartView *m_chartView; |
|
58 | QChartView *m_chartView; | |
58 | QGridLayout *m_scatterLayout; |
|
59 | QGridLayout *m_scatterLayout; | |
|
60 | QBarCategoryAxis *m_axis; | |||
59 | int rowPos; |
|
61 | int rowPos; | |
60 | int nSeries; |
|
62 | int nSeries; | |
|
63 | int nNewBoxes; | |||
61 | QBoxPlotSeries *m_series[10]; |
|
64 | QBoxPlotSeries *m_series[10]; | |
62 | }; |
|
65 | }; | |
63 |
|
66 | |||
64 | #endif // MAINWIDGET_H |
|
67 | #endif // MAINWIDGET_H |
General Comments 0
You need to be logged in to leave comments.
Login now