@@ -188,19 +188,24 void QBoxPlotSeriesPrivate::initializeGraphics(QGraphicsItem* parent) | |||||
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 | } |
@@ -38,8 +38,6 public: | |||||
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); |
@@ -61,6 +61,7 public: | |||||
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; } | |
@@ -77,6 +78,7 protected: | |||||
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; |
@@ -60,6 +60,8 public: | |||||
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 |
@@ -62,6 +62,8 public: | |||||
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 |
@@ -61,6 +61,8 public: | |||||
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 |
@@ -61,6 +61,8 public: | |||||
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 |
@@ -61,6 +61,8 public: | |||||
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 |
@@ -63,6 +63,8 public: | |||||
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 |
@@ -63,6 +63,8 public: | |||||
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 |
@@ -43,11 +43,14 | |||||
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 | |||
@@ -164,12 +167,14 void MainWidget::addSeries() | |||||
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 | } | |
@@ -191,6 +196,10 void MainWidget::addBox() | |||||
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) | |
@@ -223,5 +232,8 void MainWidget::titleToggled(bool enabled) | |||||
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 | } |
@@ -26,6 +26,7 | |||||
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 | |||
@@ -56,8 +57,10 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 |
General Comments 0
You need to be logged in to leave comments.
Login now