vasturiano / circlepack-chart

A circle packing interactive chart web component for visualizing hierarchical data
https://vasturiano.github.io/circlepack-chart/example/flare
MIT License
63 stars 20 forks source link

In typescript has this error #5

Closed wustzhaohui closed 3 years ago

wustzhaohui commented 3 years ago

Type '{ name: string; value: number; }' is not assignable to type 'Node'. Object literal may only specify known properties, and 'value' does not exist in type 'Node'. TS2322

11 |           {
12 |             name: "leafA",

13 | value: 3 | ^ 14 | }, 15 | { 16 | name: "nodeB",

vasturiano commented 3 years ago

@wustzhaohui have you tried correctly typing your node objects by extending the baseline Node?

import { Node } from 'circlepack-chart'; 
...
interface MyNode extends Node {
  value: number;
}
wustzhaohui commented 3 years ago

there has another problem. It can not draw when the data is too large.

by the way do you have any contact?

this is my Telegram +8618601780983 fred zhao

vasturiano commented 3 years ago

@wustzhaohui if you have an issue with the rendering, could you make a quick example on codepen.io, so it can be debugged further?

wustzhaohui commented 3 years ago

@wustzhaohui if you have an issue with the rendering, could you make a quick example on codepen.io, so it can be debugged further?

I solved it by set the value type as number.