From 5891de489db0e172162279247fb633a719fa3756 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Mon, 7 Dec 2009 12:43:56 +0100 Subject: option to display graph times relative to the start time This avoids having humongous numbers displayed on the graphs' x axis. Also, the dialog for adding a data set to a graph was cleaned up. * grapher/graph-dialog.glade: Add check box for display of relative time and a label for the data set list. Force the list of data sets to be larger. * grapher/Graph.hxx (_timeBase): new member * grapher/Graph.cxx (draw): Subtract _timeBase from displayed time value. * grapher/GraphWidget.hxx (DataModelColumns): Add a column for a data set's title, which is optional at the moment. * grapher/GraphWidget.hxx (_globalTimeBase, _timeBaseInitialized, _relativeTimesButton, _displayRelativeTimes): new members * grapher/GraphWidget.hxx (GraphWidget): Hook up check button for displaying relative time. (on_expose_event): Determine base time if needed; set base time in graphs. (onDataDialogOpen): Insert graph data set's name (key) and title into the list of data sets. --- grapher/Graph.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'grapher/Graph.cxx') diff --git a/grapher/Graph.cxx b/grapher/Graph.cxx index b3429ef7..baa1182f 100644 --- a/grapher/Graph.cxx +++ b/grapher/Graph.cxx @@ -14,7 +14,7 @@ namespace systemtap _graphWidth(580), _graphHeight(180), _lineWidth(2), _autoScaling(true), _autoScrolling(true), _zoomFactor(1.0), _xOffset(20.0), _yOffset(0.0), - _playButton(new CairoPlayButton), + _playButton(new CairoPlayButton), _timeBase(0), _left(0), _right(1), _top(5.0), _bottom(0.0) { setOrigin(x, y); @@ -150,7 +150,7 @@ namespace systemtap cr->move_to(x, _yOffset); cr->line_to(x, _graphHeight); std::ostringstream stream; - stream << tickVal; + stream << (tickVal - _timeBase); Cairo::TextExtents extents; cr->get_text_extents(stream.str(), extents); // Room for this label? -- cgit