-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate the plugin with requirejs from the chartjs and chartjs-datalabels files #303
Comments
Can you try if it works if you nest the requires as shown in this example so you are sure chart.js is fully loaded when the datalabels tries to acces it https://www.chartjs.org/docs/master/getting-started/integration.html#require-js |
@LeeLenaleee Hello and thank you, I just tested for nesting and I have the same problem It still tries to read the file: Except that in the datalabel file we use On the other hand, no problem if I do not use requireJS but simply the cdns |
Hello,
The problem comes from the map part, during the chart.js/helpers Do you have a solution to indicate in the map to use chart.js/helper? If I use my code I have to modify the code of the "chartjs-plugin-datalabels" file Here is the line that I add:
Best regards |
Might needs to be the same as in the rollup config: https://github.com/chartjs/chartjs-plugin-datalabels/blob/master/rollup.config.js#L24 So instead of: map: {
datalabels: {
"chart.js": "chart",
"chart.js/helpers": "chart"
}
} You get: map: {
datalabels: {
"chart.js": "chart", // Not sure if it also needs to be capatalized C as in the rollup config
"chart.js/helpers": "chart.helpers" // Not sure if it also needs to be capatalized C as in the rollup config
}
} |
@LeeLenaleee Hello, |
did you find any solution ? I got the same problem with another plugin (annotation) @LeeLenaleee |
Hello everyone,
I want to integrate the datalabels plugin with my requirejs
But I am having problems when defining datalabels in my js file, here is the error message.
Previously I don't use the cdns but I downloaded the Chart.js v3.6.2 and chartjs-plugin-datalabels v2.0.0 files
404 error:
https://192.168.1.70/script/chart.js/helpers.js
Uncaught Error: Script error for "../script/chart.js/helpers", needed by: datalabels
Can you tell me where I am wrong and how to get the plugin to work properly without using cdn?
Best regards
Here is my code:
The text was updated successfully, but these errors were encountered: