i developing solution using d3.js library when click on circle should zoomed , data needs shown inside circle.
as first step trying load data json file.
below contents of json file , using visual studio 2012 .
mydata.json
[{"name":"ravi","age":25},{"name":"aman","age":29}]
both .html file , .json file in same folder, still getting error.
line: 5734 error: unable value of property 'children': object null or undefined
below script:
var canvas = d3.select("body").append("svg") .attr("width", 500) .attr("height", 500); d3.json("mydata.json", function (data) { var treemap = d3.layout.treemap() .size([500, 500]) .nodes(data) console.log(treemap); }); </script>
note: trying load file , using layout treemap.
thanks
to better idea of going on, either use debugger;
+ dev console or add more logging:
d3.json("mydata.json", function (error, data) { console.log(error); console.log(data); var treemap = d3.layout.treemap() .size([500, 500]) .nodes(data) console.log(treemap); });
hosting files python -m simplehttpserver
, navigating 127.0.0.1:8000
logs following on computer:
null [{"name":"ravi","age":25},{"name":"aman","age":29}] [[{"name":"ravi","age":25},{"name":"aman","age":29}]]
which makes me think aren't accessing files through server; try doing that.
Comments
Post a Comment