From 0f262fd10d337db0ec435d840b541d629879ce9f Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Wed, 20 May 2009 13:29:54 +0200 Subject: Add CSV syntax support to the grapher * grapher/GraphData.hxx (CSVData): new class * grapher/GraphData.cxx (commaSplit): new function (ioCallback): handle CSV definition and data --- grapher/GraphData.hxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'grapher/GraphData.hxx') diff --git a/grapher/GraphData.hxx b/grapher/GraphData.hxx index 0f3b0b31..2c0783c6 100644 --- a/grapher/GraphData.hxx +++ b/grapher/GraphData.hxx @@ -3,6 +3,7 @@ #include #include +#include namespace systemtap { @@ -40,5 +41,11 @@ namespace systemtap } }; }; + + struct CSVData + { + typedef std::pair > Element; + std::vector elements; + }; } #endif -- cgit From 5f4f8b1129659adb2015ce42821faccf8fe6d8d5 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Wed, 27 May 2009 10:32:51 +0200 Subject: Templatize GraphData * grapher/GraphData.hxx (GraphDataBase): new superclass for GraphData. Split time data out as a separate vector. (GraphData): Rewrite as template. * grapher/GraphWidget.cxx (on_expose_event): Reflect GraphData templatization. Handle events with string values. * grapher/GraphWidget.hxx (GraphWidget): Keep pointers to GraphDataBase objects instead of GraphData. * grapher/StapParser.cxx (parseData): new member function (ioCallback): Handle new discreet event * grapher/StapParser.hxx (StapParser): keep pointers to GraphDataBase objects instead of GraphData * testsuite/systemtap.examples/general/grapher.stp: Display actual key pressed for keyboard event --- grapher/GraphData.hxx | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) (limited to 'grapher/GraphData.hxx') diff --git a/grapher/GraphData.hxx b/grapher/GraphData.hxx index 2c0783c6..9bf3b624 100644 --- a/grapher/GraphData.hxx +++ b/grapher/GraphData.hxx @@ -7,44 +7,38 @@ namespace systemtap { - struct GraphData + struct GraphDataBase { - public: + virtual ~GraphDataBase() {} enum Style { BAR, - DOT + DOT, + EVENT }; - GraphData() : scale(1.0), style(BAR) + GraphDataBase() : scale(1.0), style(BAR) { color[0] = 0.0; color[1] = 1.0; color[2] = 0.0; } - typedef std::pair Datum; - typedef std::vector List; + typedef std::vector TimeList; // size of grid square at "normal" viewing double scale; double color[3]; Style style; - List data; - struct Compare - { - bool operator() (const Datum& lhs, const Datum& rhs) const - { - return lhs.first < rhs.first; - } - bool operator() (double lhs, const Datum& rhs) const - { - return lhs < rhs.first; - } - bool operator() (const Datum& lhs, double rhs) const - { - return lhs.first < rhs; - } - }; + TimeList times; }; + template + class GraphData : public GraphDataBase + { + public: + typedef T data_type; + typedef std::vector DataList; + DataList data; + }; struct CSVData { - typedef std::pair > Element; + typedef std::pair > + Element; std::vector elements; }; } -- cgit From 364ad890e341bb60ae169af69933a382d4bf9f81 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Mon, 27 Jul 2009 12:46:30 +0200 Subject: Support for presenting multiple graphs * grapher/Graph.hxx: New file; class for single graph display. * grapher/Graph.cxx: New file. * grapher/GraphData.hxx: Associate title and axis labels with graph data and not a graph display. * grapher/GraphWidget.hxx: Move graph-related members to Graph class. * grapher/GraphWidget.cxx (getExtents, setExtents): Move to Graph class (on_expose_event): Move graph rendering to Graph. (on_button_press_event): Delegate to Graph. (on_motion_notify_event, on_scroll_event): Modify "active" graph. * grapher/StapParser.cxx (findTaggedValue): New parsing helper function. (io_callback): Support new syntax where properties are attached to graph data and not the entire graph. * grapher/grapher.cxx (GrapherWindow): Don't set graph values. * grapher/Makefile.am: Add Graph.cxx. * testsuite/systemtap.examples/general/grapher.stp: New property syntax. --- grapher/GraphData.hxx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'grapher/GraphData.hxx') diff --git a/grapher/GraphData.hxx b/grapher/GraphData.hxx index 9bf3b624..e4c08cfd 100644 --- a/grapher/GraphData.hxx +++ b/grapher/GraphData.hxx @@ -1,6 +1,7 @@ #ifndef SYSTEMTAP_GRAPHDATA_HXX #define SYSTEMTAP_GRAPHDATA_HXX 1 +#include #include #include #include @@ -24,6 +25,9 @@ namespace systemtap double scale; double color[3]; Style style; + std::string title; + std::string xAxisText; + std::string yAxisText; TimeList times; }; -- cgit