Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: n is undefined in D3.js , trying to replicate the Hierarchical Edge Bundling

I'm trying to customize an example of Mike Bostock's Hierarchical Edge Bundling:

enter image description here

So far I've been able to generate what think is an equivalent json file with my data but I haven't been able to make it show.

In the console I get the following error:

TypeError: n is undefined

and the following warning:

mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create

I have tried in different browsers running a local server to no avail. I also found these questions which didn't solve the problem.

You can find my code and altered json in this gist.

Any help will be greatly appreciated.

like image 330
eclark Avatar asked Jan 10 '23 23:01

eclark


1 Answers

I've been trying to debug this error all morning, and finally figured it out.

Sample:
https://gist.github.com/mbostock/1044242

When it looks through the json array, every single imports must have a valid entry. In the example, if you delete the any line of that JSON array you will get the "TypeError: n is undefined"

The only way I found it was by copying the JSON file, and then replacing all the name properties with blank spaces. This eventually allowed me to find the one import that did not exist because I had an error in formatting.

Hope this helps.

like image 100
iexiak Avatar answered Jan 24 '23 16:01

iexiak