diff --git a/Classes/PHPExcel/Chart/DataSeries.php b/Classes/PHPExcel/Chart/DataSeries.php index 68382e78..0822de3f 100644 --- a/Classes/PHPExcel/Chart/DataSeries.php +++ b/Classes/PHPExcel/Chart/DataSeries.php @@ -52,6 +52,7 @@ class PHPExcel_Chart_DataSeries const TYPE_RADARCHART = 'radarChart'; const TYPE_BUBBLECHART = 'bubbleChart'; const TYPE_STOCKCHART = 'stockChart'; + const TYPE_CANDLECHART = self::TYPE_STOCKCHART; // Synonym const GROUPING_CLUSTERED = 'clustered'; const GROUPING_STACKED = 'stacked'; diff --git a/Classes/PHPExcel/Chart/Renderer/jpgraph.php b/Classes/PHPExcel/Chart/Renderer/jpgraph.php index 9a822e8f..fa0bf108 100644 --- a/Classes/PHPExcel/Chart/Renderer/jpgraph.php +++ b/Classes/PHPExcel/Chart/Renderer/jpgraph.php @@ -518,34 +518,27 @@ class PHPExcel_Chart_Renderer_jpgraph $seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); $plotOrder = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotOrder(); - $seriesPlots = array(); - //var_dump($seriesCount); - $dataValues = array(); - - // Loop through each data series in turn + // Loop through each data series in turn and build the plot arrays foreach($plotOrder as $i => $v) { $dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($v)->getDataValues(); foreach($dataValuesX as $j => $dataValueX) { $dataValues[$plotOrder[$i]][$j] = $dataValueX; } } - if(empty($dataValues)) { return; } $dataValuesPlot = array(); - + // Flatten the plot arrays to a single dimensional array to work with jpgraph for($j = 0; $j < count($dataValues[0]); $j++) { for($i = 0; $i < $seriesCount; $i++) { $dataValuesPlot[] = $dataValues[$i][$j]; } } - $seriesPlot = new StockPlot($dataValuesPlot); - $seriesPlot->SetWidth(20); - + // Set the x-axis labels $labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount()); if ($labelCount > 0) { $datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues(); @@ -553,6 +546,9 @@ class PHPExcel_Chart_Renderer_jpgraph $this->_graph->xaxis->SetTickLabels($datasetLabels); } + $seriesPlot = new StockPlot($dataValuesPlot); + $seriesPlot->SetWidth(20); + $this->_graph->Add($seriesPlot); } // function _renderPlotStock() diff --git a/changelog.txt b/changelog.txt index ab962b4a..cbbc50ff 100644 --- a/changelog.txt +++ b/changelog.txt @@ -31,7 +31,8 @@ Fixed in develop branch for release v1.8.0: - Feature: (amerov) - Implementation of the Excel HLOOKUP() function - Feature: (MBaker) - Added "Quote Prefix" to style settings (Excel2007 Reader and Writer only) - Feature: (MBaker) - Added Horizontal FILL alignment for Excel5 and Excel2007 Readers/Writers, and Horizontal DISTRIBUTED alignment for Excel2007 Reader/Writer -- General: (cdhutch) Work item 20055 - remove array_shift in ReferenceHelper::insertNewBefore improves column or row delete speed +- General: (cdhutch) Work item 20055 - Remove array_shift in ReferenceHelper::insertNewBefore improves column or row delete speed +- General: (MBaker) - Improve stock chart handling and rendering, with help from Swashata Ghosh Fixed in develop branch for release v1.7.9: