diff options
author | Samuel Fadel <samuelfadel@gmail.com> | 2016-01-07 15:10:20 +0100 |
---|---|---|
committer | Samuel Fadel <samuelfadel@gmail.com> | 2016-01-07 15:10:20 +0100 |
commit | 7676a38ea8a06d3d31228cb7eb1be00f90de46d3 (patch) | |
tree | 3082a0a466938f1a78c8738e30a7f37731717e3f /barchart.h | |
parent | d17979519423b8afb67d9178820a458bf6a5474a (diff) |
Added a bar chart.
* HistoryGraph replaced by BarChart
* HistoryGraph not removed from code, might be useful in the future
Diffstat (limited to 'barchart.h')
-rw-r--r-- | barchart.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/barchart.h b/barchart.h new file mode 100644 index 0000000..ccbb13e --- /dev/null +++ b/barchart.h @@ -0,0 +1,34 @@ +#ifndef BARCHART_H +#define BARCHART_H + +#include <QtQuick> +#include <armadillo> + +class BarChart : public QQuickItem +{ + Q_OBJECT +public: + BarChart(QQuickItem *parent = 0); + ~BarChart(); + +signals: + void valuesChanged(const arma::vec &values); + +public slots: + void setValues(const arma::vec &values); + +protected: + QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *); + void hoverMoveEvent(QHoverEvent *event); + void mousePressEvent(QMouseEvent *event); + +private: + QSGNode *newBarNode(); + void updateBarNodeGeom(QSGNode *barNode, float x, float width, float height); + void updateBars(QSGNode *root); + + arma::vec m_values; + bool m_shouldUpdateBars; +}; + +#endif // BARCHART_H |