简体   繁体   中英

How can I get Jsfiddle to read my local csv file?

I'm trying to build a data viz in d3 using jsfiddle but I don't think it's reading my local csv file despite giving it the correct path. Here is my code

d3.csv("/Users/Downloads/bar-data.csv", 
function(error, data) {

data.forEach(function(d) {
    d.date = parseDate(d.date);
    d.value = +d.value;
});

Am I doing something wrong here? Do I need to store the data somewhere else?

This is a CORS issue. You will need to move this file to a location that is on the same domain as your code. Thus you wont be able to continue in jsfiddle. You will need to work on the files locally entirely or on a domain of some sort.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM