student student - 2 months ago 31
JSON Question

Bubble Menu using D3.js not rendering in jsfiddle

We've got a Bubble Menu using D3.js which is not rendering in this fiddle

The function

d3.json
loads from http://sunsp.net/demo/BubbleMenu/main_bubble.json which doesn't seems to be loading properly:


XMLHttpRequest cannot load http://sunsp.net/demo/BubbleMenu/main_bubble.json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://fiddle.jshell.net' is therefore not allowed access.


XMLHttpRequest
is not the main issue
, we're comfortable with

var data = {JSON data goes here}


which shall be passed to
d3.json


Also, there is one more issue:


Uncaught TypeError: Cannot read property 'children' of undefined


The code is entirely copy pasted, but it's working on the main site but not on fiddle

Answer
  1. Rename data JSON variable to root.
  2. Remove the d3.json call