2016-07-15 25 views
0

我工作在d3plus环上,而我只需要在环中显示主要连接。如何在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被选中,那么AlphaZetaTheta & Eta应显示。我尝试了方法.color其中说.color(String|Function|Object)使用key secondary接受值color。如何写这个表达式? 请访问D3 Plus Documentation

enter image description here

点击了Beta应该显示 enter image description here

+0

需要的行为是什么?你能上传图片吗? –

+0

让我们[在聊天中继续讨论](http://chat.stackoverflow.com/rooms/117387/discussion-between-gupteshwari-and-dragon-slayer)。 – Gupteshwari

回答

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 
+0

您可能必须下载d3plus.js,调整它并自己提供,对不对?或者有没有办法从网络加载脚本并在之后调整行为? – MERose