我绕过了d3plus环,在其中我只需要显示环中的主连接。
<!doctype html>
<meta charset="utf-8">
<script src="http://www.d3plus.org/js/d3.js"></script>
<script src="http://www.d3plus.org/js/d3plus.js"></script>
<div id="viz"></div>
<script>
var connections = [ {"source": "alpha", "target": "beta"},
{"source": "alpha", "target": "gamma"},
{"source": "beta", "target": "delta"},
{"source": "beta", "target": "epsilon"},
{"source": "zeta", "target": "gamma"},
{"source": "theta", "target": "gamma"},
{"source": "eta", "target": "gamma"} ]
var visualization = d3plus.viz()
.container("#viz") // container DIV to hold the visualization
.type("rings") // visualization type
.edges(connections) // list of node connections
.focus("alpha") // ID of the initial center node
.draw() // finally, draw the visualization!
选择Gamma后,应显示Alpha、Zeta、Theta & Eta。我尝试了.color方法,即.color(String|Function|Object)使用key secondary,接受值color。如何为此编写表达式?请访问D3 Plus Documentation

点击Beta应该会显示

发布于 2016-07-21 15:47:28
注释代码可以创建中心节点的次要节点列表,这帮助我实现了我想要实现的目标。请参阅注释行
a = (angle-(s*children/2)+(s/2))+((s)*i)
d.d3plus.radians = a
d.d3plus.x = vars.width.viz/2 + ((secondaryRing) * Math.cos(a))
d.d3plus.y = vars.height.viz/2 + ((secondaryRing) * Math.sin(a))
//secondaries.push(d) THE LINE I COMMENTED AND GOT IT WORKINGhttps://stackoverflow.com/questions/38388499
复制相似问题