关系图与D3 [英] Relationship Graph with D3

查看:356
本文介绍了关系图与D3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用D3创建以下图形?我不知道这种类型的可视化的名称,最近我可以找到的是强制导向图。



图例:填充节点是人,填充的节点是属性(例如,喜爱的颜色)。



解决方案

黑客攻击了一个粗糙但可行的版本: http://bl.ocks.org/hijonathan/5793014



基本上,数组节点上有一些属性。然后我循环通过,并为每个属性生成新的节点,添加目标到它链接回原始节点。



从这里,您可以使用在这两个节点类型上设置的属性来设置它们的样式并创建相应的节点。


How would I create the following graph with D3? I don't know the name for this type of visualization, and the closest I could find were "force-directed" graphs.

Legend: Filled nodes are people, non-filled nodes are attributes (e.g. favorite color).

解决方案

Hacked together a gross but working version: http://bl.ocks.org/hijonathan/5793014

Basically, I started with an array of people nodes that had some properties on them. I then loop through that and generate new nodes for each property, adding a target to it to link it back to the original node.

From there, you can use properties set on those two node types to style them and create corresponding nodes.

这篇关于关系图与D3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆