If you're running in a browser, you cannot load local files.
But it's fairly easy to run a dev server, on the commandline, simply cd
into the directory with your files, then:
python -m SimpleHTTPServer
(or python -m http.server
using python 3)
Now in your browser, go to localhost:3000
(or :8000
or whatever is shown on the commandline).
The following used to work in older versions of d3:
var json = {"my": "json"};
d3.json(json, function(json) {
root = json;
root.x0 = h / 2;
root.y0 = 0;
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…