From c10fce7d6aaa57a4f94f9d7aeea906597456f7ce Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Wed, 2 Dec 2009 19:27:07 +0100 Subject: Make the hover text conform to data displayed. Start of code to be more selective about the association between the hover text and the underling graph. Also, show the data set name in hover text. * grapher/GraphStyle.hxx (dataIndexAtPoint): New virtual function. * grapher/GraphStyle.cxx (dataIndexAtPoint): Implementation for bar graphs * grapher/GraphWidget.cxx (onHoverTimeout): Use dataIndexAtPoint. --- grapher/GraphStyle.hxx | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'grapher/GraphStyle.hxx') diff --git a/grapher/GraphStyle.hxx b/grapher/GraphStyle.hxx index 4a0cd955..9625f451 100644 --- a/grapher/GraphStyle.hxx +++ b/grapher/GraphStyle.hxx @@ -14,29 +14,40 @@ namespace systemtap public: virtual void draw(std::tr1::shared_ptr graphData, Graph* graph, Cairo::RefPtr cr) = 0; + virtual ssize_t dataIndexAtPoint(double x, double y, + std::tr1::shared_ptr + graphData, + std::tr1::shared_ptr graph) + { + return -1; + } }; class GraphStyleBar : public GraphStyle { public: - virtual void draw(std::tr1::shared_ptr graphData, - Graph* graph, Cairo::RefPtr cr); + void draw(std::tr1::shared_ptr graphData, + Graph* graph, Cairo::RefPtr cr); + static GraphStyleBar instance; + ssize_t dataIndexAtPoint(double x, double y, + std::tr1::shared_ptr graphData, + std::tr1::shared_ptr graph); }; class GraphStyleDot : public GraphStyle { public: - virtual void draw(std::tr1::shared_ptr graphData, - Graph* graph, Cairo::RefPtr cr); + void draw(std::tr1::shared_ptr graphData, + Graph* graph, Cairo::RefPtr cr); static GraphStyleDot instance; }; class GraphStyleEvent : public GraphStyle { public: - virtual void draw(std::tr1::shared_ptr graphData, - Graph* graph, Cairo::RefPtr cr); + void draw(std::tr1::shared_ptr graphData, + Graph* graph, Cairo::RefPtr cr); static GraphStyleEvent instance; }; } -- cgit