From 39d55ef60b9074920a1a3fc3d0c0f8d51f303760 Mon Sep 17 00:00:00 2001 From: Kore Nordmann Date: Thu, 2 Nov 2006 09:05:43 +0000 Subject: - Implemented #009304: Possibility to format labels via callback --- src/charts/pie.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/charts') diff --git a/src/charts/pie.php b/src/charts/pie.php index 8396492..85bf7a2 100644 --- a/src/charts/pie.php +++ b/src/charts/pie.php @@ -87,13 +87,17 @@ class ezcGraphPieChart extends ezcGraphChart switch ( $dataset->displayType->default ) { case ezcGraph::PIE: + $displayLabel = ( $this->options->labelCallback !== null + ? call_user_func( $this->options->labelCallback, $label, $value, $value / $sum ) + : sprintf( $this->options->label, $label, $value, $value / $sum * 100 ) ); + $renderer->drawPieSegment( $boundings, new ezcGraphContext( $datasetName, $label ), $dataset->color[$label], $angle, $angle += $value / $sum * 360, - sprintf( $this->options->label, $label, $value, $value / $sum * 100 ), + $displayLabel, $dataset->highlight[$label] ); break; -- cgit v1.1