You are here

public function PHPExcel_Chart_Renderer_jpgraph::render in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Renderer/jpgraph.php \PHPExcel_Chart_Renderer_jpgraph::render()

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Renderer/jpgraph.php, line 768

Class

PHPExcel_Chart_Renderer_jpgraph
PHPExcel_Chart_Renderer_jpgraph

Code

public function render($outputDestination) {
  self::$_plotColour = 0;
  $groupCount = $this->_chart
    ->getPlotArea()
    ->getPlotGroupCount();
  $dimensions = null;
  if ($groupCount == 1) {
    $chartType = $this->_chart
      ->getPlotArea()
      ->getPlotGroupByIndex(0)
      ->getPlotType();
  }
  else {
    $chartTypes = array();
    for ($i = 0; $i < $groupCount; ++$i) {
      $chartTypes[] = $this->_chart
        ->getPlotArea()
        ->getPlotGroupByIndex($i)
        ->getPlotType();
    }
    $chartTypes = array_unique($chartTypes);
    if (count($chartTypes) == 1) {
      $chartType = array_pop($chartTypes);
    }
    elseif (count($chartTypes) == 0) {
      echo 'Chart is not yet implemented<br />';
      return false;
    }
    else {
      return $this
        ->_renderCombinationChart($groupCount, $dimensions, $outputDestination);
    }
  }
  switch ($chartType) {
    case 'area3DChart':
      $dimensions = '3d';
    case 'areaChart':
      $this
        ->_renderAreaChart($groupCount, $dimensions);
      break;
    case 'bar3DChart':
      $dimensions = '3d';
    case 'barChart':
      $this
        ->_renderBarChart($groupCount, $dimensions);
      break;
    case 'line3DChart':
      $dimensions = '3d';
    case 'lineChart':
      $this
        ->_renderLineChart($groupCount, $dimensions);
      break;
    case 'pie3DChart':
      $dimensions = '3d';
    case 'pieChart':
      $this
        ->_renderPieChart($groupCount, $dimensions, False, False);
      break;
    case 'doughnut3DChart':
      $dimensions = '3d';
    case 'doughnutChart':
      $this
        ->_renderPieChart($groupCount, $dimensions, True, True);
      break;
    case 'scatterChart':
      $this
        ->_renderScatterChart($groupCount);
      break;
    case 'bubbleChart':
      $this
        ->_renderBubbleChart($groupCount);
      break;
    case 'radarChart':
      $this
        ->_renderRadarChart($groupCount);
      break;
    case 'surface3DChart':
      $dimensions = '3d';
    case 'surfaceChart':
      $this
        ->_renderContourChart($groupCount, $dimensions);
      break;
    case 'stockChart':
      $this
        ->_renderStockChart($groupCount, $dimensions);
      break;
    default:
      echo $chartType . ' is not yet implemented<br />';
      return false;
  }
  $this
    ->_renderLegend();
  $this->_graph
    ->Stroke($outputDestination);
  return true;
}