Improve chart documentation
I'm submitting a ... (check one with "x")
[X] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35
Current behavior
Since the change to include Chart.js via an import instead of relying on global variable, there are 2 issues.
-
If you follow the documentation and include chart.js via the scripts in angular.json, chart.js will get included twice in bundles. see the commit here
-
The other side effect of this change is that moment.js will be included in webpack builds, whereas referencing as a global variable it does not get included into bundles.
Expected behavior
-
The documentation should be changed to not state that chart.js needs to be included via scripts.
-
not sure what the solution should be here. Either we have to wait until Chart.js 3.0, revert the above change or use ngx-build-plus to exclude moment?
What is the motivation / use case for changing the behavior? The bundles are much bigger when using chart component because of the inclusion of moment.js and the double-entry of chart.js
-
Angular version: 8.X Angular version 8 and above
-
PrimeNG version: 8.X PrimeNG 8 and above
A solution for number 2, may not work for everyone but the project I work on I did not want moment at all. Since this is an optional dependency on chart.js I found this solution
For reference, add this to package.json. Seems webpack will exclude moment from the bundles
"browser": { moment": false }
Tested this with Angular CLI 8 and 9.
We'll do it as we're upgrading the charts.js now.