Question: I'm trying to import the data from this csv file. Get the data var pathToCsv = q3.csv; // path to csv d3.dsv(,, pathToCsv, function (d)
I'm trying to import the data from this csv file.
Get the data
var pathToCsv = "q3.csv"; // path to csv
d3.dsv(",", pathToCsv, function (d) {
return {
Year:+d.year, // convert "Year" column to Date
Running_total:+d.running_total // convert "Length" column to number
// format data attributes if required
};
}).then(function (data) {
console.log(data); // you should see the data in your browser's developer tools console
I'm getting this error in my console:
TypeError: Failed to fetch at u (file:///C:/Users/tazex/AppData/Local/Temp/Temp1_Y7b5hemF5P_hw1.zip/Q3/lib/d3-fetch/d3-fetch.min.js:2:498) at Object.t.dsv (file:///C:/Users/tazex/AppData/Local/Temp/Temp1_Y7b5hemF5P_hw1.zip/Q3/lib/d3-fetch/d3-fetch.min.js:2:1165) at file:///C:/Users/tazex/AppData/Local/Temp/Temp1_Y7b5hemF5P_hw1.zip/Q3/submission.html:57:8 {stack: 'TypeError: Failed to fetch at u (file:///p1_Y7b5hemF5P_hw1.zip/Q3/submission.html:57:8', message: 'Failed to fetch'}
I need help getting the data to run in a d3.js html file. It dosn't run on the http server and I map to the folder and ran the "python -m http.server 8000" to run the local.host. But no data is uploading.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
