3 color
= d3
.scale
.category20c();
5 var svg
= d3
.select("#table_graph").append("svg")
7 .attr("height", height
);
9 var force
= d3
.layout
.force()
13 .size([width
, height
]);
15 //d3.json("js/graph.json", function(error, json) {
16 d3
.json("http://127.0.0.1:5001/restapi/network/d3jsgraph", function(error
, json
) {
17 if (error
) throw error
;
24 var link
= svg
.selectAll(".link")
26 .enter().append("line")
27 .attr("class", "link");
29 var node
= svg
.selectAll(".node")
32 .attr("class", "node")
35 //node.append("image")
36 // .attr("xlink:href", "https://github.com/favicon.ico")
40 // .attr("height", 16);
43 .style("fill", function(d
) { return color(d
.name
); });
48 .text(function(d
) { return d
.name
});
50 force
.on("tick", function() {
51 link
.attr("x1", function(d
) { return d
.source
.x
; })
52 .attr("y1", function(d
) { return d
.source
.y
; })
53 .attr("x2", function(d
) { return d
.target
.x
; })
54 .attr("y2", function(d
) { return d
.target
.y
; });
56 node
.attr("transform", function(d
) { return "translate(" + d
.x
+ "," + d
.y
+ ")"; });