##// END OF EJS Templates
Now using either vertical or horizontal grid shades
Tero Ahola -
r561:9e8d1d9c7f49
parent child
Show More
@@ -118,9 +118,8 void ChartPresenter::handleAxisAdded(QChartAxis* axis,Domain* domain)
118 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&)));
118 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&)));
119 //initialize
119 //initialize
120 item->handleGeometryChanged(m_rect);
120 item->handleGeometryChanged(m_rect);
121 m_chartTheme->decorate(axis,item);
121 m_chartTheme->decorate(axis, m_chart);
122 m_axisItems.insert(axis,item);
122 m_axisItems.insert(axis, item);
123
124 }
123 }
125
124
126 void ChartPresenter::handleAxisRemoved(QChartAxis* axis)
125 void ChartPresenter::handleAxisRemoved(QChartAxis* axis)
@@ -218,18 +218,18 void ChartTheme::decorate(SplineChartItem* item, QSplineSeries* series, int inde
218 // presenter->m_markerPen = pen;
218 // presenter->m_markerPen = pen;
219 }
219 }
220
220
221 void ChartTheme::decorate(QChartAxis* axis, AxisItem* item)
221 void ChartTheme::decorate(QChartAxis* axis, QChart* parent)
222 {
222 {
223 Q_ASSERT(axis);
223 Q_ASSERT(axis);
224 Q_ASSERT(item);
224 Q_ASSERT(parent);
225
225
226 if (axis->isAxisVisible()) {
226 if (axis->isAxisVisible()) {
227 axis->setLabelsBrush(m_axisLabelBrush);
227 axis->setLabelsBrush(m_axisLabelBrush);
228 axis->setLabelsPen(m_axisLabelPen);
228 axis->setLabelsPen(m_axisLabelPen);
229 // TODO: check the axis type (x or y) should define whether to show the shades or not
229 // TODO: check the axis type (x or y) should define whether to show the shades or not
230 if (m_backgroundShades == BackgroundShadesBoth
230 if (m_backgroundShades == BackgroundShadesBoth
231 || m_backgroundShades == BackgroundShadesVertical /*&& x axis ?*/
231 || (m_backgroundShades == BackgroundShadesVertical && parent->axisX() == axis)
232 || m_backgroundShades == BackgroundShadesHorizontal /* && y axis*/) {
232 || (m_backgroundShades == BackgroundShadesHorizontal && parent->axisY() == axis)) {
233 axis->setShadesPen(m_backgroundShadesPen);
233 axis->setShadesPen(m_backgroundShadesPen);
234 axis->setShadesBrush(m_backgroundShadesBrush);
234 axis->setShadesBrush(m_backgroundShadesBrush);
235 } else {
235 } else {
@@ -53,7 +53,7 public:
53 void decorate(ScatterChartItem* presenter, QScatterSeries* series, int index);
53 void decorate(ScatterChartItem* presenter, QScatterSeries* series, int index);
54 void decorate(PiePresenter* item, QPieSeries* series, int index);
54 void decorate(PiePresenter* item, QPieSeries* series, int index);
55 void decorate(SplineChartItem* presenter, QSplineSeries* series, int index);
55 void decorate(SplineChartItem* presenter, QSplineSeries* series, int index);
56 void decorate(QChartAxis* axis, AxisItem* item);
56 void decorate(QChartAxis* axis, QChart* parent);
57
57
58 public: // utils
58 public: // utils
59 void generateSeriesGradients();
59 void generateSeriesGradients();
@@ -28,6 +28,9 public:
28 m_axisLabelBrush = QBrush(QRgb(0x3f3f3f));
28 m_axisLabelBrush = QBrush(QRgb(0x3f3f3f));
29 m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons
29 m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons
30 m_backgroundShadesPen = Qt::NoPen;
30 m_backgroundShadesPen = Qt::NoPen;
31 // m_backgroundShadesBrush = QBrush(QColor(0x0f, 0x0f, 0x0f, 0x80));
32 m_backgroundShadesBrush = QBrush(QColor(0xff, 0xad, 0x00, 0x50));
33 m_backgroundShades = BackgroundShadesHorizontal;
31 m_gridLinePen = QPen(QRgb(0x0f0f0f));
34 m_gridLinePen = QPen(QRgb(0x0f0f0f));
32 m_gridLinePen.setWidth(2);
35 m_gridLinePen.setWidth(2);
33 }
36 }
General Comments 0
You need to be logged in to leave comments. Login now