관리 메뉴

웹개발자의 기지개

[Javascript] Chart.js 오류해결하기 - chart.js:19 Uncaught Error: Canvas is already in use. Chart with ID '2' must be destroyed before the canvas with ID 'myChartIn' can be reused. 본문

javascript

[Javascript] Chart.js 오류해결하기 - chart.js:19 Uncaught Error: Canvas is already in use. Chart with ID '2' must be destroyed before the canvas with ID 'myChartIn' can be reused.

http://portfolio.wonpaper.net 2024. 2. 9. 23:36

 

 

chart.js:19 Uncaught Error: Canvas is already in use. Chart with ID '2' must be destroyed before the canvas with ID 'myChartIn' can be reused.
    at new An (chart.js:19:89653)
    at Object.success (main.asp:1259:6)
    at j (jquery-1.11.3.min.js:1342:26)
    at Object.fireWith [as resolveWith] (jquery-1.11.3.min.js:1399:33)
    at x (jquery-1.11.3.min.js:3977:23)
    at XMLHttpRequest.b (jquery-1.11.3.min.js:4173:30)

 

 

 

Chart.js 코딩 작업시에 흔하게 나타날수 있는 에러메세지이다.

 

1
2
3
4
let chartStatus = Chart.getChart("Chart이름_id값");
if (chartStatus !== undefined) {
    chartStatus.destroy();
}
cs

 

 

참고 : https://velog.io/@yxxnhx/Chart.js-CANVAS-is-already-in-use-%EC%97%90%EB%9F%AC-%ED%95%B4%EA%B2%B0%ED%95%98%EA%B8%B0

 

 

 

 

 

 

Comments