Respect forground and background options when writing PNG charts.
[pspp] / src / output / charts / plot-hist-cairo.c
index ca1a30807a5bf195f0b358b9032a32f950c74e08..a9a5d44f58b475aef164f8fe9077008d4264ece8 100644 (file)
@@ -86,9 +86,7 @@ hist_draw_bar (cairo_t *cr, const struct xrchart_geometry *geom,
 
   assert ( upper >= lower);
 
-  height = gsl_histogram_get (h, bar) /
-    (geom->axis[SCALE_ORDINATE].max - geom->axis[SCALE_ORDINATE].min) *
-    (geom->axis[SCALE_ORDINATE].data_max - geom->axis[SCALE_ORDINATE].data_min);
+  height = geom->axis[SCALE_ORDINATE].scale * gsl_histogram_get (h, bar);
 
   cairo_rectangle (cr,
                   geom->axis[SCALE_ABSCISSA].data_min + x_pos,
@@ -104,7 +102,7 @@ hist_draw_bar (cairo_t *cr, const struct xrchart_geometry *geom,
   cairo_stroke (cr);
 
   if (label)
-    draw_tick (cr, geom, SCALE_ABSCISSA,
+    draw_tick (cr, geom, SCALE_ABSCISSA, bins > 10,
               x_pos + width / 2.0, "%g", (upper + lower) / 2.0);
 }