D3 for YYYY-MM-DD i.e. 2013-02-04
I get
Uncaught TypeError: Cannot read property 'length' of undefined
from my console on this line
var parseDate = d3.time.format("%Y-%m-%d").parse;
data.forEach(function(d) {
d.Day = parseDate(d.Day);
});
this is how my date is formatted in my json object day: "2013-02-04"
+3
CQM
source
to share
1 answer
I suspect the "day" case is not correct. I can execute:
var parseDate = d3.time.format("%Y-%m-%d").parse;
parseDate( "2013-02-03" )
No problem (correct date displayed). You probably need to change your code to:
data.forEach(function(d) { d.day = parseDate(d.day); });
(note the lowercase "d" in "day")
+6
cmonkey
source
to share