You are here

private function PHPExcel_Chart_Renderer_jpgraph::_renderPlotLine 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::_renderPlotLine()
3 calls to PHPExcel_Chart_Renderer_jpgraph::_renderPlotLine()
PHPExcel_Chart_Renderer_jpgraph::_renderAreaChart in vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Renderer/jpgraph.php
PHPExcel_Chart_Renderer_jpgraph::_renderCombinationChart in vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Renderer/jpgraph.php
PHPExcel_Chart_Renderer_jpgraph::_renderLineChart in vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Renderer/jpgraph.php

File

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

Class

PHPExcel_Chart_Renderer_jpgraph
PHPExcel_Chart_Renderer_jpgraph

Code

private function _renderPlotLine($groupID, $filled = false, $combination = false, $dimensions = '2d') {
  $grouping = $this->_chart
    ->getPlotArea()
    ->getPlotGroupByIndex($groupID)
    ->getPlotGrouping();
  $labelCount = count($this->_chart
    ->getPlotArea()
    ->getPlotGroupByIndex($groupID)
    ->getPlotValuesByIndex(0)
    ->getPointCount());
  if ($labelCount > 0) {
    $datasetLabels = $this->_chart
      ->getPlotArea()
      ->getPlotGroupByIndex($groupID)
      ->getPlotCategoryByIndex(0)
      ->getDataValues();
    $datasetLabels = $this
      ->_formatDataSetLabels($groupID, $datasetLabels, $labelCount);
    $this->_graph->xaxis
      ->SetTickLabels($datasetLabels);
  }
  $seriesCount = $this->_chart
    ->getPlotArea()
    ->getPlotGroupByIndex($groupID)
    ->getPlotSeriesCount();
  $seriesPlots = array();
  if ($grouping == 'percentStacked') {
    $sumValues = $this
      ->_percentageSumCalculation($groupID, $seriesCount);
  }

  //	Loop through each data series in turn
  for ($i = 0; $i < $seriesCount; ++$i) {
    $dataValues = $this->_chart
      ->getPlotArea()
      ->getPlotGroupByIndex($groupID)
      ->getPlotValuesByIndex($i)
      ->getDataValues();
    $marker = $this->_chart
      ->getPlotArea()
      ->getPlotGroupByIndex($groupID)
      ->getPlotValuesByIndex($i)
      ->getPointMarker();
    if ($grouping == 'percentStacked') {
      $dataValues = $this
        ->_percentageAdjustValues($dataValues, $sumValues);
    }

    //	Fill in any missing values in the $dataValues array
    $testCurrentIndex = 0;
    foreach ($dataValues as $k => $dataValue) {
      while ($k != $testCurrentIndex) {
        $dataValues[$testCurrentIndex] = null;
        ++$testCurrentIndex;
      }
      ++$testCurrentIndex;
    }
    $seriesPlot = new LinePlot($dataValues);
    if ($combination) {
      $seriesPlot
        ->SetBarCenter();
    }
    if ($filled) {
      $seriesPlot
        ->SetFilled(true);
      $seriesPlot
        ->SetColor('black');
      $seriesPlot
        ->SetFillColor(self::$_colourSet[self::$_plotColour++]);
    }
    else {

      //	Set the appropriate plot marker
      $this
        ->_formatPointMarker($seriesPlot, $marker);
    }
    $dataLabel = $this->_chart
      ->getPlotArea()
      ->getPlotGroupByIndex($groupID)
      ->getPlotLabelByIndex($i)
      ->getDataValue();
    $seriesPlot
      ->SetLegend($dataLabel);
    $seriesPlots[] = $seriesPlot;
  }
  if ($grouping == 'standard') {
    $groupPlot = $seriesPlots;
  }
  else {
    $groupPlot = new AccLinePlot($seriesPlots);
  }
  $this->_graph
    ->Add($groupPlot);
}