How to retrieve the key values of a nested data set in D3

和自甴很熟 提交于 2019-12-02 03:35:11

The keys() method (not when used as part of nest()) is intended for standard associative arrays, not nested data. You should take the values of dataGroup and iterate through each to extract the category property. There may be additional problems in your code, but try

color.domain(d3.values(dataGroup).map(function(d) {
    return d.category; 
}).filter(function(key) { return key !== "date"; }));

to start

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!