summaryrefslogtreecommitdiff
path: root/graph.c
diff options
context:
space:
mode:
authorStephen M. Cameron <stephenmcameron@gmail.com>2012-03-07 14:47:38 +0100
committerJens Axboe <axboe@kernel.dk>2012-03-07 14:47:38 +0100
commitcae0872709f690086f896f7327e136c7db7ba567 (patch)
tree9ff718a67797f3c2275153bd3474a14485aaba42 /graph.c
parentaaa71f68d61f1235aca91f0027130290571f480d (diff)
downloadfio-cae0872709f690086f896f7327e136c7db7ba567.tar.gz
fio-cae0872709f690086f896f7327e136c7db7ba567.tar.bz2
gfio: make empty graph show grid lines, not "No good data"
This is done by adding a bit of "invisible data" to the graph at the beginning. Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'graph.c')
-rw-r--r--graph.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/graph.c b/graph.c
index 1cd2caab..d97da595 100644
--- a/graph.c
+++ b/graph.c
@@ -431,6 +431,8 @@ void line_graph_draw(struct graph *g, cairo_t *cr)
cairo_set_line_width(cr, 1.5);
for (i = g->labels; i; i = i->next) {
first = 1;
+ if (i->r < 0) /* invisible data */
+ continue;
cairo_set_source_rgb(cr, i->r, i->g, i->b);
for (j = i->values; j; j = j->next) {
tx = ((getx(j) - minx) / (maxx - minx)) * (x2 - x1) + x1;
@@ -588,16 +590,22 @@ void graph_set_color(struct graph *gr, const char *label,
struct graph_label *i;
double r, g, b;
- r = fabs(red);
- g = fabs(green);
- b = fabs(blue);
-
- if (r > 1.0)
- r = 1.0;
- if (g > 1.0)
- g = 1.0;
- if (b > 1.0)
- b =1.0;
+ if (red < 0.0) { /* invisible color */
+ r = -1.0;
+ g = -1.0;
+ b = -1.0;
+ } else {
+ r = fabs(red);
+ g = fabs(green);
+ b = fabs(blue);
+
+ if (r > 1.0)
+ r = 1.0;
+ if (g > 1.0)
+ g = 1.0;
+ if (b > 1.0)
+ b =1.0;
+ }
for (i = gr->labels; i; i = i->next)
if (strcmp(i->label, label) == 0) {