You are here

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

File

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

Class

PHPExcel_Chart_Renderer_jpgraph
PHPExcel_Chart_Renderer_jpgraph

Code

private function _renderPlotScatter($groupID, $bubble) {
  $grouping = $this->_chart
    ->getPlotArea()
    ->getPlotGroupByIndex($groupID)
    ->getPlotGrouping();
  $scatterStyle = $bubbleSize = $this->_chart
    ->getPlotArea()
    ->getPlotGroupByIndex($groupID)
    ->getPlotStyle();
  $seriesCount = $this->_chart
    ->getPlotArea()
    ->getPlotGroupByIndex($groupID)
    ->getPlotSeriesCount();
  $seriesPlots = array();

  //	Loop through each data series in turn
  for ($i = 0; $i < $seriesCount; ++$i) {
    $dataValuesY = $this->_chart
      ->getPlotArea()
      ->getPlotGroupByIndex($groupID)
      ->getPlotCategoryByIndex($i)
      ->getDataValues();
    $dataValuesX = $this->_chart
      ->getPlotArea()
      ->getPlotGroupByIndex($groupID)
      ->getPlotValuesByIndex($i)
      ->getDataValues();
    foreach ($dataValuesY as $k => $dataValueY) {
      $dataValuesY[$k] = $k;
    }
    $seriesPlot = new ScatterPlot($dataValuesX, $dataValuesY);
    if ($scatterStyle == 'lineMarker') {
      $seriesPlot
        ->SetLinkPoints();
      $seriesPlot->link
        ->SetColor(self::$_colourSet[self::$_plotColour]);
    }
    elseif ($scatterStyle == 'smoothMarker') {
      $spline = new Spline($dataValuesY, $dataValuesX);
      list($splineDataY, $splineDataX) = $spline
        ->Get(count($dataValuesX) * self::$_width / 20);
      $lplot = new LinePlot($splineDataX, $splineDataY);
      $lplot
        ->SetColor(self::$_colourSet[self::$_plotColour]);
      $this->_graph
        ->Add($lplot);
    }
    if ($bubble) {
      $this
        ->_formatPointMarker($seriesPlot, 'dot');
      $seriesPlot->mark
        ->SetColor('black');
      $seriesPlot->mark
        ->SetSize($bubbleSize);
    }
    else {
      $marker = $this->_chart
        ->getPlotArea()
        ->getPlotGroupByIndex($groupID)
        ->getPlotValuesByIndex($i)
        ->getPointMarker();
      $this
        ->_formatPointMarker($seriesPlot, $marker);
    }
    $dataLabel = $this->_chart
      ->getPlotArea()
      ->getPlotGroupByIndex($groupID)
      ->getPlotLabelByIndex($i)
      ->getDataValue();
    $seriesPlot
      ->SetLegend($dataLabel);
    $this->_graph
      ->Add($seriesPlot);
  }
}