예제 #1
0
 public function testDataPointFills()
 {
     $object = new Series();
     $this->assertInternalType('array', $object->getDataPointFills());
     $this->assertEmpty($object->getDataPointFills());
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->getDataPointFill(0));
 }
예제 #2
0
 /**
  * @param Chart $chart
  * @param Chart\Series $series
  */
 private function writeSeriesStyle(Chart $chart, Chart\Series $series)
 {
     $chartType = $chart->getPlotArea()->getType();
     // style:style
     $this->xmlContent->startElement('style:style');
     $this->xmlContent->writeAttribute('style:name', 'styleSeries' . $this->numSeries);
     $this->xmlContent->writeAttribute('style:family', 'chart');
     // style:chart-properties
     $this->xmlContent->startElement('style:chart-properties');
     $this->xmlContent->writeAttribute('chart:data-label-number', 'value');
     $this->xmlContent->writeAttribute('chart:label-position', 'right');
     if ($chartType instanceof Pie3D) {
         //@todo : Permit edit the offset of a pie
         $this->xmlContent->writeAttribute('chart:pie-offset', '20');
     }
     if ($chartType instanceof Line) {
         //@todo : Permit edit the symbol of a line
         $this->xmlContent->writeAttribute('chart:symbol-type', 'automatic');
     }
     // > style:chart-properties
     $this->xmlContent->endElement();
     // style:graphic-properties
     $this->xmlContent->startElement('style:graphic-properties');
     if ($chartType instanceof Line || $chartType instanceof Scatter) {
         //@todo : Permit edit the color and width of a line
         $this->xmlContent->writeAttribute('svg:stroke-width', '0.079cm');
         $this->xmlContent->writeAttribute('svg:stroke-color', '#4a7ebb');
         $this->xmlContent->writeAttribute('draw:fill-color', '#4a7ebb');
     } else {
         $this->xmlContent->writeAttribute('draw:stroke', 'none');
         $this->xmlContent->writeAttribute('draw:fill', $series->getFill()->getFillType());
         $this->xmlContent->writeAttribute('draw:fill-color', '#' . $series->getFill()->getStartColor()->getRGB());
     }
     // > style:graphic-properties
     $this->xmlContent->endElement();
     // style:text-properties
     $this->xmlContent->startElement('style:text-properties');
     $this->xmlContent->writeAttribute('fo:color', '#' . $series->getFont()->getColor()->getRGB());
     $this->xmlContent->writeAttribute('fo:font-family', $series->getFont()->getName());
     $this->xmlContent->writeAttribute('fo:font-size', $series->getFont()->getSize() . 'pt');
     // > style:text-properties
     $this->xmlContent->endElement();
     // > style:style
     $this->xmlContent->endElement();
     foreach ($series->getDataPointFills() as $idx => $oFill) {
         // style:style
         $this->xmlContent->startElement('style:style');
         $this->xmlContent->writeAttribute('style:name', 'styleSeries' . $this->numSeries . '_' . $idx);
         $this->xmlContent->writeAttribute('style:family', 'chart');
         // style:graphic-properties
         $this->xmlContent->startElement('style:graphic-properties');
         $this->xmlContent->writeAttribute('draw:fill', $oFill->getFillType());
         $this->xmlContent->writeAttribute('draw:fill-color', '#' . $oFill->getStartColor()->getRGB());
         // > style:graphic-properties
         $this->xmlContent->endElement();
         // > style:style
         $this->xmlContent->endElement();
     }
 }