summaryrefslogtreecommitdiffstats
path: root/src/charts
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2007-09-05 08:50:23 +0000
committerKore Nordmann <github@kore-nordmann.de>2007-09-05 08:50:23 +0000
commitd0370fe7c59d1a70c527c413389679b1d42bab10 (patch)
treec27888abb8b22ef28d51037269a8909947e4937b /src/charts
parent59192857ba65c14388bbe5b1633a4f1ac346e9d1 (diff)
downloadzetacomponents-graph-d0370fe7c59d1a70c527c413389679b1d42bab10.zip
zetacomponents-graph-d0370fe7c59d1a70c527c413389679b1d42bab10.tar.gz
- Implemented feature #11325: Allow values of 0 to be added to pie charts, to
be included in the legend and not rendered in the actual pie.
Diffstat (limited to 'src/charts')
-rw-r--r--src/charts/pie.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/charts/pie.php b/src/charts/pie.php
index f99766b..ff611a7 100644
--- a/src/charts/pie.php
+++ b/src/charts/pie.php
@@ -96,9 +96,9 @@ class ezcGraphPieChart extends ezcGraphChart
$sum = 0;
foreach ( $dataset as $name => $value )
{
- if ( $value <= 0 )
+ if ( $value < 0 )
{
- throw new ezcGraphInvalidDataException( "Values > 0 required, '$name' => '$value'." );
+ throw new ezcGraphInvalidDataException( "Values >= 0 required, '$name' => '$value'." );
}
$sum += $value;
@@ -116,6 +116,12 @@ class ezcGraphPieChart extends ezcGraphChart
$angle = 0;
foreach ( $dataset as $label => $value )
{
+ // Skip rendering values which equals 0
+ if ( $value <= 0 )
+ {
+ continue;
+ }
+
switch ( $dataset->displayType->default )
{
case ezcGraph::PIE:
OpenPOWER on IntegriCloud