You are here

function pPie::clean0Values in Visitors 7.2

Same name and namespace in other branches
  1. 7 pChart/class/pPie.class.php \pPie::clean0Values()
4 calls to pPie::clean0Values()
pPie::draw2DPie in pChart/class/pPie.class.php
pPie::draw2DRing in pChart/class/pPie.class.php
pPie::draw3DPie in pChart/class/pPie.class.php
pPie::draw3DRing in pChart/class/pPie.class.php

File

pChart/class/pPie.class.php, line 1476

Class

pPie

Code

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

  /* 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,
  );
}