위의 d3.js의 기본 도넛 차트 코드를 활용하여 기본 차트를 테스트 중, 특정 코드에서 function 에러가 발생했다.

Uncaught TypeError: d3.scaleOrdinal is not a function
Uncaught TypeError: d3.pie is not a function
Uncaught TypeError: d3.arc is not a function

위의 에러는 차트를 그리는 스크립트 코드에서 해당 코드를 아래와 같이 변경해주면, 문제없이 차트가 그려진다.

d3.scaleOrdinal()는 d3.scale.ordinal()로

d3.pie()는 d3.layout.pie()로

d3.arc()는 d3.svg.arc()로 변경해 실행해본다.

d3.scaleOrdinal() → d3.scale.ordinal()
d3.pie() → d3.layout.pie()
d3.arc() → d3.svg.arc()

Leave a Reply

Your email address will not be published. Required fields are marked *