summaryrefslogtreecommitdiff
path: root/graph.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2012-03-15 10:52:38 +0100
committerJens Axboe <axboe@kernel.dk>2012-03-15 10:52:38 +0100
commitbb39379fa3eb5e5c42c68e2e146561c49e3309f2 (patch)
tree4866ddac4d0ab8b6fb228743c08a740cc8d87404 /graph.c
parent09d574e341c05aa1d61a33c19c05ec792bbf78a8 (diff)
downloadfio-bb39379fa3eb5e5c42c68e2e146561c49e3309f2.tar.gz
fio-bb39379fa3eb5e5c42c68e2e146561c49e3309f2.tar.bz2
graph: fix bar graph min/max displays
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'graph.c')
-rw-r--r--graph.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/graph.c b/graph.c
index a0f1b056..3f2ee6af 100644
--- a/graph.c
+++ b/graph.c
@@ -442,7 +442,14 @@ void bar_graph_draw(struct graph *bg, cairo_t *cr)
nlabels = count_labels(bg->labels);
space_per_label = (x2 - x1) / (double) nlabels;
+ /*
+ * Start bars at 0 unless we have negative values, otherwise we
+ * present a skewed picture comparing label X and X+1.
+ */
mindata = find_min_data(bg->labels);
+ if (mindata > 0)
+ mindata = 0;
+
maxdata = find_max_data(bg->labels);
if (fabs(maxdata - mindata) < 1e-20) {
@@ -452,8 +459,7 @@ void bar_graph_draw(struct graph *bg, cairo_t *cr)
return;
}
- graph_draw_y_ticks(bg, cr, x1, y1, x2, y2, mindata, maxdata, 10, 1);
-
+ maxdata = graph_draw_y_ticks(bg, cr, x1, y1, x2, y2, mindata, maxdata, 10, 1);
i = 0;
for (lb = bg->labels; lb; lb = lb->next) {
int nvalues;