daf4e4a83a85ccf1fd6568a1121d796786a50ca3
3 color
= d3
.scale
.category10();
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")
36 //node.append("image")
37 // .attr("xlink:href", "https://github.com/favicon.ico")
41 // .attr("height", 16);
44 .style("fill", function(d
) { return color(d
.group
); });
49 .text(function(d
) { return d
.name
});
51 force
.on("tick", function() {
52 link
.attr("x1", function(d
) { return d
.source
.x
; })
53 .attr("y1", function(d
) { return d
.source
.y
; })
54 .attr("x2", function(d
) { return d
.target
.x
; })
55 .attr("y2", function(d
) { return d
.target
.y
; });
57 node
.attr("transform", function(d
) { return "translate(" + d
.x
+ "," + d
.y
+ ")"; });
60 // action to take on mouse click
62 d3
.select(this).select("text").transition()
65 .style("stroke", "lightsteelblue")
66 .style("stroke-width", ".5px")
67 .style("font", "20px sans-serif");
68 d3
.select(this).select("circle").transition()