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/StapParser.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'grapher/StapParser.cxx') diff --git a/grapher/StapParser.cxx b/grapher/StapParser.cxx index 9e42dab6..ddc14b2d 100644 --- a/grapher/StapParser.cxx +++ b/grapher/StapParser.cxx @@ -25,7 +25,7 @@ vector commaSplit(const boost::sub_range& range) } void StapParser::parseData(shared_ptr gdata, - double time, const string& dataString) + int64_t time, const string& dataString) { std::istringstream stream(dataString); shared_ptr > dblptr; @@ -182,7 +182,7 @@ vector commaSplit(const boost::sub_range& range) { vector tokens = commaSplit(dataString); int i = 0; - double time; + int64_t time; vector::iterator tokIter = tokens.begin(); std::istringstream timeStream(*tokIter++); timeStream >> time; @@ -196,7 +196,7 @@ vector commaSplit(const boost::sub_range& range) } else { - double time; + int64_t time; string data; stream >> time >> data; parseData(itr->second, time, data); -- 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/StapParser.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'grapher/StapParser.cxx') diff --git a/grapher/StapParser.cxx b/grapher/StapParser.cxx index ddc14b2d..af5f2d7d 100644 --- a/grapher/StapParser.cxx +++ b/grapher/StapParser.cxx @@ -102,7 +102,7 @@ vector commaSplit(const boost::sub_range& range) std::tr1::shared_ptr > dataSet(new GraphData); if (style == "dot") - dataSet->style = GraphDataBase::DOT; + dataSet->style = &GraphStyleDot::instance; dataSet->color[0] = (hexColor >> 16) / 255.0; dataSet->color[1] = ((hexColor >> 8) & 0xff) / 255.0; dataSet->color[2] = (hexColor & 0xff) / 255.0; @@ -114,7 +114,7 @@ vector commaSplit(const boost::sub_range& range) { std::tr1::shared_ptr > dataSet(new GraphData); - dataSet->style = GraphDataBase::EVENT; + dataSet->style = &GraphStyleEvent::instance; dataSet->color[0] = (hexColor >> 16) / 255.0; dataSet->color[1] = ((hexColor >> 8) & 0xff) / 255.0; dataSet->color[2] = (hexColor & 0xff) / 255.0; -- 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/StapParser.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'grapher/StapParser.cxx') diff --git a/grapher/StapParser.cxx b/grapher/StapParser.cxx index af5f2d7d..6218e229 100644 --- a/grapher/StapParser.cxx +++ b/grapher/StapParser.cxx @@ -101,6 +101,7 @@ vector commaSplit(const boost::sub_range& range) { std::tr1::shared_ptr > dataSet(new GraphData); + dataSet->name = setName; if (style == "dot") dataSet->style = &GraphStyleDot::instance; dataSet->color[0] = (hexColor >> 16) / 255.0; @@ -114,6 +115,7 @@ vector commaSplit(const boost::sub_range& range) { std::tr1::shared_ptr > dataSet(new GraphData); + dataSet->name = setName; dataSet->style = &GraphStyleEvent::instance; dataSet->color[0] = (hexColor >> 16) / 255.0; dataSet->color[1] = ((hexColor >> 8) & 0xff) / 255.0; -- cgit