How to clear a chart from a canvas so that hover events cannot be triggered?

后端 未结 21 1795
不思量自难忘°
不思量自难忘° 2020-11-28 20:07

I\'m using Chartjs to display a Line Chart and this works fine:

// get line chart canvas
var targetCanvas = document.getElementById(\'chartCanvas\').getConte         


        
21条回答
  •  清歌不尽
    2020-11-28 20:56

    I couldn't get .destroy() to work either so this is what I'm doing. The chart_parent div is where I want the canvas to show up. I need the canvas to resize each time, so this answer is an extension of the above one.

    HTML:

    JQuery:

      $('#chart').remove(); // this is my  element
      $('#chart_parent').append('');
    

提交回复
热议问题