How to change the direction of the arrow in the d3plus ring

How to change the direction of the arrow on targetto sourcefrom sourceup targetin accordance with the documentation, he said, to use Objectthe method .edges( Array | Object | url ). D3plus documentation . The complete code is as follows to learn about the direction of the arrow.

<!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>

Console message. Console Message

+4
source share
1 answer

Try the following:

<!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>
+2
source

Source: https://habr.com/ru/post/1652940/


All Articles