Compilation errors when drawing a piechart using d3.js and TypeScript

后端 未结 3 1063
暖寄归人
暖寄归人 2021-02-14 21:23

I am attempting to draw a pie chart using the d3.js library and TypeScript. I have the following code:

\"use strict\";
module Chart {
  export class chart {

            


        
3条回答
  •  生来不讨喜
    2021-02-14 21:51

    Try to replace

    .attr('d', arc)   
    

    with

    .attr('d', arc)  
    

    This hides the compiler error on my computer but if that actually work... Well, I don't know.

    My understanding of the problem is that you provide .data function with number values and TypeScript compiler expects that .attr will contain also a number but you provide an arc instead.

提交回复
热议问题