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("http://127.0.0.1:5001/restapi/network/d3jsgraph", function(error
, json
) {
16 if (error
) throw error
;
23 var link
= svg
.selectAll(".link")
25 .enter().append("line")
26 .attr("class", "link");
28 var node
= svg
.selectAll(".node")
31 .attr("class", "node")
33 .on("dblclick", dblclick
)
37 .style("fill", function(d
) { return color(d
.group
); });
42 .text(function(d
) { return d
.name
});
44 force
.on("tick", function() {
45 link
.attr("x1", function(d
) { return d
.source
.x
; })
46 .attr("y1", function(d
) { return d
.source
.y
; })
47 .attr("x2", function(d
) { return d
.target
.x
; })
48 .attr("y2", function(d
) { return d
.target
.y
; });
50 node
.attr("transform", function(d
) { return "translate(" + d
.x
+ "," + d
.y
+ ")"; });
53 // action to take on double mouse click, call rest api to start xterm
55 var vnf_name
= d3
.select(this).text()
56 console
.debug(vnf_name
)
57 var rest_url
= "http://127.0.0.1:5001/restapi/monitor/term?vnf_list=" + vnf_name
59 d3
.json(rest_url
, function(error
, json
) {
60 if (error
) throw error
;