apache/echarts · error

Marker component is abstract component. Use markLine, markPo

Error message

Marker component is abstract component. Use markLine, markPoint, markArea instead.

What it means

DEV-only guard in MarkerModel.init: 'marker' is the abstract base mainType; only its concrete subtypes markLine, markPoint, markArea are instantiable as components. The check fires when a model of type 'marker' (the base) is actually constructed. Stripped in production.

Source

Thrown at src/component/marker/MarkerModel.ts:126

     */
    createdBySelf = false;

    preventAutoZ = true;

    static readonly dependencies = ['series', 'grid', 'polar', 'geo'];

    __hostSeries: SeriesModel;

    private _data: SeriesData;

    /**
     * @overrite
     */
    init(option: Opts, parentModel: Model, ecModel: GlobalModel) {

        if (__DEV__) {
            if (this.type === 'marker') {
                throw new Error('Marker component is abstract component. Use markLine, markPoint, markArea instead.');
            }
        }
        this.mergeDefaultAndTheme(option, ecModel);
        this._mergeOption(option, ecModel, false, true);
    }

    isAnimationEnabled(): boolean {
        if (env.node) {
            return false;
        }

        const hostSeries = this.__hostSeries;
        return this.getShallow('animation') && hostSeries && hostSeries.isAnimationEnabled();
    }

    /**
     * @overrite
     */

View on GitHub (pinned to 30076aedcd)

Solutions

  1. Use type 'markLine', 'markPoint', or 'markArea'
  2. Do not register a custom component under the reserved 'marker' mainType

Example fix

// before
series: [{ type: 'marker', data: [...] }]

// after
series: [{ type: 'markLine', data: [{ coord: [0, 0] }] }]
// or markPoint / markArea
Defensive patterns

Strategy: validation

Validate before calling

const CONCRETE = new Set(['markLine', 'markPoint', 'markArea']);
const scan = (arr: any[]) => (arr || []).forEach((s: any) => {
  if (s && s.type === 'marker') console.error('[marker] use markLine/markPoint/markArea, not marker');
});
scan(option.series); scan(option.markLine); scan(option.markPoint); scan(option.markArea);

Type guard

const isConcreteMarker = (t: string): boolean =>
  t === 'markLine' || t === 'markPoint' || t === 'markArea';

Prevention

When it happens

Trigger: Registering or specifying a component/series with type:'marker' instead of one of the concrete marker subtypes.

Common situations: Mistakenly writing type:'marker' in an option; bad option serialization; copy-paste errors from docs.

Related errors


AI-assisted analysis of apache/echarts@30076aedcd (2026-08-12). Data as JSON: /api/errors/2f08a3f30c001e1f. Report an issue: GitHub.