Unable to register ChartjsPluginAnnotation in LWC #12102
srikanth0020
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am leverage latest chartjs version 4.1 to incorporate donut graphs in salesforce LWC . The graph was generated but wanted to use the annotations available for donut graph as well. So have added chartjspluginannotaion.min.js file as well. Post that i have tried to register the ChartjsPluginAnnotation with below code. But the registration is not happening and am getting undefined in "console.log('window.ChartjsPluginAnnotation---'+window.ChartjsPluginAnnotation);" . Did anyone try to use the Doughnut annotation .
Promise.all([
loadScript(this,ChartJs),
loadScript(this,chartUMDJs),
loadScript(this,chartHelperjs),
loadScript(this,annotationPlugin),
]).then(() =>{
const ctx = this.template.querySelector('canvas.donut')
.getContext('2d');
console.log('window.Chart---'+window.Chart);
console.log('window.ChartjsPluginAnnotation---'+window.ChartjsPluginAnnotation);
window.Chart.register(window.ChartjsPluginAnnotation);
this.chart = new window.Chart(ctx, this.config);
Beta Was this translation helpful? Give feedback.
All reactions