title: PHPSpreadsheet - Custom Color in Data Series of Chart
body: <p>Using PHPSpreadsheet to create a custom line graph. I have data loaded into the spreadsheet and it is properly building the graph. However, I am not able to adjust the color of the lines in the graph. When I try to apply a color to my series, the spreadsheet opens but there is some sort of corruption and the graph does not load. Excel tells me that it has removed the graph so that it can open the spreadsheet: 'Removed Part: /xl/drawings/drawing1.xml part.  (Drawing shape)'</p>
  
  <p>I was unable to find any information in the documentation regarding custom chart colors but it was committed and merged into the project earlier this year.</p>
  
  <p>I have checked the source code for my version of PHPSpreadsheet and it does have the updated files/classes that allow for custom chart coloration.</p>
  
  <pre><code>&lt;?php
  
  require_once '/opt/sites/vendor/autoload.php';
  
  use PhpOffice\PhpSpreadsheet\Spreadsheet;
  use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
  use PhpOffice\PhpSpreadsheet\Chart\Chart;
  use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
  use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
  use PhpOffice\PhpSpreadsheet\Chart\Legend;
  use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
  use PhpOffice\PhpSpreadsheet\Chart\Title;
  
  $phpsheet = new Spreadsheet();
  
  $phpsheet-&gt;setActiveSheetIndex(0);
  $phpsheet-&gt;getActiveSheet()-&gt;setTitle('Worksheet');
  
  $file = "report.xlsx";
  
  header('Content-Type: application/vnd.ms-excel');
  header("Content-Disposition: attachment; filename=\"".$file."\"");
  header('Cache-Control: max-age=0');
  
  
  $phpsheet-&gt;getActiveSheet()-&gt;getColumnDimension('A')-&gt;setWidth(15);
  $phpsheet-&gt;getActiveSheet()-&gt;getColumnDimension('B')-&gt;setWidth(15);
  $phpsheet-&gt;getActiveSheet()-&gt;getColumnDimension('C')-&gt;setWidth(15);
  
  $r = 1;
  
  $phpsheet-&gt;getActiveSheet()-&gt;setCellValue('A' . $r, "Date");
  $phpsheet-&gt;getActiveSheet()-&gt;setCellValue('B' . $r, "Val  One");
  $phpsheet-&gt;getActiveSheet()-&gt;setCellValue('C' . $r, "Val Two");
  
  $r++;
  
  while($r&lt;=20)
  {
      $randNumOne =  rand(1,100);
      $randNumTwo =  rand(1,100);
  
      $phpsheet-&gt;getActiveSheet()-&gt;setCellValue('A' . $r, "2018-04-".$r);
      $phpsheet-&gt;getActiveSheet()-&gt;setCellValue('B' . $r, $randNumOne);
      $phpsheet-&gt;getActiveSheet()-&gt;setCellValue('C' . $r, $randNumTwo);
  
      $r++;
  }
  
  /////////////////////////////////////////////////////////
  //////////////////////////Error Here/////////////////////
  ///If I change the two hex codes to NULL, there is no issue but of course then there is no change in color either.
  /////////////////////////////////////////////////////////
  //////////////////////////Error Here/////////////////////
  
  $dsl=array(
      new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', NULL, 1, [], NULL, "d914e0"), //Cause of the error
      new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', NULL, 1, [], NULL, "2ce81b"), //Cause of the error
  );
  
  $x = $r - 1;
  
  $xal=array(
      new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$'.$r, NULL, $x),
  );
  
  $dsv = array(
      new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$'.$r, NULL, $x),
      new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$'.$r, NULL, $x),
  );
  
  $ds = new DataSeries(
      DataSeries::TYPE_LINECHART,
      DataSeries::GROUPING_STANDARD,
      range(0, count($dsv)-1),
      $dsl,
      $xal,
      $dsv
  );
  
  $pa = new PlotArea(NULL, array($ds));
  
  
  $legend = new Legend(Legend::POSITION_RIGHT, NULL, false);
  
  $title = new Title('Sample Chart');
  
  
  $chart = new Chart(
      'chart1',
      $title,
      $legend,
      $pa,
      0,
      0,
      NULL,
      NULL
  );
  
  
  $chart-&gt;setTopLeftPosition('E1');
  $chart-&gt;setBottomRightPosition('V20');
  
  $phpsheet-&gt;getActiveSheet()-&gt;addChart($chart);
  
  
  $Excel_writer = new Xlsx($phpsheet);
  
  ob_end_clean();
  $Excel_writer-&gt;setIncludeCharts(true);
  
  $Excel_writer-&gt;save('php://output');
  </code></pre>
  
  <p>I have no errors/warnings/issues on the server side of things. Everything executes as expected and I get the excel file without issue other than the 'drawing corruption'.</p>