From e30c6ce366b759dfb39b781becb837282efa0d0f Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Sun, 17 Jan 2016 16:41:25 +0100 Subject: BarChart: Added color scale support. * Color scale's extents are not changed: the values are supposed to match the values used in the other plots * Temporarily removed the bar outlines in order to properly display colors when the number of bars is equal to or greater than the number of available pixels to draw --- barchart.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'barchart.h') diff --git a/barchart.h b/barchart.h index 933c004..2d37419 100644 --- a/barchart.h +++ b/barchart.h @@ -7,6 +7,7 @@ #include +#include "colorscale.h" #include "scale.h" class BarChart @@ -19,9 +20,11 @@ public: signals: void valuesChanged(const arma::vec &values) const; + void colorScaleChanged(const ColorScale *scale) const; public slots: void setValues(const arma::vec &values); + void setColorScale(const ColorScale *scale); protected: QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *); @@ -31,10 +34,12 @@ protected: private: QSGNode *newBarNode() const; void updateBarNodeGeom(QSGNode *barNode, float x, float width, float height); + void updateBarNodeColor(QSGNode *barNode, const QColor &color); void updateBars(QSGNode *root); bool m_shouldUpdateBars; arma::vec m_values; + const ColorScale *m_colorScale; std::vector m_originalIndices; LinearScale m_scale; }; -- cgit v1.2.3