Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 54 additions & 3 deletions Classes/PHPExcel/Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,27 @@ class PHPExcel_Chart
*/
private $_yAxis = null;

/**
* Secondary Y-Axis Color
*
* @var string
*/
private $_yAxisColor = null;

/**
* Secondary Y-Axis Label
*
* @var PHPExcel_Chart_Title
*/
private $_secondaryYAxisLabel = null;

/**
* Secondary Y-Axis Color
*
* @var string
*/
private $_secondaryYAxisColor = null;

/**
* Chart Asix X as
*
Expand Down Expand Up @@ -177,7 +198,7 @@ class PHPExcel_Chart
/**
* Create a new PHPExcel_Chart
*/
public function __construct($name, PHPExcel_Chart_Title $title = null, PHPExcel_Chart_Legend $legend = null, PHPExcel_Chart_PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, PHPExcel_Chart_Axis $xAxis = null, PHPExcel_Chart_Axis $yAxis = null, PHPExcel_Chart_GridLines $majorGridlines = null, PHPExcel_Chart_GridLines $minorGridlines = null)
public function __construct($name, PHPExcel_Chart_Title $title = null, PHPExcel_Chart_Legend $legend = null, PHPExcel_Chart_PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, PHPExcel_Chart_Axis $xAxis = null, PHPExcel_Chart_Axis $yAxis = null, PHPExcel_Chart_GridLines $majorGridlines = null, PHPExcel_Chart_GridLines $minorGridlines = null, PHPExcel_Chart_Title $secondaryYAxisLabel = null, $yAxisColor = null, $secondaryYAxisColor = null)
{
$this->_name = $name;
$this->_title = $title;
Expand All @@ -189,8 +210,11 @@ public function __construct($name, PHPExcel_Chart_Title $title = null, PHPExcel_
$this->_displayBlanksAs = $displayBlanksAs;
$this->_xAxis = $xAxis;
$this->_yAxis = $yAxis;
$this->_majorGridlines = $majorGridlines;
$this->_minorGridlines = $minorGridlines;
$this->_majorGridlines = $majorGridlines;
$this->_minorGridlines = $minorGridlines;
$this->_secondaryYAxisLabel = $secondaryYAxisLabel;
$this->_yAxisColor = $yAxisColor;
$this->_secondaryYAxisColor = $secondaryYAxisColor;
}

/**
Expand Down Expand Up @@ -308,6 +332,33 @@ public function setYAxisLabel(PHPExcel_Chart_Title $label) {
return $this;
}

/**
* Get Secondary Y-Axis Label
*
* @return PHPExcel_Chart_Title
*/
public function getSecondaryYAxisLabel() {
return $this->_secondaryYAxisLabel;
}

/**
* Get Y-Axis Color
*
* @return string
*/
public function getYAxisColor() {
return $this->_yAxisColor;
}

/**
* Get Secondary Y-Axis Color
*
* @return string
*/
public function getSecondaryYAxisColor() {
return $this->_secondaryYAxisColor;
}

/**
* Get Plot Area
*
Expand Down
68 changes: 67 additions & 1 deletion Classes/PHPExcel/Chart/PlotArea.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,21 @@ class PHPExcel_Chart_PlotArea
*/
private $_plotSeries = array();

/**
* Secondary Plot Series
*
* @var array of PHPExcel_Chart_DataSeries
*/
private $_secondaryYAxisPlotSeries = array();

/**
* Create a new PHPExcel_Chart_PlotArea
*/
public function __construct(PHPExcel_Chart_Layout $layout = null, $plotSeries = array())
public function __construct(PHPExcel_Chart_Layout $layout = null, $plotSeries = array(), $secondaryYAxisPlotSeries = array())
{
$this->_layout = $layout;
$this->_plotSeries = $plotSeries;
$this->_secondaryYAxisPlotSeries = $secondaryYAxisPlotSeries;
}

/**
Expand All @@ -76,6 +84,15 @@ public function getPlotGroupCount() {
return count($this->_plotSeries);
}

/**
* Get Number of Plot Secondary Groups
*
* @return array of PHPExcel_Chart_DataSeries
*/
public function getPlotSecondaryGroupCount() {
return count($this->_secondaryYAxisPlotSeries);
}

/**
* Get Number of Plot Series
*
Expand All @@ -89,6 +106,19 @@ public function getPlotSeriesCount() {
return $seriesCount;
}

/**
* Get Number of Plot Secondary Series
*
* @return integer
*/
public function getPlotSecondarySeriesCount() {
$seriesCount = 0;
foreach($this->_secondaryYAxisPlotSeries as $plot) {
$seriesCount += $plot->getPlotSecondarySeriesCount();
}
return $seriesCount;
}

/**
* Get Plot Series
*
Expand All @@ -98,6 +128,15 @@ public function getPlotGroup() {
return $this->_plotSeries;
}

/**
* Get Plot Secondary Series
*
* @return array of PHPExcel_Chart_DataSeries
*/
public function getPlotSecondaryGroup() {
return $this->_secondaryYAxisPlotSeries;
}

/**
* Get Plot Series by Index
*
Expand All @@ -107,6 +146,15 @@ public function getPlotGroupByIndex($index) {
return $this->_plotSeries[$index];
}

/**
* Get Plot Series by Index
*
* @return PHPExcel_Chart_DataSeries
*/
public function getPlotSecondaryGroupByIndex($index) {
return $this->_secondaryYAxisPlotSeries[$index];
}

/**
* Set Plot Series
*
Expand All @@ -119,10 +167,28 @@ public function setPlotSeries($plotSeries = array()) {
return $this;
}

/**
* Set Plot Secondary Series
*
* @param [PHPExcel_Chart_DataSeries]
* @return PHPExcel_Chart_PlotArea
*/
public function setPlotSecondarySeries($plotSeries = array()) {
$this->_secondaryYAxisPlotSeries = $plotSeries;
return $this;
}

public function refresh(PHPExcel_Worksheet $worksheet) {
foreach($this->_plotSeries as $plotSeries) {
$plotSeries->refresh($worksheet);
}

if(count($this->_secondaryYAxisPlotSeries) > 0)
{
foreach($this->_secondaryYAxisPlotSeries as $plotSeries) {
$plotSeries->refresh($worksheet);
}
}
}

}
Loading