简体   繁体   English

如何让Jsfiddle读取我的本地csv文件?

[英]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. 我正在尝试使用jsfiddle在d3中构建数据viz,但我不认为它正在读取我的本地csv文件,尽管给它正确的路径。 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. 这是一个CORS问题。 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. 因此,您将无法继续jsfiddle。 You will need to work on the files locally entirely or on a domain of some sort. 您将需要在本地完全或在某种域上处理文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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