Setting color for sunburst-chart (library) in angular

Viewed 22

How to resolve this error?

I'm getting error at .color((d, parent) => this.getColor(d, parent))

Argument of type '(d: any, parent: any) => any' is not assignable to parameter of type 'Accessor<Node, string>'. Type '(d: any, parent: any) => any' is not assignable to type '(obj: Node) => string'.

This is how my chart is created

myChart = Sunburst();
this.myChart.data(this.myData)
    .height(400)
    .centerRadius(0.4)
    .tooltipTitle(d => this.tooltipTitle(d))
    .tooltipContent(d => this.toolTipContent(d))
    .label(d => this.displayLabel(d))
    .excludeRoot(true)
    .radiusScaleExponent(1)
    .labelOrientation('angular')
    .color((d, parent) => this.getColor(d, parent))
    (document.getElementById('sampleSunburst')); 

I'm new to angular so any help would be appreciated!

Thanks in advance :)

Screenshot of the error

when I run my code, I see this error.

ERROR in node_modules/@types/node/index.d.ts:73:11 - error TS2300: Duplicate identifier 'IteratorResult'. 73 interface IteratorResult { } ~~~~~~~~~~~~~~ node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6 41 type IteratorResult<T, TReturn = any> = IteratorYieldResult | IteratorReturnResult; ~~~~~~~~~~~~~~ 'IteratorResult' was also declared here. node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6 - error TS2300: Duplicate identifier 'IteratorResult'. 41 type IteratorResult<T, TReturn = any> = IteratorYieldResult | IteratorReturnResult; ~~~~~~~~~~~~~~ node_modules/@types/node/index.d.ts:73:11 73 interface IteratorResult { } ~~~~~~~~~~~~~~ 'IteratorResult' was also declared here. src/app/uhc/sunburst/sunburst.component.ts:45:12 - error TS2345: Argument of type '(d: any, parent: any) => any' is not assignable to parameter of type 'Accessor<Node, string>'. Type '(d: any, parent: any) => any' is not assignable to type '(obj: Node) => string'. 45 .color((d, parent) => this.getColor(d, parent)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 Answers
Related