Ejemplo n.º 1
0
 /**
  * Parses the data from the charts
  *
  * @param 	$rawData	String 	Raw user-given data for the graph
  * @returns	 			pData	pData object containing the entered data
  */
 public function parseData($rawData)
 {
     parent::parseData($rawData);
     // Check whether there is only one series available
     // If not, cut other series
     $numSeries = count($this->pDataDescription["Values"]);
     // If there is no serie for size entered, enter all equal values
     // and make sure the data is consistent
     if ($numSeries == 0) {
         for ($i = 0; $i < count($this->pData); $i++) {
             $this->pData[$i]["Serie1"] = $i;
             $this->pData[$i]["Serie2"] = $i;
         }
         $this->pDataDescription["Values"][] = "Serie1";
         $this->pDataDescription["Values"][] = "Serie2";
         $this->pDataDescription["Description"]["Serie1"] = "";
         $this->pDataDescription["Description"]["Serie2"] = "";
     } elseif ($numSeries == 1) {
         // If only one number is given, that is taken as the X and Y value
         for ($i = 0; $i < count($this->pData); $i++) {
             $this->pData[$i]["Serie2"] = $this->pData[$i]["Serie1"];
         }
         $this->pDataDescription["Values"][] = "Serie2";
         $this->pDataDescription["Description"]["Serie2"] = "";
     }
     // Make a clean copy of the data description for showing the legend
     $this->pieLegendDataDescription = $this->pDataDescription;
     $this->pieLegendDataDescription["Values"] = array();
     $this->pieLegendDataDescription["Description"] = array();
     for ($i = 0; $i < count($this->pDataDescription["Values"]); $i += 2) {
         $seriename = $this->pDataDescription["Values"][$i];
         $this->pieLegendDataDescription["Values"][] = $seriename;
         $this->pieLegendDataDescription["Description"][$seriename] = $this->pDataDescription["Description"][$seriename];
     }
 }
Ejemplo n.º 2
0
 /**
  * Parses the data from the charts
  *
  * @param 	$rawData	String 	Raw user-given data for the graph
  * @returns	 			pData	pData object containing the entered data
  */
 public function parseData($rawData)
 {
     parent::parseData($rawData);
     // Check whether there is only one series available
     // If not, cut other series
     $numSeries = count($this->pDataDescription["Values"]);
     // If there is no serie for size entered, enter all equal values
     // and make sure the data is consistent
     if ($numSeries == 0) {
         for ($i = 0; $i < count($this->pData); $i++) {
             $this->pData[$i]["Serie1"] = $i;
             $this->pData[$i]["Serie2"] = $i;
             $this->pData[$i]["Serie3"] = 1;
         }
         $this->pDataDescription["Values"][] = "Serie1";
         $this->pDataDescription["Values"][] = "Serie2";
         $this->pDataDescription["Values"][] = "Serie3";
         $this->pDataDescription["Description"]["Serie1"] = "";
         $this->pDataDescription["Description"]["Serie2"] = "";
         $this->pDataDescription["Description"]["Serie3"] = "";
     } elseif ($numSeries == 1) {
         // If only one number is given, that is taken as the size
         for ($i = 0; $i < count($this->pData); $i++) {
             $this->pData[$i]["Serie3"] = $this->pData[$i]["Serie1"];
             $this->pData[$i]["Serie1"] = $i;
             $this->pData[$i]["Serie2"] = $i;
         }
         $this->pDataDescription["Values"][] = "Serie2";
         $this->pDataDescription["Values"][] = "Serie3";
         $this->pDataDescription["Description"]["Serie2"] = "";
         $this->pDataDescription["Description"]["Serie3"] = "";
     } elseif ($numSeries == 2) {
         // If only two numbers are given, the first is taken as X coordinate, the second as size
         for ($i = 0; $i < count($this->pData); $i++) {
             $this->pData[$i]["Serie3"] = $this->pData[$i]["Serie2"];
             $this->pData[$i]["Serie2"] = $i;
         }
         $this->pDataDescription["Values"][] = "Serie3";
         $this->pDataDescription["Description"]["Serie3"] = "";
     }
     // Make a clean copy of the data description for showing the legend
     $this->pieLegendDataDescription = $this->pDataDescription;
     $this->pieLegendDataDescription["Values"] = array();
     $this->pieLegendDataDescription["Description"] = array();
     // Copy all data to the pDataDescription structure
     $i = 0;
     foreach ($this->pData as $point) {
         $seriename = "Serie" . ($i + 1);
         $this->pieLegendDataDescription["Values"][] = $seriename;
         $this->pieLegendDataDescription["Description"][$seriename] = $point["Name"];
         $i++;
     }
 }
Ejemplo n.º 3
0
 /**
  * Parses the data from the charts
  *
  * @param 	$rawData	String 	Raw user-given data for the graph
  * @returns	 			pData	pData object containing the entered data
  */
 public function parseData($rawData)
 {
     parent::parseData($rawData);
     // Check whether there is only one series available
     // If not, cut other series
     $numSeries = count($this->pDataDescription["Values"]);
     // If there is no serie entered, enter all equal values
     // and make sure the data is consistent
     if ($numSeries == 0) {
         for ($i = 0; $i < count($this->pData); $i++) {
             $this->pData[$i]["Serie1"] = 1;
         }
         $this->pDataDescription["Values"][] = "Serie1";
         $this->pDataDescription["Description"]["Serie1"] = "";
     } elseif ($numSeries > 1) {
         // Remove data from all series above nr 1
         for ($j = 1; $j < $numSeries; $j++) {
             for ($i = 0; $i < count($this->pData); $i++) {
                 unset($this->pData[$i]["Serie" . ($j + 1)]);
             }
             unset($this->pDataDescription["Values"][$j]);
             unset($this->pDataDescription["Description"]["Serie" . ($j + 1)]);
         }
     }
     // Make a clean copy of the data description for showing the legend
     $this->pieLegendDataDescription = $this->pDataDescription;
     $this->pieLegendDataDescription["Values"] = array();
     $this->pieLegendDataDescription["Description"] = array();
     // Copy all data to the pDataDescription structure
     $i = 0;
     foreach ($this->pData as $point) {
         $seriename = "Serie" . ($i + 1);
         $this->pieLegendDataDescription["Values"][] = $seriename;
         $this->pieLegendDataDescription["Description"][$seriename] = $point["Name"];
         $i++;
     }
 }