}
static void
-piechart_draw (const struct chart *chart, plPlotter *lp)
+piechart_draw (const struct chart *chart, plPlotter *lp,
+ struct chart_geometry *geom)
{
struct piechart *pie = (struct piechart *) chart;
- struct chart_geometry geom;
double total_magnitude;
double left_label, right_label;
double centre_x, centre_y;
double angle;
int i;
- chart_geometry_init (lp, &geom);
+ left_label = geom->data_left + (geom->data_right - geom->data_left)/10.0;
+ right_label = geom->data_right - (geom->data_right - geom->data_left)/10.0;
- left_label = geom.data_left + (geom.data_right - geom.data_left)/10.0;
- right_label = geom.data_right - (geom.data_right - geom.data_left)/10.0;
+ centre_x = (geom->data_right + geom->data_left) / 2.0 ;
+ centre_y = (geom->data_top + geom->data_bottom) / 2.0 ;
- centre_x = (geom.data_right + geom.data_left) / 2.0 ;
- centre_y = (geom.data_top + geom.data_bottom) / 2.0 ;
+ radius = MIN (5.0 / 12.0 * (geom->data_top - geom->data_bottom),
+ 1.0 / 4.0 * (geom->data_right - geom->data_left));
- radius = MIN (5.0 / 12.0 * (geom.data_top - geom.data_bottom),
- 1.0 / 4.0 * (geom.data_right - geom.data_left));
-
- chart_write_title (lp, &geom, "%s", pie->title);
+ chart_write_title (lp, geom, "%s", pie->title);
total_magnitude = 0.0;
for (i = 0; i < pie->n_slices; i++)
/* Draw an outline to the pie */
pl_filltype_r (lp,0);
pl_fcircle_r (lp, centre_x, centre_y, radius);
-
- chart_geometry_free (lp);
}
/* Fill a segment with the current fill colour */