Fix to X-Axis labels when writing chart DataSeriesValues.php

Addition of an example for creating a radar chart
This commit is contained in:
Mark Baker
2012-10-13 17:24:11 +01:00
parent c475701cc4
commit e46513043e
3 changed files with 178 additions and 10 deletions
+19 -10
View File
@@ -290,20 +290,29 @@ class PHPExcel_Chart_DataSeriesValues
if ($flatten) {
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
} else {
$newArray = array_values(array_shift($newDataValues));
foreach($newArray as $i => $newDataSet) {
$newArray[$i] = array($newDataSet);
$cellRange = explode('!',$this->_dataSource);
if (count($cellRange) > 1) {
list(,$cellRange) = $cellRange;
}
foreach($newDataValues as $newDataSet) {
$i = 0;
foreach($newDataSet as $newDataVal) {
array_unshift($newArray[$i++],$newDataVal);
$dimensions = PHPExcel_Cell::rangeDimension(str_replace('$','',$cellRange));
if (($dimensions[0] == 1) || ($dimensions[1] == 1)) {
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
} else {
$newArray = array_values(array_shift($newDataValues));
foreach($newArray as $i => $newDataSet) {
$newArray[$i] = array($newDataSet);
}
}
$this->_dataValues = $newArray;
}
foreach($newDataValues as $newDataSet) {
$i = 0;
foreach($newDataSet as $newDataVal) {
array_unshift($newArray[$i++],$newDataVal);
}
}
$this->_dataValues = $newArray;
}
}
$this->_pointCount = count($this->_dataValues);
}