The trick is that your browser needs to be able to access the file using the URL that you provide, so if you host your d3 code on a web server, then you have to host the data.csv as well.

If you use a relative path, then the path is relative to your HTML file.

Try using

d3.csv("data.csv", type, function(error, data)]

but make sure that data.csv is in the same location as the HTML file that you are using for your HTML.

Related Query