-
Notifications
You must be signed in to change notification settings - Fork 506
Closed
Labels
Description
I have npm installed chart.js (^3.5.1) and chartjs-plugin-datalabels (^2.0.0).
I got stuck at trying to a dynamic module import. https://stackoverflow.com/questions/69543515/dynamic-import-of-chart-js-with-plugins
Having failed to do a dynamic import I tested the regular import from local install but this doesn't work neither.
The integration notes for this module use following example.
import {Chart} from 'chart.js';
import ChartDataLabels from 'chartjs-plugin-datalabels';
I don't think this can work.
I can use the auto registration import for chart.js to use the core library.
import Chart from 'chart.js/auto';
Importing and registering the plugin doesn't seem to be possible though.
import Chart from 'chart.js/auto';
import ChartDataLabels from 'chartjs-plugin-datalabels';
Chart.register(ChartDataLabels)
This will fail because of the chartjs helpers.
Any advice on the import of this and indeed any chartjs module?