summaryrefslogtreecommitdiffstats
path: root/grapher/Graph.hxx
diff options
context:
space:
mode:
authorTim Moore <timoore@redhat.com>2009-12-22 19:48:20 +0100
committerTim Moore <timoore@redhat.com>2009-12-23 00:09:19 +0100
commit4fca37ae3561da7d0664e0f943146398a8e554dd (patch)
tree6fefd7787f878001961b904cf02ada6cae556d7b /grapher/Graph.hxx
parent33dc14f9790c82669f48abe40662bee1314f5741 (diff)
downloadsystemtap-steved-4fca37ae3561da7d0664e0f943146398a8e554dd.tar.gz
systemtap-steved-4fca37ae3561da7d0664e0f943146398a8e554dd.tar.xz
systemtap-steved-4fca37ae3561da7d0664e0f943146398a8e554dd.zip
grapher: scale from right end of graph
The right side of the graph represents the most recent time. Since there is never anything interesting to the right of that, it makes sense to have the origin of the scaling be there. * grapher/Graph.hxx (getHorizontalScale): new function * grapher/GraphStyle.cxx (GraphStyleBar::draw, GraphStyleDot::draw, GraphStyleEvent::draw): Use cairo transform functions to set up scaling. (GraphStyleBar::dataIndexAtPoint, GraphStyleEvent::dataIndexAtPoint): Base calculations on scaling from right.
Diffstat (limited to 'grapher/Graph.hxx')
-rw-r--r--grapher/Graph.hxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/grapher/Graph.hxx b/grapher/Graph.hxx
index d9f615b3..0853d988 100644
--- a/grapher/Graph.hxx
+++ b/grapher/Graph.hxx
@@ -51,6 +51,14 @@ public:
int64_t getTimeAtPoint(double x);
void window2GraphCoords(double x, double y, double& xgraph, double& ygraph);
static void setCurrentTime(int64_t time) { _currentTime = time; }
+
+ /*
+ * universal horizontal factor
+ */
+ double getHorizontalScale()
+ {
+ return _zoomFactor * _graphWidth / static_cast<double>(_right - _left);
+ }
protected:
GraphDataList _datasets;
int64_t _left;