#ifndef BARCHART_H #define BARCHART_H #include #include #include #include #include "colorscale.h" #include "scale.h" class BarChart { public: BarChart(); size_t width() const { return m_width; } size_t height() const { return m_height; } nod::signal valuesChanged; nod::signal)> colorScaleChanged; nod::signal &)> selectionChanged; nod::signal &)> selectionInteractivelyChanged; nod::signal itemBrushed; nod::signal itemInteractivelyBrushed; void setValues(const arma::vec &values); void updateValues(const arma::vec &values); void setColorScale(std::shared_ptr scale); void setSelection(const std::vector &selection); void brushItem(int item); void update(); protected: // QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *); // void hoverEnterEvent(QHoverEvent *event); // void hoverMoveEvent(QHoverEvent *event); // void hoverLeaveEvent(QHoverEvent *event); // void mousePressEvent(QMouseEvent *event); // void mouseMoveEvent(QMouseEvent *event); // void mouseReleaseEvent(QMouseEvent *event); private: // QSGNode *newSceneGraph() const; // QSGNode *newBarNode() const; // QSGNode *newSelectionBarNode() const; // void updateViewport(QSGNode *root) const; // void updateBarNodeGeom(QSGNode *barNode, float x, float width, float height) const; // void updateBarNodeColor(QSGNode *barNode, const QColor &color) const; // void updateBars(QSGNode *node) const; bool m_shouldUpdateBars; // void updatePreSelection(QSGNode *node) const; bool m_shouldUpdatePreSelection; float m_dragStartPos, m_dragLastPos; // void updateSelectionBar(QSGNode *node, float x, float barWidth, const QColor &color) const; // void updateSelectionBars(QSGNode *node) const; bool m_shouldUpdateSelection; void interactiveSelection(float start, float end); std::vector m_selection; // void updateBrush(QSGNode *node) const; int m_brushedItem; int itemAt(float x, bool includeSelectorWidth = false) const; arma::vec m_values; std::shared_ptr m_colorScale; std::vector m_originalIndices, m_currentIndices; LinearScale m_scale; size_t m_width, m_height; }; #endif // BARCHART_H