-static const struct chart_class histogram_chart_class;
-
-/* Write the legend of the chart */
-static void
-histogram_write_legend (plPlotter *lp, const struct chart_geometry *geom,
- double n, double mean, double stddev)
-{
- double y = geom->data_bottom;
- pl_savestate_r (lp);
-
- if (n != SYSMIS)
- {
- char *buf = xasprintf ("N = %.2f", n);
- pl_move_r (lp, geom->legend_left, y);
- pl_alabel_r (lp, 0, 'b', buf);
- y += geom->font_size * 1.5;
- free (buf);
- }
-
- if (mean != SYSMIS)
- {
- char *buf = xasprintf ("Mean = %.1f", mean);
- pl_fmove_r (lp,geom->legend_left, y);
- pl_alabel_r (lp, 0, 'b', buf);
- y += geom->font_size * 1.5;
- free (buf);
- }
-
- if (stddev != SYSMIS)
- {
- char *buf = xasprintf ("Std. Dev = %.2f", stddev);
- pl_fmove_r (lp, geom->legend_left, y);
- pl_alabel_r (lp, 0, 'b', buf);
- free (buf);
- }
-
- pl_restorestate_r (lp);
-}
-
-static void
-hist_draw_bar (plPlotter *lp, const struct chart_geometry *geom,
- const gsl_histogram *h, int bar)
-{
- double upper;
- double lower;
- double height;
-
- const size_t bins = gsl_histogram_bins (h);
- const double x_pos = (geom->data_right - geom->data_left) * bar / (double) bins ;
- const double width = (geom->data_right - geom->data_left) / (double) bins ;
-
- assert ( 0 == gsl_histogram_get_range (h, bar, &lower, &upper));
-
- assert ( upper >= lower);
-
- height = gsl_histogram_get (h, bar) *
- (geom->data_top - geom->data_bottom) / gsl_histogram_max_val (h);
-
- pl_savestate_r (lp);
- pl_move_r (lp,geom->data_left, geom->data_bottom);
- pl_fillcolor_r (lp,
- geom->fill_colour.red * 257,
- geom->fill_colour.green * 257,
- geom->fill_colour.blue * 257);
- pl_filltype_r (lp,1);
-
-
- pl_fboxrel_r (lp,
- x_pos, 0,
- x_pos + width, height);
-
- pl_restorestate_r (lp);
-
- draw_tick (lp, geom, TICK_ABSCISSA,
- x_pos + width / 2.0, "%g", (upper + lower) / 2.0);
-}
-
-struct histogram_chart
- {
- struct chart chart;
- gsl_histogram *gsl_hist;
- char *label;
- double n;
- double mean;
- double stddev;
- bool show_normal;
- };
-