You are here

private function PHPExcel_Chart_Renderer_jpgraph::_renderLegend 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::_renderLegend()
2 calls to PHPExcel_Chart_Renderer_jpgraph::_renderLegend()
PHPExcel_Chart_Renderer_jpgraph::render 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

File

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

Class

PHPExcel_Chart_Renderer_jpgraph
PHPExcel_Chart_Renderer_jpgraph

Code

private function _renderLegend() {
  $legend = $this->_chart
    ->getLegend();
  if (!is_null($legend)) {
    $legendPosition = $legend
      ->getPosition();
    $legendOverlay = $legend
      ->getOverlay();
    switch ($legendPosition) {
      case 'r':
        $this->_graph->legend
          ->SetPos(0.01, 0.5, 'right', 'center');

        //	right
        $this->_graph->legend
          ->SetColumns(1);
        break;
      case 'l':
        $this->_graph->legend
          ->SetPos(0.01, 0.5, 'left', 'center');

        //	left
        $this->_graph->legend
          ->SetColumns(1);
        break;
      case 't':
        $this->_graph->legend
          ->SetPos(0.5, 0.01, 'center', 'top');

        //	top
        break;
      case 'b':
        $this->_graph->legend
          ->SetPos(0.5, 0.99, 'center', 'bottom');

        //	bottom
        break;
      default:
        $this->_graph->legend
          ->SetPos(0.01, 0.01, 'right', 'top');

        //	top-right
        $this->_graph->legend
          ->SetColumns(1);
        break;
    }
  }
  else {
    $this->_graph->legend
      ->Hide();
  }
}