Ionic + Modal + chart.js canvas refresh issue


Using angular-chart.js - we displaying line and doughnut charts on iPad app.

Whenever a modal popup is shown then the charts are disappearing.

Any idea why the modal will cause the charts to disappear in the canvas? Any pointer or solution?

using window.dispatchEvent(new Event(‘resize’));
The refresh issue is fixed.

1 Like

I’m having a similar problem where a modal popup is shown the charts disappear.

Could you elaborate as to what you meant by
"using window.dispatchEvent(new Event(‘resize’)); "

I’m new to this and curious as to where that should be placed.


You can call this on hide of your modal with some delay.

function hide() {
    $timeout(function() { /** redraw the canvas  **/
         window.dispatchEvent(new Event('resize'));
    }, 100);
1 Like

That worked perfectly!