From a7e3f92fb91bb4a139e5cdfda42aa4870ae0df95 Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Wed, 7 Feb 2018 14:29:05 +0100 Subject: [PATCH] SVG: Display grid on the whole width of the graph For very small files with just a few samples taken at a few seconds apart (e.g. 15 samples taken at 1 second interval) the background grid was not drawn on the whole width of the graph. Fix this. Signed-off-by: Sebastien GODARD --- svg_stats.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/svg_stats.c b/svg_stats.c index 6b618fe..524b249 100644 --- a/svg_stats.c +++ b/svg_stats.c @@ -657,7 +657,8 @@ void display_hgrid(double ypos, double yfactor, double lmax, int dp) * IN: * @xpos Gap between two vertical lines. * @xfactor Scaling factor on X axis. - * @v_gridnr Number of vertical lines to display. + * @v_gridnr Default number of vertical lines to display. The actual + * number may vary between this value and 2 times this value. * @svg_p SVG specific parameters (see draw_activity_graphs() function). *************************************************************************** */ @@ -670,7 +671,12 @@ void display_vgrid(long int xpos, double xfactor, int v_gridnr, struct svg_parm stamp.ust_time = svg_p->ust_time_ref; /* Only ust_time field needs to be set. TRUE_TIME not allowed */ - for (j = 0; (j <= v_gridnr) && (stamp.ust_time <= svg_p->ust_time_end); j++) { + /* + * What really matters to know when we should stop drawing vertical lines + * is the time end. v_gridnr is only informative and used to calculate + * the gap between two lines. + */ + for (j = 0; (j <= (2 * v_gridnr)) && (stamp.ust_time <= svg_p->ust_time_end); j++) { /* Display vertical lines */ sa_get_record_timestamp_struct(flags, &stamp, &rectime, NULL); -- 2.40.0