SeanSobey / ChartjsNodeCanvas

A node renderer for Chart.js using canvas.
MIT License
230 stars 75 forks source link

Not able to register a new plugin #77

Closed Remco-Muller closed 2 years ago

Remco-Muller commented 3 years ago

When i am trying to include 'chartjs-plugin-datalabels' it tells me 'Cannot read property 'register' of undefined'.

var Chart = new ChartJSNodeCanvas({ width, height, plugins: { requireLegacy: ['chartjs-plugin-datalabels'] } });

Update:

The issue is in new.js at line 173. chartJs.plugins.register(freshRequire_1.freshRequire(plugin));

needs to be replace with chartJs.register(freshRequire_1.freshRequire(plugin));

SeanSobey commented 3 years ago

What version of Chart JS are you using?

Mw3y commented 3 years ago

I'm using Chart.js 3.5.0 and I have the same error.

SeanSobey commented 2 years ago

Try the new v4 version as that now supports chart.js 3.x.x