aboutsummaryrefslogtreecommitdiff
path: root/barchart.h
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-01-17 16:41:25 +0100
committerSamuel Fadel <samuelfadel@gmail.com>2016-01-17 16:41:25 +0100
commite30c6ce366b759dfb39b781becb837282efa0d0f (patch)
treed95750f662835bf2c628ccd2da5f4251b41a78b4 /barchart.h
parenta9236429e5691159f1ddc017b28ee0c060e0092d (diff)
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
Diffstat (limited to 'barchart.h')
-rw-r--r--barchart.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/barchart.h b/barchart.h
index 933c004..2d37419 100644
--- a/barchart.h
+++ b/barchart.h
@@ -7,6 +7,7 @@
#include <armadillo>
+#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<int> m_originalIndices;
LinearScale<float> m_scale;
};