我在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
&amp;应显示Eta
。我尝试使用.color
方法.color(String|Function|Object)
使用key secondary
接受值color
。如何写这个表达式?
请访问D3 Plus Documentation
答案 0 :(得分:1)
注释为中心节点创建辅助节点列表的代码帮助我实现了我想要的目标。看到注释行
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 WORKING