summaryrefslogtreecommitdiff
path: root/graph.c
diff options
context:
space:
mode:
authorStephen M. Cameron <stephenmcameron@gmail.com>2012-03-07 19:37:25 +0100
committerJens Axboe <axboe@kernel.dk>2012-03-07 19:37:25 +0100
commit9ce9cfbd6ab2a821aa31cedf64ec3e8c0729a4fc (patch)
tree1cc3b78efcbe454b4aaf28814917cec43ee0ada6 /graph.c
parent17ba3e42947189008c582fc974b4214580ceea92 (diff)
downloadfio-9ce9cfbd6ab2a821aa31cedf64ec3e8c0729a4fc.tar.gz
fio-9ce9cfbd6ab2a821aa31cedf64ec3e8c0729a4fc.tar.bz2
gfio: get rid of invisible data
At first the invisible data seemed like an elegant way to get reasonable graph ticks when no data was really present, but it proved to be an ugly hack that caused other problems later,e.g. when you want to cap other data so the xy graph scrolls, the invisible data kept it from scrolling, etc. Signed-off-by: Stephen M. Cameron <stephenmcameron@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'graph.c')
-rw-r--r--graph.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/graph.c b/graph.c
index 663fe380..d3fcb8db 100644
--- a/graph.c
+++ b/graph.c
@@ -402,7 +402,7 @@ void line_graph_draw(struct graph *g, cairo_t *cr)
double tx, ty;
struct graph_label *i;
struct graph_value *j;
- int first = 1;
+ int good_data = 1, first = 1;
cairo_save(cr);
graph_draw_common(g, cr, &x1, &y1, &x2, &y2);
@@ -413,15 +413,19 @@ void line_graph_draw(struct graph *g, cairo_t *cr)
maxy = find_xy_value(g, gety, maxdouble);
if (fabs(maxx - minx) < 1e-20 || fabs(maxy - miny) < 1e-20) {
- draw_centered_text(g, cr,
- x1 + (x2 - x1) / 2.0,
- y1 + (y2 - y1) / 2.0, 20.0, "No good Data");
- return;
+ good_data = 0;
+ minx = 0.0;
+ miny = 0.0;
+ maxx = 10.0;
+ maxy = 100.0;
}
graph_draw_x_ticks(g, cr, x1, y1, x2, y2, minx, maxx, 10);
graph_draw_y_ticks(g, cr, x1, y1, x2, y2, miny, maxy, 10);
+ if (!good_data)
+ goto skip_data;
+
cairo_set_line_width(cr, 1.5);
for (i = g->labels; i; i = i->next) {
first = 1;
@@ -440,7 +444,10 @@ void line_graph_draw(struct graph *g, cairo_t *cr)
}
cairo_stroke(cr);
}
+
+skip_data:
cairo_restore(cr);
+
}
static void gfree(void *f)