Simply replace d3.json
call with
json = JSON.parse( myjson );
IE:
var myjson = '{"name": "flare","children": [{"name": "analytics","children": [{"name": "cluster","children": [{"name": "MergeEdge", "size": 10 }]}]}]}';
// d3.json("/path/flare.json", function(json) { #delete this line
json = JSON.parse( myjson ); //add this line
//rendering logic here
//} #delete this line
UPDATE 09/2013
Original code has changed. So varname json
should be root
:
// d3.json("flare.json", function(error, root) { #delete this line
root = JSON.parse( myjson ); //add this line
//rendering logic here
//} #delete this line
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…