Merge "master" into "output".
[pspp] / src / output / charts / plot-hist.c
index b7586a18f102980e5b902059ee0ebf58a45a418b..334818b4cad9428975f8c2e1623ea567ff57ac5c 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright  (C) 2004, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -28,6 +28,7 @@
 #include <output/chart-provider.h>
 
 #include <data/variable.h>
+#include <libpspp/cast.h>
 #include <libpspp/hash.h>
 #include <output/chart.h>
 #include <math/histogram.h>
@@ -50,7 +51,7 @@ histogram_write_legend (cairo_t *cr, const struct chart_geometry *geom,
     {
       char *buf = xasprintf ("N = %.2f", n);
       cairo_move_to (cr, geom->legend_left, y);
-      chart_label (cr, 'l', 'b', buf);
+      chart_label (cr, 'l', 'b', geom->font_size, buf);
       y += geom->font_size * 1.5;
       free (buf);
     }
@@ -59,7 +60,7 @@ histogram_write_legend (cairo_t *cr, const struct chart_geometry *geom,
     {
       char *buf = xasprintf ("Mean = %.1f", mean);
       cairo_move_to (cr,geom->legend_left, y);
-      chart_label (cr, 'l', 'b', buf);
+      chart_label (cr, 'l', 'b', geom->font_size, buf);
       y += geom->font_size * 1.5;
       free (buf);
     }
@@ -68,7 +69,7 @@ histogram_write_legend (cairo_t *cr, const struct chart_geometry *geom,
     {
       char *buf = xasprintf ("Std. Dev = %.2f", stddev);
       cairo_move_to (cr, geom->legend_left, y);
-      chart_label (cr, 'l', 'b', buf);
+      chart_label (cr, 'l', 'b', geom->font_size, buf);
       free (buf);
     }
 
@@ -146,7 +147,7 @@ static void
 histogram_chart_draw (const struct chart *chart, cairo_t *cr,
                       struct chart_geometry *geom)
 {
-  struct histogram_chart *h = (struct histogram_chart *) chart;
+  struct histogram_chart *h = UP_CAST (chart, struct histogram_chart, chart);
   int i;
   int bins;
 
@@ -208,7 +209,7 @@ histogram_chart_draw (const struct chart *chart, cairo_t *cr,
 static void
 histogram_chart_destroy (struct chart *chart)
 {
-  struct histogram_chart *h = (struct histogram_chart *) chart;
+  struct histogram_chart *h = UP_CAST (chart, struct histogram_chart, chart);
   if (h->gsl_hist != NULL)
     gsl_histogram_free (h->gsl_hist);
   free (h->label);