From 572a176d481c329b370ce52e7bec1a49ed76c225 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Tue, 1 Dec 2009 12:02:24 +0100 Subject: change time type from double to int64_t * grapher/Graph.hxx (Graph): Change variables holding the time limits of the displayed graph from double to int64_t. * grapher/Graph.cxx (Graph::draw): Do calculations of time differences using int64_t. (Graph::getExtents, Graph::setExtents): Change left and right arguments to int64_t. * grapher/GraphData.hxx (GraphDataBase): Change time type to int64_t. (GraphDataBase::elementAsString): New function. (GraphData::elementAsString): Implementation of that function. * grapher/StapParser.cxx (parseData): Parse time values from the stap script as 64 bit values. --- grapher/GraphData.hxx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'grapher/GraphData.hxx') diff --git a/grapher/GraphData.hxx b/grapher/GraphData.hxx index 0e26fb4d..e06ffdb8 100644 --- a/grapher/GraphData.hxx +++ b/grapher/GraphData.hxx @@ -1,6 +1,9 @@ #ifndef SYSTEMTAP_GRAPHDATA_HXX #define SYSTEMTAP_GRAPHDATA_HXX 1 +#include + +#include #include #include #include @@ -18,12 +21,13 @@ namespace systemtap DOT, EVENT }; - typedef boost::circular_buffer TimeList; + typedef boost::circular_buffer TimeList; GraphDataBase(TimeList::capacity_type cap = 50000) : scale(1.0), style(BAR), times(cap) { color[0] = 0.0; color[1] = 1.0; color[2] = 0.0; } + virtual std::string elementAsString(size_t element) = 0; // size of grid square at "normal" viewing double scale; double color[3]; @@ -44,6 +48,12 @@ namespace systemtap : GraphDataBase(cap), data(cap) { } + std::string elementAsString(size_t element) + { + std::ostringstream stream; + stream << data[element]; + return stream.str(); + } DataList data; }; struct CSVData -- cgit From 6197b0dc80c4f87000d26213293fe2cb72fbe081 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Tue, 1 Dec 2009 19:05:09 +0100 Subject: Refactor drawing of different styles of graph into classes * grapher/GraphStyle.cxx: New file * grapher/GraphStyle.hxx: New file * grapher/Graph(draw): Move much drawing code to GraphStyle::draw --- grapher/GraphData.hxx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'grapher/GraphData.hxx') diff --git a/grapher/GraphData.hxx b/grapher/GraphData.hxx index e06ffdb8..9a267fc5 100644 --- a/grapher/GraphData.hxx +++ b/grapher/GraphData.hxx @@ -11,19 +11,17 @@ #include +#include "GraphStyle.hxx" + namespace systemtap { struct GraphDataBase { virtual ~GraphDataBase() {} - enum Style - { BAR, - DOT, - EVENT - }; + typedef boost::circular_buffer TimeList; GraphDataBase(TimeList::capacity_type cap = 50000) - : scale(1.0), style(BAR), times(cap) + : scale(1.0), style(&GraphStyleBar::instance), times(cap) { color[0] = 0.0; color[1] = 1.0; color[2] = 0.0; } @@ -31,7 +29,7 @@ namespace systemtap // size of grid square at "normal" viewing double scale; double color[3]; - Style style; + GraphStyle* style; std::string title; std::string xAxisText; std::string yAxisText; -- cgit 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/GraphData.hxx | 1 + 1 file changed, 1 insertion(+) (limited to 'grapher/GraphData.hxx') diff --git a/grapher/GraphData.hxx b/grapher/GraphData.hxx index 9a267fc5..04f415f3 100644 --- a/grapher/GraphData.hxx +++ b/grapher/GraphData.hxx @@ -27,6 +27,7 @@ namespace systemtap } virtual std::string elementAsString(size_t element) = 0; // size of grid square at "normal" viewing + std::string name; double scale; double color[3]; GraphStyle* style; -- cgit