简体   繁体   中英

How to access ChartJS defaults

i need help with ChartJS v3 after migrating from v2

In v2 version i had a function that modifies ChartJS' default configuration as seen in the image below. configuration ChartJS v2

However, after migrating to ChartJS v3, i'm unable to access the default ChartJS export from the library plus my defaults do not get applied even if i modified the defaults of an already existing Chart.

Has this happened to anyone? Any tips on how to fix it?

I found out you need to import Chart and registerables, plus registering all of them in a tree-shaking approach. I had Chart2 in my project and Chart3 in my library. Using Chart3 as peerDependency and updating my project's version fixed most of the issues.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM