GtkWidget *disk_util_frame;
};
-static void add_invisible_data(struct graph *g)
-{
- /*
- * This puts some invisible data into a graph so that it will
- * initially have some grid lines instead of "No good data"
- */
- graph_add_label(g, "invisible");
- graph_set_color(g, "invisible", INVISIBLE_COLOR, 0.0, 0.7);
- graph_add_xy_data(g, "invisible", 0.0, 0.0);
- graph_add_xy_data(g, "invisible", 1.0, 100.0);
-}
-
static void setup_iops_graph(struct gui *ui)
{
if (ui->iops_graph)
graph_add_label(ui->iops_graph, "Write IOPS");
graph_set_color(ui->iops_graph, "Read IOPS", 0.13, 0.54, 0.13);
graph_set_color(ui->iops_graph, "Write IOPS", 1.0, 0.0, 0.0);
- add_invisible_data(ui->iops_graph);
line_graph_set_data_count_limit(ui->iops_graph, 100);
}
graph_add_label(ui->bandwidth_graph, "Write Bandwidth");
graph_set_color(ui->bandwidth_graph, "Read Bandwidth", 0.13, 0.54, 0.13);
graph_set_color(ui->bandwidth_graph, "Write Bandwidth", 1.0, 0.0, 0.0);
- add_invisible_data(ui->bandwidth_graph);
line_graph_set_data_count_limit(ui->bandwidth_graph, 100);
}
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);
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;
}
cairo_stroke(cr);
}
+
+skip_data:
cairo_restore(cr);
+
}
static void gfree(void *f)