d3.json: “Uncaught TypeError: Cannot read property 'children' of undefined”

后端 未结 5 2119
面向向阳花
面向向阳花 2021-01-05 16:14

I am trying out d3 as a tool for representing biological data.

I am trying to open the following example in my chrome browser so that I can understand how it works

5条回答
  •  伪装坚强ぢ
    2021-01-05 16:30

    Had the same exact error. The solution is pretty simple: You are not providing a JSON object array. You said your JSON begun as follows:

    { "name": "flare", "children": [ ...

    Please change so change is begins as follows:

    [{ "name": "flare", "children": [ ...}]

    That way D3 will be able to locate the "first child"

提交回复
热议问题