I am trying to link to a file located in the parent folder using d3.csv and I cannot find the correct syntax.
My folder structure is as follows:
root
└── js
├── data.csv
└── myGraph.js
In the js folder, I have myGraph.js. In this file, I have the following code snippet:
d3.csv("data.csv", function(error, data) {
data.forEach(function(d) {
d.date = parseDate(d.date);
d.close = +d.close;
});
If I put my data.csv file in the js folder, everything will work fine. However, if I transfer the data.csv file to the root folder
root
├── data.csv
└── js
└── myGraph.js
and change the code to this, then it will stop working:
d3.csv("/../data.csv", function(error, data)
I also tried:
d3.csv("../data.csv", function(error, data)
Does anyone know what I'm doing wrong and what is the correct syntax? Many thanks.
source
share