Chart.js canvas resize

前端 未结 13 1158
北海茫月
北海茫月 2020-11-30 23:39

In (Android WebView HTML5 canvas error) i posted a question regarding plotting graphs using Graph.js library. The problem i have now is that if i call the function to plot t

13条回答
  •  渐次进展
    2020-12-01 00:10

    If anyone is having problems, I found a solution that doesn't involve sacrificing responsiveness etc.

    Simply wrap your canvas in a div container (no styling) and reset the contents of the div to an empty canvas with ID before calling the Chart constructor.

    Example:

    HTML:

    JS:

    $("#chartContainer").html('');
    //call new Chart() as usual
    

提交回复
热议问题