I’m trying to integrate this simple d3.js example (http://bl.ocks.org/mbostock/3750558) into my vaadin project, which uses a JSON file to store the graph nodes and links.
Within my vaadin project the JSON file for some reason can’t be accessed via
d3.json("graph.json", function(error, graph)
(the .js integration works, I’ve displayed a hardcoded graph without problems).
JSON and .js files are in the same folder,
please see the attachment for a detailed view.
Any ideas on how I can access the JSON file? Thanks in advance
did you try to acces the JSON file by web browser? I don’t know d3 too much but I assume, the first parameter “graph.json” is the URL to the JSON file. So it is a relative path from X to graph.json. So the file has to be in the absolute path X.
if you can’t open it by absolute path (C:..) the file does not exist But the file system path is not relevant. Because it is JavaScript, the web browser must be able to open it from a relative path of the current script (/VAADIN). So you have to check your web configuration (web.xml?) which files are available public .