Como adiciono duas formas diferentes ao gráfico direcionado forçado D3 com base no valor do campo de forma?
Eu sou novato na D3. Eu estou usando o gráfico direcionado por força. Eu quero adicionar dois tipos diferentes de formas nos locais do nó.
Meu json está seguindo:
{
"nodes":[
{"name":"00:00:00:00:00:00:00:01","group":0,"shape":1},
{"name":"00:00:00:00:00:00:00:02","group":1,"shape":1},
{"name":"00:00:00:00:00:00:00:03","group":2,"shape":1},
{"name":"00:00:00:00:00:00:00:11","group":0,"shape":0},
{"name":"00:00:00:00:00:00:00:21","group":1,"shape":0},
{"name":"00:00:00:00:00:00:00:31","group":2,"shape":0},
{"name":"00:00:00:00:00:00:00:32","group":2,"shape":0},
{"name":"00:00:00:00:00:00:00:12","group":0,"shape":0},
{"name":"00:00:00:00:00:00:00:22","group":1,"shape":0}
],
"links":[
{ "source": 0, "target": 0, "value": 5 },
{ "source": 1, "target": 1, "value": 5 },
{ "source": 2, "target": 2, "value": 5 },
{ "source": 3, "target": 0, "value": 5 },
{ "source": 4, "target": 1, "value": 5 },
{ "source": 5, "target": 2, "value": 5 },
{ "source": 6, "target": 2, "value": 5 },
{ "source": 7, "target": 0, "value": 5 },
{ "source": 8, "target": 1, "value": 5 }
]
}
Se o valor da forma for 1, desenhe o círculo e, se o valor da forma for 0, desenhe o retângulo. O link do exemplo de gráfico direcionado à força é:http://bl.ocks.org/mbostock/4062045
Eu tentei exemplo link JSFiddle:http://jsfiddle.net/mayurchavda87/Sc2xC/3/