Chartjs-Chartjs won't render chart with Requirejs

1👍

What you describe is consistent with the event handler you give to window.onload not being fired at all.

By the time RequireJS starts executing the code in your require(['chartjs'] call, the load event has most likely already happened. What you could do is use something like jQuery’s ready or RequireJS’ domReady.

By the way, this code is bizarre:

requirejs(['bootstrap'], function (Bootstrap) {
return {};
});

If you are just loading bootstrap, you could reduce it to requirejs(['bootstrap']). But note that all loads are asynchronous so the only thing this does is tell RequireJS to load Bootstrap, which will happen at some indeterminate point in the future.

Leave a comment