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
This commit is contained in:
Mark Baker 2012-03-04 11:15:46 +00:00
parent c275bf7a8d
commit 1600961140
1 changed files with 9 additions and 6 deletions

View File

@ -234,9 +234,10 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotLabelByIndex($index) { public function getPlotLabelByIndex($index) {
$keys = array_keys($this->_plotLabel); $keys = array_keys($this->_plotLabel);
if (isset($keys[$index])) { if (in_array($index,$keys)) {
$index = $keys[$index];
return $this->_plotLabel[$index]; return $this->_plotLabel[$index];
} elseif(isset($keys[$index])) {
return $this->_plotLabel[$keys[$index]];
} }
return false; return false;
} }
@ -257,9 +258,10 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotCategoryByIndex($index) { public function getPlotCategoryByIndex($index) {
$keys = array_keys($this->_plotCategory); $keys = array_keys($this->_plotCategory);
if (isset($keys[$index])) { if (in_array($index,$keys)) {
$index = $keys[$index];
return $this->_plotCategory[$index]; return $this->_plotCategory[$index];
} elseif(isset($keys[$index])) {
return $this->_plotCategory[$keys[$index]];
} }
return false; return false;
} }
@ -298,9 +300,10 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotValuesByIndex($index) { public function getPlotValuesByIndex($index) {
$keys = array_keys($this->_plotValues); $keys = array_keys($this->_plotValues);
if (isset($keys[$index])) { if (in_array($index,$keys)) {
$index = $keys[$index];
return $this->_plotValues[$index]; return $this->_plotValues[$index];
} elseif(isset($keys[$index])) {
return $this->_plotValues[$keys[$index]];
} }
return false; return false;
} }