In code comments for stock chart improvements

This commit is contained in:
Mark Baker 2013-09-15 18:11:48 +01:00
parent 47f3888664
commit 555a4ab828
3 changed files with 9 additions and 11 deletions

View File

@ -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';

View File

@ -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()

View File

@ -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: