我想了解如何构建数据集以通过分层边缘捆绑进行可视化。
这是我的测试数据集
[
{"name":"Flare.Expertise.Informatics","imports":["Flare.Expertise.Informatics.Programming","Flare.Expertise.Informatics.Networking","Flare.Expertise.Informatics.Security","Flare.Expertise.Informatics.BioInformatics","Flare.Expertise.LifeScience.Zoology","Flare.People.APerson","Flare.People.BPerson","Flare.People.CPerson","Flare.People.DPerson"]},
{"name":"Flare.People","imports":["Flare.People.APerson","Flare.People.BPerson","Flare.People.DPerson"]},
{"name":"Flare.Expertise.LifeScience","imports":["Flare.Expertise.LifeScience.Biology","Flare.Expertise.LifeScience.Zoology","Flare.People.APerson","Flare.People.CPerson"]},
{"name":"Flare.Expertise.Informatics.Programming","imports":["Flare.People.APerson","Flare.People.BPerson"]},
{"name":"Flare.Expertise.Informatics.Networking","imports":["Flare.People.APerson","Flare.People.DPerson"]},
{"name":"Flare.Expertise.Informatics.Security","imports":["Flare.People.BPerson","Flare.People.DPerson"]},
{"name":"Flare.People.BPerson","imports":["Flare.Expertise.Informatics.Security","Flare.Expertise.Informatics.Programming"]},
{"name":"Flare.People.APerson","imports":["Flare.LifeScience.Zoology","Flare.Expertise.Informatics.Networking","Flare.Expertise.Informatics.Programming"]},
{"name":"Flare.People.DPerson","imports":["Flare.Expertise.Informatics.Networking","Flare.Expertise.Informatics.Security","Flare.Expertise.Business.Commerce"]},
{"name":"Flare.People.CPerson","imports":["Flare.Informatics.BioInformatics","Flare.LifeScience.Biology","Flare.Expertise.Business.Marketing"]},
{"name":"Flare.Informatics.BioInformatics","imports":["Flare.People.CPerson"]},
{"name":"Flare.LifeScience.Zoology","imports":["Flare.People.APerson"]},
{"name":"Flare.Expertise.Business","imports":["Flare.Expertise.Business.Marketing","Flare.Expertise.Business.Commerce","Flare.People.CPerson","Flare.People.DPerson"]},
{"name":"Flare.Expertise.Business.Commerce","imports":["Flare.People.DPerson"]},
{"name":"Flare.LifeScience.Biology","imports":["Flare.People.CPerson"]}
]
所以有两个主要类别
Flare.Expertise
Flare.People
Flare.Expertise有3个主要类别:信息学,LifeSicence,商业。每个子类别都有更多类别,例如LifeScience,它是:动物学和生物学
Flare.People有4个人:APerson,BPerson,CPerson和DPerson
我需要证明所有人都有不同的专业知识。例如,CPerson有关于生物信息学和生物学的信息。因此,一个人可以拥有多个主要类别和相应子类别的专业知识
我正在尝试在D3 Hierarchical bundling example实施算法。我收到错误了
Uncaught TypeError: Cannot read property 'push' of undefined
我无法解决此错误。如果我更改了push操作符,我会得到空白页面。对我来说,问题似乎与数据集。我不明白数据集中的错误在哪里。所以,请帮我解决这个错误。另外,请让我知道如何在数据中可视化上述关系
答案 0 :(得分:3)
我从这个博客找到了解决方案
http://ianh.co/modeling-data-with-the-d3-js-bundle-layout/
根据"进口的所有类别"必须出现在"名称"。
通过这个,我能够纠正我的数据集并且能够使用它。