parent
257c3eca58
commit
4e0344c3af
|
@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||
|
||||
- Support cell comments in HTML writer and reader - [#308](https://github.com/PHPOffice/PhpSpreadsheet/issues/308)
|
||||
- Option to stop at a conditional styling, if it matches (only XLSX format) - [#292](https://github.com/PHPOffice/PhpSpreadsheet/pull/292)
|
||||
- Support for line width for data series when rendering Xlsx - [#329](https://github.com/PHPOffice/PhpSpreadsheet/pull/329)
|
||||
|
||||
### Fixed
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ $dataSeriesValues = [
|
|||
new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4),
|
||||
new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4),
|
||||
];
|
||||
$dataSeriesValues[2]->setLineWidth(60000);
|
||||
|
||||
// Build the dataseries
|
||||
$series = new DataSeries(
|
||||
|
|
|
@ -66,6 +66,13 @@ class DataSeriesValues
|
|||
*/
|
||||
private $fillColor;
|
||||
|
||||
/**
|
||||
* Line Width.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $lineWidth = 12700;
|
||||
|
||||
/**
|
||||
* Create a new DataSeriesValues object.
|
||||
*
|
||||
|
@ -231,6 +238,31 @@ class DataSeriesValues
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get line width for series.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getLineWidth()
|
||||
{
|
||||
return $this->lineWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set line width for the series.
|
||||
*
|
||||
* @param int $width
|
||||
*
|
||||
* @return DataSeriesValues
|
||||
*/
|
||||
public function setLineWidth($width)
|
||||
{
|
||||
$minWidth = 12700;
|
||||
$this->lineWidth = max($minWidth, $width);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identify if the Data Series is a multi-level or a simple series.
|
||||
*
|
||||
|
|
|
@ -1127,11 +1127,19 @@ class Chart extends WriterPart
|
|||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Values
|
||||
$plotSeriesValues = $plotGroup->getPlotValuesByIndex($plotSeriesRef);
|
||||
|
||||
// Formatting for the points
|
||||
if (($groupType == DataSeries::TYPE_LINECHART) || ($groupType == DataSeries::TYPE_STOCKCHART)) {
|
||||
$plotLineWidth = 12700;
|
||||
if ($plotSeriesValues) {
|
||||
$plotLineWidth = $plotSeriesValues->getLineWidth();
|
||||
}
|
||||
|
||||
$objWriter->startElement('c:spPr');
|
||||
$objWriter->startElement('a:ln');
|
||||
$objWriter->writeAttribute('w', 12700);
|
||||
$objWriter->writeAttribute('w', $plotLineWidth);
|
||||
if ($groupType == DataSeries::TYPE_STOCKCHART) {
|
||||
$objWriter->startElement('a:noFill');
|
||||
$objWriter->endElement();
|
||||
|
@ -1140,7 +1148,6 @@ class Chart extends WriterPart
|
|||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
$plotSeriesValues = $plotGroup->getPlotValuesByIndex($plotSeriesRef);
|
||||
if ($plotSeriesValues) {
|
||||
$plotSeriesMarker = $plotSeriesValues->getPointMarker();
|
||||
if ($plotSeriesMarker) {
|
||||
|
|
|
@ -47,4 +47,16 @@ class DataSeriesValuesTest extends TestCase
|
|||
$result = $testInstance->getDataType();
|
||||
self::assertEquals($dataTypeValue, $result);
|
||||
}
|
||||
|
||||
public function testGetLineWidth()
|
||||
{
|
||||
$testInstance = new DataSeriesValues();
|
||||
self::assertEquals(12700, $testInstance->getLineWidth(), 'should have default');
|
||||
|
||||
$testInstance->setLineWidth(40000);
|
||||
self::assertEquals(40000, $testInstance->getLineWidth());
|
||||
|
||||
$testInstance->setLineWidth(1);
|
||||
self::assertEquals(12700, $testInstance->getLineWidth(), 'should enforce minimum width');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue