From dfcd839e61b5534039b1b9d15a95d8a6d2c1cfd0 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Wed, 10 Oct 2012 13:03:14 +0100 Subject: [PATCH] Suppress jpgraph rendered legend if not displayed in Excel; ensure that left or right legends display as single column for each entry --- Classes/PHPExcel/Chart/Renderer/jpgraph.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Classes/PHPExcel/Chart/Renderer/jpgraph.php b/Classes/PHPExcel/Chart/Renderer/jpgraph.php index cb6b7bb0..e03001e1 100644 --- a/Classes/PHPExcel/Chart/Renderer/jpgraph.php +++ b/Classes/PHPExcel/Chart/Renderer/jpgraph.php @@ -190,9 +190,11 @@ class PHPExcel_Chart_Renderer_jpgraph 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 @@ -202,8 +204,11 @@ class PHPExcel_Chart_Renderer_jpgraph 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(); } } // function _renderLegend()