From 1600961140dfe86e39fc3a855e42821d850f8462 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Sun, 4 Mar 2012 11:15:46 +0000 Subject: [PATCH] Minor fix to chart dataseries for charts with only one series git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@87266 2327b42d-5241-43d6-9e2a-de5ac946f064 --- Classes/PHPExcel/Chart/DataSeries.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Classes/PHPExcel/Chart/DataSeries.php b/Classes/PHPExcel/Chart/DataSeries.php index 3b63613..387e42a 100644 --- a/Classes/PHPExcel/Chart/DataSeries.php +++ b/Classes/PHPExcel/Chart/DataSeries.php @@ -234,9 +234,10 @@ class PHPExcel_Chart_DataSeries */ public function getPlotLabelByIndex($index) { $keys = array_keys($this->_plotLabel); - if (isset($keys[$index])) { - $index = $keys[$index]; + if (in_array($index,$keys)) { return $this->_plotLabel[$index]; + } elseif(isset($keys[$index])) { + return $this->_plotLabel[$keys[$index]]; } return false; } @@ -257,9 +258,10 @@ class PHPExcel_Chart_DataSeries */ public function getPlotCategoryByIndex($index) { $keys = array_keys($this->_plotCategory); - if (isset($keys[$index])) { - $index = $keys[$index]; + if (in_array($index,$keys)) { return $this->_plotCategory[$index]; + } elseif(isset($keys[$index])) { + return $this->_plotCategory[$keys[$index]]; } return false; } @@ -298,9 +300,10 @@ class PHPExcel_Chart_DataSeries */ public function getPlotValuesByIndex($index) { $keys = array_keys($this->_plotValues); - if (isset($keys[$index])) { - $index = $keys[$index]; + if (in_array($index,$keys)) { return $this->_plotValues[$index]; + } elseif(isset($keys[$index])) { + return $this->_plotValues[$keys[$index]]; } return false; }