Reputation: 589
I've tried to purloin Mike's excellent stacked area chart by replacing it with my own data, and all hell has broken loose in a way I don't usually encounter at this level of example adaptation. Specifically, it throws this at the console:
Uncaught TypeError: Cannot read property '1' of undefined
That's in reference to the fairly innocuous line that implements the stack function:
var layers = stack(nest.entries(data));
My data schema is matched almost exactly with that of the example - the one difference being that "date" has a 4-digit year, but I've accounted for that with
d3.time.format("%m/%d/%Y");
I can't figure out why 'nest.entries(data)' is coming up as undefined, or even why the stack function is asking for a property called "1". Any assistance would be greatly appreciated.
Attempted chart here: http://bl.ocks.org/wboykinm/10499388
Upvotes: 0
Views: 516
Reputation: 5015
Make sure you have the same date represented for each group, like this:
date,key,value
1/4/2013,phone,549
1/4/2013,email,402
1/4/2013,url,620
8/4/2013,phone,165
8/4/2013,email,265
8/4/2013,url,52
15/4/2013,phone,300
15/4/2013,email,145
15/4/2013,url,450
...
Upvotes: 1