javascript - D3 will not load Tree Map -


I am trying to display and display a tree map to use D3 with a JSO file . Very easy, just trying to get D3 trying to enjoy. However, I put both my tree.js together and after running the script, I get a blank page. The console says that

  can not load the XMLHttpRequest file: ///Users/aczre/Desktop/d3TestApp/shreleases.json cross original requests are only supported for HTTP not come into consideration Writing Error: 6081 d3_layout_hierarchyChildren d3.v2.js: 6081 recurse d3.v2.js: 5990 hierarchy d3.v2.js: 6033 tree d3.v2.js: 6384 'children' of property null d3.v2.js can not be read Object.nodes d3.v2.js: 6074 (anonymous function) tree.js: 17 d3.json d3.v2.js: 514 ready d3.v2.js: 504 d3.xhr.req.onreadystatechange d3.v2.js : 497 d3.xhr d3.v2.js: 500 d3.text d3.v2.js: 510 d3.json d3.v2.js: 513 (anonymous function) tree.js: 16 Uncaught Error: NETWORK_ERR: XMLHttpRequest Apava 101 d3. V2.js: 500 d3.xhr d3.v2.js: 500 d3.text d3.v2.js: 510 d3.json d3.v2.js: 513 (anonymous function) tree.js: 16   

Not sure what I did ... here my tree.js

  var width = 960, height = 2000; Var tree = d3.layout.tree (). Size ([height, width - 160]); Var diagonal = d3.svg.diagonal () Projection (function (D) {returns [DE, DX];}); ("Width", width) .attr ("height", height). Append ("g") .attr ("transform", "translation (40, 0)"); D3.json ("shreleases.json", function (jsn) {// line 16 var nodes = tree.nodes (jsn); var link = vsa.sealt ("path.link"). Data (tree Link (Nodes).)) Enter () Attached ("Path") .attr ("Square", "Link") .attr ("D", Diagonal); Node = vis.selectAll ("g.node") .data (("+", "+ Dx +") "" ("") ";}) node.append (" cycle ") .attr ( "R", 4.5) ;? Node.append ("text") .attr ("dx", function (d) {d.children return - 8: 8;}) .attr ("dy", 3) .attr ("text-anchor", function (D) {returns d.children? "End": "start";}) .text (function (d)) {return d. Name;});});   

I tried to stick with the examples written on the D3 website, but I'm not sure if I fully understand the syntax.

You probably have to request a JSON file from a web server. The error message is complaining that this is not an HTTP request, because your file is stored locally.

If you are one of them, you can throw your JSS file on your web host. Or you can create a local server setup in some way.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -