1

我想了解如何构建数据集以通过分层边缘捆绑进行可视化。

这是我的测试数据集

  [
        {"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"]}
        ]   

所以有2个主要类别

  1. Flare.Expertise

  2. Flare.People

    Flare.Expertise 有 3 个主要类别:信息学、生命科学、商业。每个子类别都有更多类别,例如生命科学:动物学和生物学

Flare.People 有 4 个人:APerson、BPerson、CPerson 和 DPerson

我需要证明所有人都有不同的专长。例如 CPerson 有关于生物信息学和生物学的信息。因此,一个人可以拥有多个主要类别的专业知识,然后是各自的子类别

我正在尝试在D3 Hierarchical bundling example中实现算法。我收到一个错误 Uncaught TypeError: Cannot read property 'push' of undefined

我无法修复此错误。如果我更改推送运算符,我会得到空白页。对我来说,问题似乎与数据集有关。我不明白数据集中的错误在哪里。所以,请帮我解决这个错误。否则,请让我知道如何在我的数据中可视化上述关系

4

1 回答 1

3

我从这个博客中找到了解决方案

http://ianh.co/modeling-data-with-the-d3-js-bundle-layout/

据此,“进口”中的所有类别都必须出现在“名称”中。

通过它,我能够更正我的数据集并能够使用它。

于 2015-05-30T16:14:27.507 回答