+#include <math.h>
+
+#include "libpspp/message.h"
+#include "libpspp/assertion.h"
+#include "libpspp/cast.h"
+#include "math/chart-geometry.h"
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+
+#include "gl/xalloc.h"
+
+void
+histogram_add (struct histogram *h, double y, double c)
+{
+ struct statistic *stat = &h->parent;
+ stat->accumulate (stat, NULL, c, 0, y);
+}
+
+static void
+acc (struct statistic *s, const struct ccase *cx UNUSED, double c, double cc UNUSED, double y)
+{
+ struct histogram *hist = UP_CAST (s, struct histogram, parent);
+
+ gsl_histogram_accumulate (hist->gsl_hist, y, c);
+}
+
+static void
+destroy (struct statistic *s)
+{
+ struct histogram *h = UP_CAST (s, struct histogram, parent);
+ gsl_histogram_free (h->gsl_hist);
+ free (s);
+}