From 61048d83fca0063d3205ccabe0c610346fca905b Mon Sep 17 00:00:00 2001 From: John Darrington Date: Tue, 16 Feb 2016 12:35:17 +0100 Subject: [PATCH] Boxplot: Do not attempt to draw whiskers if they are not defined --- src/output/charts/boxplot-cairo.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/output/charts/boxplot-cairo.c b/src/output/charts/boxplot-cairo.c index a35b277b8c..d798bc2abb 100644 --- a/src/output/charts/boxplot-cairo.c +++ b/src/output/charts/boxplot-cairo.c @@ -113,14 +113,20 @@ boxplot_draw_box (cairo_t *cr, const struct xrchart_geometry *geom, /* Draw centre line. (bottom half) */ - cairo_move_to (cr, box_centre, bottom_whisker); - cairo_line_to (cr, box_centre, box_bottom); - cairo_stroke (cr); + if (! isnan (whisker[0])) + { + cairo_move_to (cr, box_centre, bottom_whisker); + cairo_line_to (cr, box_centre, box_bottom); + cairo_stroke (cr); + } - /* (top half) */ - cairo_move_to (cr, box_centre, top_whisker); - cairo_line_to (cr, box_centre, box_top); - cairo_stroke (cr); + if (! isnan (whisker[1])) + { + /* (top half) */ + cairo_move_to (cr, box_centre, top_whisker); + cairo_line_to (cr, box_centre, box_top); + cairo_stroke (cr); + } outliers = box_whisker_outliers (bw); for (ll = ll_head (outliers); -- 2.30.2