diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-12-15 12:05:10 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-12-15 12:05:10 +0000 |
commit | e8592b4424a075c8301f8c78520a86c4cf51071e (patch) | |
tree | 00aaf8e66f8c4af8d2f873c8f323e93168201246 | |
parent | fcd72cae9f74e73d6278385b6468d298af08474c (diff) | |
download | gnunet-gtk-e8592b4424a075c8301f8c78520a86c4cf51071e.tar.gz gnunet-gtk-e8592b4424a075c8301f8c78520a86c4cf51071e.zip |
-also draw a line if we only have one data point
-rw-r--r-- | src/statistics/gtk_statistics.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/statistics/gtk_statistics.c b/src/statistics/gtk_statistics.c index bc7797f4..4b75b1ef 100644 --- a/src/statistics/gtk_statistics.c +++ b/src/statistics/gtk_statistics.c | |||
@@ -472,7 +472,22 @@ gtk_statistics_draw (GtkWidget *widget, | |||
472 | h += te.height / 2 + 1.0; | 472 | h += te.height / 2 + 1.0; |
473 | cairo_show_text (cr, vh->label); | 473 | cairo_show_text (cr, vh->label); |
474 | if (xmax == xmin) | 474 | if (xmax == xmin) |
475 | { | ||
476 | hv = &vh->history[vh->last_history_offset % MAX_HISTORY]; | ||
477 | ry = hv->y / (double) ymax; | ||
478 | ry = BORDER + tex_max.height / 2.0 + (1.0 - ry) * (height - BORDER * 2.0 - tey_max.height - tex_max.height); | ||
479 | /* if y-values are small, offset y-values a bit to allow overlapping curves to still show up */ | ||
480 | if (ymax < height / (priv->num_values * 4)) | ||
481 | ry += priv->num_values * 2 - (4 * i); | ||
482 | cairo_move_to (cr, | ||
483 | width - BORDER - tex_max.width / 2.0, | ||
484 | ry); | ||
485 | cairo_line_to (cr, | ||
486 | rx = tey_max.width + BORDER * 2.0, | ||
487 | ry); | ||
488 | cairo_stroke (cr); | ||
475 | continue; | 489 | continue; |
490 | } | ||
476 | 491 | ||
477 | for (j=0;j<vh->history_size;j++) | 492 | for (j=0;j<vh->history_size;j++) |
478 | { | 493 | { |