- /* Draw the bottom whisker */
- cairo_move_to (cr, box_left, bottom_whisker);
- cairo_line_to (cr, box_right, bottom_whisker);
- 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);
-
- /* Draw centre line.
- (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);
-
- outliers = box_whisker_outliers (bw);
- for (ll = ll_head (outliers);
- ll != ll_null (outliers); ll = ll_next (ll))
- {
- const struct outlier *outlier = ll_data (ll, struct outlier, ll);
- draw_case (cr, geom, box_centre, outlier);
- }
-
- /* Draw tick mark on x axis */
- draw_tick(cr, geom, TICK_ABSCISSA, box_centre - geom->data_left, "%s", name);
-}
-
-static void
-boxplot_draw_yscale (cairo_t *cr, struct chart_geometry *geom,
- double y_max, double y_min)
-{
- double y_tick;
- double d;
-
- geom->y_max = y_max;
- geom->y_min = y_min;
-
- y_tick = chart_rounded_tick (fabs (geom->y_max - geom->y_min) / 5.0);
-
- geom->y_min = (ceil (geom->y_min / y_tick) - 1.0) * y_tick;
-
- geom->y_max = (floor (geom->y_max / y_tick) + 1.0) * y_tick;
-
- geom->ordinate_scale = (fabs (geom->data_top - geom->data_bottom)
- / fabs (geom->y_max - geom->y_min));
-
- for (d = geom->y_min; d <= geom->y_max; d += y_tick)
- draw_tick (cr, geom, TICK_ORDINATE,
- (d - geom->y_min) * geom->ordinate_scale, "%g", d);
-}
-
-static void
-boxplot_chart_draw (const struct chart *chart, cairo_t *cr,
- struct chart_geometry *geom)
-{
- const struct boxplot *boxplot = UP_CAST (chart, struct boxplot, chart);
- double box_width;
- size_t i;
-
- boxplot_draw_yscale (cr, geom, boxplot->y_max, boxplot->y_min);
- chart_write_title (cr, geom, "%s", boxplot->title);
-
- box_width = (geom->data_right - geom->data_left) / boxplot->n_boxes / 2.0;
- for (i = 0; i < boxplot->n_boxes; i++)
- {
- const struct box *box = &boxplot->boxes[i];
- const double box_centre = (i * 2 + 1) * box_width + geom->data_left;
- boxplot_draw_box (cr, geom, box_centre, box_width, box->bw, box->label);
- }
-}
-
-static void
-boxplot_chart_destroy (struct chart *chart)
-{
- struct boxplot *boxplot = UP_CAST (chart, struct boxplot, chart);