Chartjs-Chart.js just disappears for no reason

1๐Ÿ‘

โœ…

I faced a similar situation with angular chart. If this is an ionic app, please add somewhere in your controller this code below. For some reason, the chart library cannot figure out the bounds of the window so it becomes zero in size. Here is the code I added.

  $scope.$on("$ionicView.afterEnter", function(event, data) {
window.dispatchEvent(new Event('resize'));

});

This is just a event handler, that is, whenever the app navigates to this page, it just sends out a resize event. This code fixed the issue for me.

Leave a comment