如何将target
的{{1}}改为source
从source
更改为target
按照Object
.edges( Array | Object | url )
所述的文档进行更改1}}方法。 D3plus Documentation。
完整的代码如下,以了解箭头方向。
<!doctype html>
<meta charset="utf-8">
<script src="//d3plus.org/js/d3.js"></script>
<script src="//d3plus.org/js/d3plus.js"></script>
<div id="viz"></div>
<script>
var connections = [
{"source": "alpha", "target": "beta"},
{"source": "alpha", "target": "gamma"},
{"source": "alpha", "target": "delta"},
{"source": "alpha", "target": "epsilon"},
{"source": "alpha", "target": "peta"},
{"source": "alpha", "target": "zeta"},
{"source": "alpha", "target": "eta"}
]
var visualization = d3plus.viz()
.container("#viz")
.type("rings")
.edges(connections)
.edges({"direction":{"accepted":["source","target"],"value":"source"}})
//.adeges({"direction":{"accepted":["source","target"],"value":"target"}})
.edges({"arrows":true,"color":"#000000"})
.focus("alpha")
.draw()
</script>
答案 0 :(得分:2)
试试这个:
<!doctype html>
<meta charset="utf-8">
<script src="//d3plus.org/js/d3.js"></script>
<script src="//d3plus.org/js/d3plus.js"></script>
<div id="viz"></div>
<script>
var connections = [
{"source": "alpha", "target": "beta"},
{"source": "alpha", "target": "gamma"},
{"source": "alpha", "target": "delta"},
{"source": "alpha", "target": "epsilon"},
{"source": "alpha", "target": "peta"},
{"source": "alpha", "target": "zeta"},
{"source": "alpha", "target": "eta"}
]
var visualization = d3plus.viz()
.container("#viz")
.type("rings")
.edges(connections)
.edges({"arrows":true, "color":"#000000"})
.edges({"arrows": { "value": ["source","target"], "direction": "source"}})
.focus("alpha")
.draw()
</script>