chartjs-plugin-labels icon indicating copy to clipboard operation
chartjs-plugin-labels copied to clipboard

how to add this to chart.js

Open ghost opened this issue 4 years ago • 1 comments

i am new to this. and i need more details about how to use it. help

ghost avatar Aug 14 '20 12:08 ghost

This worked for me. In config.json have externals point to recent libraries in node_modules. Set a global dependency for chartjs-plugin-labels on chart.js with a shared global name. The charts.js has to load first before the chartjs-plugin-labels.js as stated in earlier issues. Read these, they helped me, https://github.com/emn178/chartjs-plugin-labels/issues/47 https://github.com/emn178/chartjs-plugin-labels/issues/79

"externals": { "sp-client-custom-fields": "node_modules/sp-client-custom-fields/dist/sp-client-custom-fields.bundle.js", "jquery": { "path": "node_modules/jquery/dist/jquery.min.js", "globalName": "jQuery" }, "chartjs": { "path": "node_modules/chart.js/dist/Chart.min.js", "globalName": "Chart" }, "chartlabelsjs": { "path": "node_modules/chartjs-plugin-labels/src/chartjs-plugin-labels.js", "globalName": "Chart", "globalDependencies": ["chartjs"] }
},

Add a require for chartjs-plugin-labels with chart.js just under the imports of the TS file.

var Chart: any = require('chartjs'); require('chartlabelsjs');

image

got2ski avatar Sep 09 '20 22:09 got2ski