PHPOffice/PhpSpreadsheet · error · PhpOffice\PhpSpreadsheet\Chart\Exception

Invalid datatype for chart data series values

Error message

Invalid datatype for chart data series values

What it means

Error "Invalid datatype for chart data series values" thrown in PHPOffice/PhpSpreadsheet.

Source

Thrown at src/PhpSpreadsheet/Chart/DataSeriesValues.php:133

        return $this->dataType;
    }

    /**
     * Set Series Data Type.
     *
     * @param string $dataType Datatype of this data series
     *                                Typical values are:
     *                                    DataSeriesValues::DATASERIES_TYPE_STRING
     *                                        Normally used for axis point values
     *                                    DataSeriesValues::DATASERIES_TYPE_NUMBER
     *                                        Normally used for chart data values
     *
     * @return $this
     */
    public function setDataType(string $dataType): static
    {
        if (!in_array($dataType, self::DATA_TYPE_VALUES)) {
            throw new Exception('Invalid datatype for chart data series values');
        }
        $this->dataType = $dataType;

        return $this;
    }

    /**
     * Get Series Data Source (formula).
     */
    public function getDataSource(): ?string
    {
        return $this->dataSource;
    }

    /**
     * Set Series Data Source (formula).
     *
     * @return $this

View on GitHub (pinned to 65b080eef4)

When it happens

Trigger: Thrown at src/PhpSpreadsheet/Chart/DataSeriesValues.php:133 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/ee7ef50d106e1c28. Report an issue: GitHub.