0

I am entirely new to d3.js so please excuse me if I wrote anything wrong. In index.html, I have the code as below:

var start = function(){

           queue()
                   .defer(d3.json, "data.json")
                   .defer(d3.json, "mdata.json")
                   .await(dataLoaded);

       }

I get the output as excepted when data.json and mdata.json reside in the same directory as index.html but if they are in different directory I am not getting the required output even after passing the file path. I am on windows 7 please help me to pass correct file path (Suppose if my path starts with C:\Users\sp123\DataDir\data.json)?

sp123
  • 45
  • 10
  • 1
    We can't possibly guess what the path on your machine is. – Lars Kotthoff May 07 '15 at 18:46
  • Thanks. Suppose if my path starts with C:\Users\sp123\DataDir\data.json – sp123 May 07 '15 at 19:58
  • Well, what's the root directory of your webserver? You can't give absolute local filesystem paths, you need to provide relative paths to the webserver root. – Lars Kotthoff May 07 '15 at 20:05
  • my web server root directory is https://localhost:8080/myApp. And the data.json and mdata.json resides in myApp/images/ folder – sp123 May 11 '15 at 18:49
  • Then you should be able to use paths `images/data.json` and `images/mdata.json`. – Lars Kotthoff May 11 '15 at 18:58
  • Thanks but everytime I run the app a new directory is created under images folder which has this content i.e, data.json and mdata.json. I have the path in my controller which I pass it to view (d3) and use the passed parameter to fetch the file, but I get 404 not found error for mdata.json and data.json? – sp123 May 11 '15 at 19:09
  • You need to know the path to the files. Presumably you can tell your webserver to put it in a specific location. – Lars Kotthoff May 11 '15 at 19:19

0 Answers0