src/output/cairo.c (xr_chart_render): New variable chart_height
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 9 Sep 2017 17:46:58 +0000 (19:46 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 10 Sep 2017 17:51:07 +0000 (19:51 +0200)
src/output/cairo.c

index 045490992e1a9efce7eed26474e185ed4e212f01..8cb504d2dd0e877309fb916a241e69439de031bc 100644 (file)
@@ -1542,13 +1542,20 @@ xr_chart_render (struct xr_render_fsm *fsm, struct xr_driver *xr)
 {
   struct xr_chart_state *cs = UP_CAST (fsm, struct xr_chart_state, fsm);
 
-  if (xr->y > 0)
+  const int chart_height = xr->length;
+
+  if (xr->y > xr->length - chart_height)
     return true;
 
   if (xr->cairo != NULL)
-    xr_draw_chart (cs->chart_item, xr->cairo, 0.0, 0.0,
-                   xr_to_pt (xr->width), xr_to_pt (xr->length));
-  xr->y = xr->length;
+    {
+      xr_draw_chart (cs->chart_item, xr->cairo,
+                    0.0,
+                    xr_to_pt (xr->y),
+                    xr_to_pt (xr->width),
+                    xr_to_pt (chart_height));
+    }
+  xr->y += chart_height;
 
   return false;
 }