【发布时间】:2014-06-03 13:44:58
【问题描述】:
在 D3,edge bundling example,我们有这个代码
// Lazily construct the package hierarchy from class names.
function packageHierarchy(classes) {
var map = {};
function find(name, data) {
var node = map[name], i;
if (!node) {
node = map[name] = data || {name: name, children: []};
if (name.length) {
node.parent = find(name.substring(0, i = name.lastIndexOf(".")));
node.parent.children.push(node);
node.key = name.substring(i + 1);
}
}
return node;
}
classes.forEach(function(d) {
find(d.name, d);
});
return map[""];
}
我不知道return map[""]; 是什么意思。有什么想法吗?
【问题讨论】:
标签: javascript d3.js bundle-layout