function pPie::clean0Values

5.x pPie.class.php pPie::clean0Values($Data, $Palette, $DataSerie, $AbscissaSerie)
4 calls to pPie::clean0Values()
pPie::draw2DPie in inc/pchart/pchart/class/pPie.class.php
pPie::draw2DRing in inc/pchart/pchart/class/pPie.class.php
pPie::draw3DPie in inc/pchart/pchart/class/pPie.class.php
pPie::draw3DRing in inc/pchart/pchart/class/pPie.class.php

File

inc/pchart/pchart/class/pPie.class.php, line 1476

Class

pPie

Code

function clean0Values($Data, $Palette, $DataSerie, $AbscissaSerie) 
 {
  $NewPalette = array();
  $NewData = array();
  $NewAbscissa = array();

  /* Remove unused series */
  foreach ($Data ["Series"] as $SerieName => $SerieSettings) 
   {
    if ($SerieName != $DataSerie && $SerieName != $AbscissaSerie) {
      unset($Data ["Series"][$SerieName]);
    }
  }

  /* Remove NULL values */
  foreach ($Data ["Series"][$DataSerie]["Data"] as $Key => $Value) 
   {
    if ($Value != 0) 
     {
      $NewData [] = $Value;
      $NewAbscissa [] = $Data ["Series"][$AbscissaSerie]["Data"][$Key];
      if (isset($Palette [$Key])) {
        $NewPalette [] = $Palette [$Key];
      }
    }
  }
  $Data ["Series"][$DataSerie]["Data"] = $NewData;
  $Data ["Series"][$AbscissaSerie]["Data"] = $NewAbscissa;

  return (array($Data, $NewPalette));
}