1π
It seems that in both cases you are resolving the single Promises when the first element in dependentScripts
and listOfScripts
are loaded and not when all of them are loaded. I.e., you are not waiting for all the dependentScripts
and listOfScripts
before resolving the Promise.
0π
I think Iβve found a solution for loading dependent scripts in my case.
So the plugin DataLabels is only loaded when chartjs is resolved.
$.when(
$.getScript(`libs/chartjs.min.js`),
$.Deferred(function(deferred) {
$(deferred.resolve);
})
).done(function() {
$.getScript(`libs/chartjs-plugin-datalabels.js`)
//Load other scripts
Promise.all([loadScripts(), loadCss()])
.then(() => {
//do stuff ...
});
});
- Chartjs-Pushing API Data into Chart.js
- Chartjs-How to get data on chart based on selected date (Filtering data Chart JS with datepicker)
0π
we have two file 1. chart.js
and 2. datalabels.plugins
these two files enough for create different types of charts and datalabels
plugins responsible for labels of data so that first attach your file "chartjs"
and after datalabels
plugins. So first load chartjs
and then any plugins.
Source:stackexchange.com