D3-graph-gallery
D3-graph-gallery copied to clipboard
tidy data stack keys
hello, Please, why didn't you use people's names? Where do these numbers come from? var mygroup = [1,2,3]
How can I use the names instead of numbers? Thank you
https://www.d3-graph-gallery.com/graph/stackedarea_basic.html
// Stack the data: each group will be represented on top of each other var mygroups = ["Helen", "Amanda", "Ashley"] // list of group names var mygroup = [1,2,3] // list of group names var stackedData = d3.stack() .keys(mygroup) .value(function(d, key){ return d.values[key].n }) (sumstat)