Correct geometrical error plotting histograms
authorJohn Darrington <john@darrington.wattle.id.au>
Tue, 20 Mar 2012 18:49:05 +0000 (19:49 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 20 Mar 2012 17:40:11 +0000 (18:40 +0100)
src/output/charts/plot-hist-cairo.c

index d000a1ac21e26f2961e80b6ced90c94932ee94ff..7c09b6df73091a799cfd1c8fa729f2396ba442c2 100644 (file)
@@ -81,8 +81,9 @@ hist_draw_bar (cairo_t *cr, const struct xrchart_geometry *geom,
 
   assert ( upper >= lower);
 
-  height = gsl_histogram_get (h, bar) *
-    (geom->data_top - geom->data_bottom) / gsl_histogram_max_val (h);
+  height = gsl_histogram_get (h, bar) /
+    (geom->y_max - geom->y_min) *
+    (geom->data_top - geom->data_bottom);
 
   cairo_rectangle (cr, geom->data_left + x_pos, geom->data_bottom,
                    width, height);