From 15246b4d719899bf9277e6445fa080340c1420f2 Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Wed, 7 Feb 2018 11:40:47 +0100 Subject: [PATCH] SVG: Set minimum canvas height to 100 This is necessary so that at least the header title and possibly the "No data" message are displayed. Signed-off-by: Sebastien GODARD --- sadf_misc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sadf_misc.c b/sadf_misc.c index 442abf8..d35b847 100644 --- a/sadf_misc.c +++ b/sadf_misc.c @@ -918,6 +918,7 @@ __printf_funct_t print_svg_header(void *parm, int action, char *dfile, struct file_activity *file_actlst) { struct svg_hdr_parm *hdr_parm = (struct svg_hdr_parm *) parm; + unsigned int height = 0; if (action & F_BEGIN) { printf("\n"); @@ -930,11 +931,15 @@ __printf_funct_t print_svg_header(void *parm, int action, char *dfile, } if (action & F_MAIN) { + height = SET_CANVAS_HEIGHT(flags) ? hdr_parm->graph_nr + : SVG_H_YSIZE + SVG_T_YSIZE * (hdr_parm->graph_nr); + if (height < 100) { + /* Min canvas height is 100 (at least to display "No data") */ + height = 100; + } printf(" width=\"%d\" height=\"%d\"" " fill=\"black\" stroke=\"gray\" stroke-width=\"1\">\n", - SVG_T_XSIZE * (hdr_parm->views_per_row), - SET_CANVAS_HEIGHT(flags) ? hdr_parm->graph_nr - : SVG_H_YSIZE + SVG_T_YSIZE * (hdr_parm->graph_nr)); + SVG_T_XSIZE * (hdr_parm->views_per_row), height); printf(""); print_gal_header(localtime((const time_t *) &(file_hdr->sa_ust_time)), file_hdr->sa_sysname, file_hdr->sa_release, -- 2.40.0