##// END OF EJS Templates
Theme modifications....
Mika Salmela -
r2479:e5122ae0e714
parent child
Show More
@@ -188,19 +188,24 void QBoxPlotSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
188 188 void QBoxPlotSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
189 189 {
190 190 Q_Q(QBoxPlotSeries);
191 qDebug() << "QBoxPlotSeriesPrivate::initializeTheme";
191 192
192 193 const QList<QGradient> gradients = theme->seriesGradients();
193 194
194 195 if (forced || m_brush == QBrush(Qt::NoBrush)) {
195 QColor brushColor = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.1);
196 QColor brushColor = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.5);
196 197 q->setBrush(brushColor);
197 198 }
198 199
199 200 if (forced || m_pen == QPen(Qt::NoPen)) {
200 QPen pen;
201 pen.setColor(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 1.0));
202 pen.setWidthF(1.0);
201 QPen pen = theme->outlinePen();
203 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 209 q->setPen(pen);
205 210 }
206 211 }
@@ -38,8 +38,6 public:
38 38
39 39 QAbstractSeries::SeriesType type() const;
40 40
41 void mika();
42
43 41 void setBrush(const QBrush &brush);
44 42 QBrush brush() const;
45 43 void setPen(const QPen &pen);
@@ -61,6 +61,7 public:
61 61 QBrush labelBrush() const { return m_labelBrush; }
62 62 QPen axisLinePen() const { return m_axisLinePen; }
63 63 QPen backgroundShadesPen() const { return m_backgroundShadesPen; }
64 QPen outlinePen() const { return m_outlinePen; }
64 65 QBrush backgroundShadesBrush() const { return m_backgroundShadesBrush; }
65 66 BackgroundShadesMode backgroundShades() const { return m_backgroundShades; }
66 67 bool isBackgroundDropShadowEnabled() const { return m_backgroundDropShadowEnabled; }
@@ -77,6 +78,7 protected:
77 78 QBrush m_labelBrush;
78 79 QPen m_axisLinePen;
79 80 QPen m_backgroundShadesPen;
81 QPen m_outlinePen;
80 82 QBrush m_backgroundShadesBrush;
81 83 BackgroundShadesMode m_backgroundShades;
82 84 bool m_backgroundDropShadowEnabled;
@@ -60,6 +60,8 public:
60 60 m_gridLinePen = QPen(QRgb(0x84a2b0));
61 61 m_gridLinePen.setWidth(1);
62 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 62 m_gridLinePen = QPen(QRgb(0xe2e2e2));
63 63 m_gridLinePen.setWidth(1);
64 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 61 m_gridLinePen = QPen(QRgb(0xe2e2e2));
62 62 m_gridLinePen.setWidth(1);
63 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 61 m_gridLinePen = QPen(QRgb(0xd4cec3));
62 62 m_gridLinePen.setWidth(1);
63 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 61 m_gridLinePen = QPen(QRgb(0x86878c));
62 62 m_gridLinePen.setWidth(1);
63 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 63 m_gridLinePen.setWidth(1);
64 64 m_backgroundShadesBrush = QBrush(QRgb(0xffeecd));
65 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 63 m_gridLinePen = QPen(QRgb(0xe2e2e2));
64 64 m_gridLinePen.setWidth(1);
65 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 44 QTCOMMERCIALCHART_USE_NAMESPACE
45 45
46 QString addCategories[] = {"Jul", "Aug", "Sep", "Nov", "Dec"};
47
46 48 MainWidget::MainWidget(QWidget *parent) :
47 49 QWidget(parent),
48 50 m_chart(0),
49 51 rowPos(0),
50 nSeries(0)
52 nSeries(0),
53 nNewBoxes(0)
51 54 {
52 55 m_chart = new QChart();
53 56
@@ -164,12 +167,14 void MainWidget::addSeries()
164 167
165 168 m_chart->addSeries(m_series[nSeries]);
166 169
167 QStringList categories;
168 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
169 QBarCategoryAxis *axis = new QBarCategoryAxis();
170 axis->append(categories);
171 m_chart->createDefaultAxes();
172 m_chart->setAxisX(axis, m_series[nSeries]);
170 if (nSeries == 0) {
171 QStringList categories;
172 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
173 m_axis = new QBarCategoryAxis();
174 m_axis->append(categories);
175 m_chart->createDefaultAxes();
176 m_chart->setAxisX(m_axis, m_series[nSeries]);
177 }
173 178
174 179 nSeries++;
175 180 }
@@ -191,6 +196,10 void MainWidget::addBox()
191 196 *newSet << 5 << 6 << 6.8 << 7 << 8;
192 197
193 198 m_series[0]->append(newSet);
199
200 m_axis->append(addCategories[nNewBoxes]);
201
202 nNewBoxes++;
194 203 }
195 204
196 205 void MainWidget::animationToggled(bool enabled)
@@ -223,5 +232,8 void MainWidget::titleToggled(bool enabled)
223 232 void MainWidget::changeChartTheme(int themeIndex)
224 233 {
225 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 26 #include "qchartview.h"
27 27 #include <QWidget>
28 28 #include <QBoxPlotSeries>
29 #include <QBarCategoryAxis>
29 30
30 31 class QGridLayout;
31 32
@@ -56,8 +57,10 private:
56 57 QChart *m_chart;
57 58 QChartView *m_chartView;
58 59 QGridLayout *m_scatterLayout;
60 QBarCategoryAxis *m_axis;
59 61 int rowPos;
60 62 int nSeries;
63 int nNewBoxes;
61 64 QBoxPlotSeries *m_series[10];
62 65 };
63 66
General Comments 0
You need to be logged in to leave comments. Login now