Search code examples
javascriptiosmacoschart.jsosx-elcapitan

Chart.js page is zooming out everytime we change to a different graph while using a browser on with IOS El Capitan or latest iPad version


We are using Chart.js to display several graphs and we have seen than when using it on the latest version of iPad or OSX El Capitan the page starts zooming out until it becomes a blank page. We tested the page is PC, Androids and older OSX versions and it has been only these new devices that show the issue.

Has anyone seen this issue? Thanks,


Solution

  • The solution is to replace the used canvas with a new one, before drawing on it. In jQuery:

    $("#overallChart").replaceWith("<canvas id='overallChart' height='270' width='270'></canvas>");
    var lineChart = new Chart(document.getElementById("overallChart").getContext("2d")).Line(lineData);
    

    as per this post.