Count the number of rows of a CSV file, with d3.js
- by user2934073
Suppose I have this CSV file
Day,What
2013-10-27,Apple
2013-10-27,Cake
2013-10-27,Apple
2013-10-28,Apple
2013-10-28,Apple
2013-10-28,Blueberry
2013-10-28,Orange
I would like to drawn with D3.js a time-series graph. All I need to do is to display the sum of the number of rows for each day. As an example, the 27 of November should have 3 as value, the 28th should have 4.
Is there a way I can archive it? I've been trying to create a new dataset out of the CSV one with no positive results.
var dataset;
d3.csv("data.csv", function(d) {
return {
Day: new Date(d.Day),
What: d.What
};
},
function(error, rows) {
dataset = rows;
// I SUPPOSE THE FUNCTION THAT GENERATE THE NEW DATASET SHOULD GO THERE
});