Skip to content

add some feature and fix some issues #591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
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
20 changes: 20 additions & 0 deletions src/PhpPresentation/Shape/Chart/Axis.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ class Axis implements ComparableInterface
const TICK_MARK_INSIDE = 'in';
const TICK_MARK_OUTSIDE = 'out';

const TICK_LABEL_POS_NEXT_TO = 'nextTo';
const TICK_LABEL_POS_HIGH = 'high';
const TICK_LABEL_POS_LOW = 'low';
const TICK_LABEL_POS_NONE = 'none';

/**
* Title
*
Expand Down Expand Up @@ -105,6 +110,11 @@ class Axis implements ComparableInterface
*/
protected $isVisible = true;

/**
* @var string
*/
protected $tickLabelPos = self::TICK_LABEL_POS_NEXT_TO;

/**
* Create a new \PhpOffice\PhpPresentation\Shape\Chart\Axis instance
*
Expand Down Expand Up @@ -348,6 +358,16 @@ public function setOutline(Outline $outline)
return $this;
}

public function getTickLabelPos()
{
return $this->tickLabelPos;
}

public function setTickLabelPos($pos = self::TICK_LABEL_POS_NEXT_TO)
{
$this->tickLabelPos = $pos;
return $this;
}
/**
* Get hash code
*
Expand Down
16 changes: 16 additions & 0 deletions src/PhpPresentation/Shape/Chart/Series.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use PhpOffice\PhpPresentation\Style\Fill;
use PhpOffice\PhpPresentation\Style\Font;
use PhpOffice\PhpPresentation\Style\Outline;
use PhpOffice\PhpPresentation\Style\Color as StyleColor;

/**
* \PhpOffice\PhpPresentation\Shape\Chart\Series
Expand Down Expand Up @@ -132,6 +133,11 @@ class Series implements ComparableInterface
*/
private $values = array();

/**
* Label color
* @var StyleColor
*/
private $labelColor = null;
/**
* Hash index
* @var string
Expand Down Expand Up @@ -509,6 +515,16 @@ public function setLabelPosition($value)
return $this;
}

public function getLabelColor()
{
return $this->labelColor;
}
public function setLabelColor($labelColor = null)
{
$this->labelColor = $labelColor;
return $this;
}

/**
* @return Marker
*/
Expand Down
14 changes: 13 additions & 1 deletion src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,14 @@ protected function writeTypeBar(XMLWriter $objWriter, Bar $subject, $includeShee
$objWriter->writeAttribute('sourceLinked', '0');
$objWriter->endElement();
}
if ($series->getLabelColor() != null) {
$objWriter->startElement('c:spPr');
$objWriter->startElement('a:solidFill');
$this->writeColor($objWriter, $series->getLabelColor());
$objWriter->endElement();
$objWriter->endElement();
}


// c:txPr
$objWriter->startElement('c:txPr');
Expand Down Expand Up @@ -1786,6 +1794,9 @@ protected function writeTypeLine(XMLWriter $objWriter, Line $subject, $includeSh

$objWriter->endElement();

// c:dLblPos
$this->writeElementWithValAttribute($objWriter, 'c:dLblPos', $series->getLabelPosition());

// c:showVal
$this->writeElementWithValAttribute($objWriter, 'c:showVal', $series->hasShowValue() ? '1' : '0');

Expand Down Expand Up @@ -2277,7 +2288,8 @@ protected function writeAxis(XMLWriter $objWriter, Chart\Axis $oAxis, $typeAxis,

// c:tickLblPos
$objWriter->startElement('c:tickLblPos');
$objWriter->writeAttribute('val', 'nextTo');
$objWriter->writeAttribute('val', $oAxis->getTickLabelPos());
//$objWriter->writeAttribute('val', 'nextTo');
$objWriter->endElement();

// c:spPr
Expand Down