X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fcharts%2Fboxplot-cairo.c;h=516fe6423e4e5f240db8d47f641da358c5964c38;hb=38f1759deae638712ed86675914c123ffb04f5ba;hp=a35b277b8cfa97154399b7a4f9018acfa07c7886;hpb=aad0ae4913ecd01ccc954f8828623ad5da35cd1b;p=pspp diff --git a/src/output/charts/boxplot-cairo.c b/src/output/charts/boxplot-cairo.c index a35b277b8c..516fe6423e 100644 --- a/src/output/charts/boxplot-cairo.c +++ b/src/output/charts/boxplot-cairo.c @@ -57,10 +57,10 @@ boxplot_draw_box (cairo_t *cr, const struct xrchart_geometry *geom, const double box_right = box_centre + box_width / 2.0; - double box_bottom ; - double box_top ; - double bottom_whisker ; - double top_whisker ; + double box_bottom; + double box_top; + double bottom_whisker; + double top_whisker; box_whisker_whiskers (bw, whisker); box_whisker_hinges (bw, hinge); @@ -107,20 +107,29 @@ boxplot_draw_box (cairo_t *cr, const struct xrchart_geometry *geom, cairo_stroke (cr); /* Draw top whisker */ - cairo_move_to (cr, box_left, top_whisker); - cairo_line_to (cr, box_right, top_whisker); - cairo_stroke (cr); + if (! isnan (top_whisker) ) + { + cairo_move_to (cr, box_left, top_whisker); + cairo_line_to (cr, box_right, top_whisker); + cairo_stroke (cr); + } - /* Draw centre line. - (bottom half) */ - cairo_move_to (cr, box_centre, bottom_whisker); - cairo_line_to (cr, box_centre, box_bottom); - cairo_stroke (cr); + /* Draw centre line. */ + if (! isnan (bottom_whisker) && ! isnan (box_bottom)) + { + /* (bottom half) */ + 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 (top_whisker) && ! isnan (box_top)) + { + /* (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);