I am trying to import CSV data with using D3.js.
var englishArray=\"\";
d3.csv(\"data.csv\",
function(d) {
return [d.value]
},
function(error
Here is the example which describe how to import csv file in d3.js.
CSV File
Year,Make,Model,Length
1997,Ford,E350,2.34
2000,Mercury,Cougar,2.38
JavaScript Array is
[
{"Year": "1997", "Make": "Ford", "Model": "E350", "Length": "2.34"},
{"Year": "2000", "Make": "Mercury", "Model": "Cougar", "Length": "2.38"}
]
Code to import CSV data using d3.js
d3.csv("example.csv", function(d) {
return {
year: new Date(+d.Year, 0, 1), // convert "Year" column to Date
make: d.Make,
model: d.Model,
length: +d.Length // convert "Length" column to number
};
}, function(error, rows) {
console.log(rows);
});