From 234d049e3d1a1fff6814d8a65547a6a96c9a8344 Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Fri, 25 Mar 2016 13:05:47 +0100 Subject: [PATCH] SVG: Set a min value on Y axis Set a min value on Y axis so that graduations remain meaningful. For instance, if the max value for a graph was 0.01 then the graduations on the Y axis were 0.01, 0.01 and 0.01 (for 3 horizontal lines). In this case, this patch will set the max value to 0.03 to get some meaningful graduations values: 0.01, 0.02 and 0.03. Signed-off-by: Sebastien GODARD --- svg_stats.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/svg_stats.c b/svg_stats.c index 0e273f3..3a73377 100644 --- a/svg_stats.c +++ b/svg_stats.c @@ -573,7 +573,11 @@ void draw_activity_graphs(int g_nr, int g_type, char *title[], char *g_title[], else { lmax = *(spmax + pos); } - ypos = ygrid(*(spmax + pos), &dp); + /* Max value cannot be too small, else Y graduations will be meaningless */ + if (lmax < SVG_H_GRIDNR * 0.01) { + lmax = SVG_H_GRIDNR * 0.01; + } + ypos = ygrid(lmax, &dp); } else { /* For bar graphs (used for %values) */ -- 2.49.0