apache/echarts · error · Error

render method must been implemented

Error message

render method must been implemented

What it means

`ChartView` (src/view/Chart.ts) is the abstract base class for every chart renderer. Its `render(seriesModel, ecModel, api, payload)` is a stub guarded by `__DEV__` that throws to enforce that each concrete chart view overrides `render()`. When ECharts dispatches the render task for a series and the resolved ChartView subclass has not implemented its own `render`, this error fires (in dev builds). In a production build the guard is removed, so the stub becomes a silent no-op and the series simply renders nothing.

Source

Thrown at src/view/Chart.ts:153

    })();


    constructor() {
        this.group = new Group();
        this.uid = componentUtil.getUID('viewChart');

        this.renderTask = createTask<SeriesTaskContext>({
            plan: renderTaskPlan,
            reset: renderTaskReset
        });
        this.renderTask.context = {view: this} as SeriesTaskContext;
    }

    init(ecModel: GlobalModel, api: ExtensionAPI): void {}

    render(seriesModel: SeriesModel, ecModel: GlobalModel, api: ExtensionAPI, payload: Payload): void {
        if (__DEV__) {
            throw new Error('render method must been implemented');
        }
    }

    /**
     * Highlight series or specified data item.
     */
    highlight(seriesModel: SeriesModel, ecModel: GlobalModel, api: ExtensionAPI, payload: Payload): void {
        const data = seriesModel.getData(payload && payload.dataType);
        if (!data) {
            if (__DEV__) {
                error(`Unknown dataType ${payload.dataType}`);
            }
            return;
        }
        toggleHighlight(data, payload, 'emphasis');
    }

    /**

View on GitHub (pinned to 30076aedcd)

Solutions

  1. Implement `render(seriesModel, ecModel, api, payload)` on your ChartView subclass.
  2. Author the view in TypeScript extending `ChartView` so the type checker surfaces the missing override.
  3. If the view comes from a third-party package, confirm it is compatible with your ECharts version and register the correct, complete view class.
  4. Verify you registered the concrete view class (not the abstract base or a sibling) for the chart type.

Example fix

// before
class MyChartView extends echarts.ChartView {
  static type = 'myChart';
  // render() missing -> 'render method must been implemented'
}

// after
class MyChartView extends echarts.ChartView {
  static type = 'myChart';
  render(seriesModel, ecModel, api, payload) {
    // ...build zrender elements into this.group...
  }
}
Defensive patterns

Strategy: type-guard

Validate before calling

// Before registering a custom chart view, assert it actually overrides render
// (ChartView.prototype.render is the throwing stub).
function assertViewImplementsRender(ViewClass) {
  if (ViewClass.prototype.render === Object.getPrototypeOf(ViewClass.prototype).render
      || ViewClass.prototype === echarts.ChartView.prototype) {
    throw new Error(ViewClass.name + ' must override ChartView.render()');
  }
}
// assertViewImplementsRender(MyChartView);

Type guard

function hasRenderOverride(ViewClass) {
  // True only when render is declared on this class (or a non-ChartView ancestor).
  let proto = ViewClass.prototype;
  while (proto && proto !== echarts.ChartView.prototype) {
    if (Object.prototype.hasOwnProperty.call(proto, 'render')) return true;
    proto = Object.getPrototypeOf(proto);
  }
  return false;
}

Prevention

When it happens

Trigger: A class extending `ChartView` is registered as a chart view (via `registers.registerChartView`/`registerClass`) without overriding `render(seriesModel, ecModel, api, payload)`. ECharts then instantiates it for a series and calls the inherited stub.

Common situations: Developing a custom series/chart extension and forgetting to implement `render`; a partially-ported or incompletely-updated third-party chart view; registering an abstract/incomplete view class by mistake; a version upgrade where the `render` signature changed and a subclass override stopped matching.


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