/**
  *	DATA PROCESSING FUNCTIONS
  **/
 public static function formatDataForChartType($chartType, $data, $dimensionsByKey, $times, $groupByVariable = false, $mainDimension = false, $otherDimIds = false, $entity = false)
 {
     $normalizedData = [];
     switch ($chartType) {
         case "1":
         case "4":
         case "5":
             $normalizedData = Chart::formatDataForLineChart($data, $dimensionsByKey, $times, $groupByVariable, $mainDimension);
             break;
         case "2":
             $normalizedData = Chart::formatDataForScatterPlotChart($data, $dimensionsByKey, $times, $groupByVariable, $mainDimension, $otherDimIds);
             break;
         case "3":
             $normalizedData = !$groupByVariable ? Chart::formatDataForStackBarChart($data, $dimensionsByKey, $times, $groupByVariable) : Chart::formatDataForStackBarChartByVariable($data, $dimensionsByKey, $times, $entity);
             break;
         case "6":
             $normalizedData = Chart::formatDataForDiscreteBarChart($data, $dimensionsByKey, $times, $groupByVariable, $mainDimension, $otherDimIds);
             break;
         case "9999":
             //map case - has only one dimension
             $dimension = reset($dimensionsByKey);
             $normalizedData = Chart::formatDataForMap($data, $dimension, $times);
             break;
     }
     return $normalizedData;
 }
Ejemplo n.º 2
0
 /**
  *	DATA PROCESSING FUNCTIONS
  **/
 public static function formatDataForChartType($chartType, $data, $dimensionsByKey, $times, $groupByVariable = false, $mainDimension = false, $otherDimIds = false, $entity = false)
 {
     $normalizedData = [];
     switch ($chartType) {
         case "1":
             $normalizedData = Chart::formatDataForLineChart($data, $dimensionsByKey, $times, $groupByVariable, $mainDimension);
             break;
         case "2":
             $normalizedData = Chart::formatDataForScatterPlotChart($data, $dimensionsByKey, $times, $groupByVariable, $mainDimension, $otherDimIds);
             break;
         case "3":
             $normalizedData = !$groupByVariable ? Chart::formatDataForStackBarChart($data, $dimensionsByKey, $times, $groupByVariable) : Chart::formatDataForStackBarChartByVariable($data, $dimensionsByKey, $times, $entity);
             break;
     }
     return $normalizedData;
 }