nagix / chartjs-plugin-colorschemes

Predefined color schemes for Chart.js
MIT License
263 stars 58 forks source link

Fix Chart.js v3 compatibility #30

Open lars-sh opened 2 years ago

lars-sh commented 2 years ago

Chart.js seems to use Chart.register, while v2 uses Chart.plugins.register. This fixes registering the Color Schemes Plugin in Chart.js v3.

s4m0r4m4 commented 2 years ago

I think this is already covered by this one? https://github.com/nagix/chartjs-plugin-colorschemes/pull/26

lars-sh commented 2 years ago

@s4m0r4m4 #26 does not solve the problem addressed by this Pull Request.

While #26 fixes Chart.JS 3 compatibility of the beginUpdate methode, this Pull Request fixes the plugin registration automatism.

s4m0r4m4 commented 2 years ago

Oh I see, you're right. @nagix any chance we can get eyes on this?

harrytalbot commented 2 years ago

Any update on this @nagix ? We are looking to get on Chart.js v3 but right now this lib is preventing us from upgrading

choweiyuan commented 2 years ago

Hi @nagix any news on this? would be good to get this out so that we can get colorscheme to work with v3 :)

LeeLenaleee commented 2 years ago

looks like there is some more that needs to be fixed before you can use this with V3, in V3 the way of import Chart.js has changed with Treeshaking so import Chart from 'chart.js' wont work. You need to use treeshaking to import it like so: import { Chart } from 'chart.js'.

Also Chart.helpers does not exist anymore. You need to import the specific helpers with treeshaking from 'chart.js/helpers'