PHPOffice/PhpSpreadsheet · error · PhpOffice\PhpSpreadsheet\Chart\Exception
Invalid hex color for chart series (color: "%s")
Error message
Invalid hex color for chart series (color: "%s")
What it means
Error "Invalid hex color for chart series (color: "%s")" thrown in PHPOffice/PhpSpreadsheet.
Source
Thrown at src/PhpSpreadsheet/Chart/DataSeriesValues.php:340
}
} elseif ($color instanceof ChartColor) {
$this->fillColor = $color;
} else {
$this->fillColor = $this->stringToChartColor($color);
}
return $this;
}
/**
* Method for validating hex color.
*
* @param string $color value for color
*/
private function validateColor(string $color): void
{
if (!preg_match('/^[a-f0-9]{6}$/i', $color)) {
throw new Exception(sprintf('Invalid hex color for chart series (color: "%s")', $color));
}
}
/**
* Get line width for series.
*/
public function getLineWidth(): null|float|int
{
/** @var null|float|int */
$temp = $this->lineStyleProperties['width'];
return $temp;
}
/**
* Set line width for the series.
*
* @return $thisView on GitHub (pinned to 65b080eef4)
When it happens
Trigger: Thrown at src/PhpSpreadsheet/Chart/DataSeriesValues.php:340 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of PHPOffice/PhpSpreadsheet@65b080eef4 (2026-08-17).
Data as JSON: /api/errors/6d5ec243ceb14b1c.
Report an issue: GitHub.