d3分层 - 缺少数据字段

时间:2018-05-20 08:34:39

标签: d3.js tree

我正在使用分层来从平面数据结构构建d3树。但是,当我尝试使用d.data调用它们时,某些字段会丢失。 fieldname

这是我的数据结构:

public class ExampleClass : MonoBehaviour {
    void Example() {
        RenderSettings.ambientLight = //here the color you consider
    }
}

我正在使用这个分层命令构建分层数据结构:

var flatData = [

  {"name": "Data Encrypted", "parent": null, "category": "test", "score": null },
  {"name": "Malware on Target", "parent": "Data Encrypted", "category": "test", "score": null  },
  {"name": "Malware executed", "parent": "Data Encrypted", "category": "test", "score": "1"  },
  {"name": "Files modified", "parent": "Data Encrypted", "category": "test", "score": "1"  },

];

正确显示d3树,我可以展开/折叠节点等,并分别使用d.data.id和d.data.name显示每个节点的ID和名称。如果我尝试使用d.data.score或d.data.category来显示数据,我会得到一个未定义的'错误。

非常感谢能够帮助我解决这个问题的任何信息。

0 个答案:

没有答案