blob: a79aae9cd0e7706cd6582064ca7c8133afff4b3b [file] [log] [blame]
Matteo Scandolo70bc45f2016-05-06 14:10:11 -07001(function () {
2 'use strict';
3
4 angular.module('xos.serviceGrid')
5 .directive('serviceGraph', function(){
6 return {
7 restrict: 'E',
8 scope: {},
9 bindToController: true,
10 controllerAs: 'vm',
11 templateUrl: 'templates/service-graph.tpl.html',
12 controller: function(){
13
14 }
15 };
16 })
Matteo Scandolo3adf8792016-05-06 15:21:27 -070017})();
18
19// Draw services around xos and calculate coarse tenant as links
20
21// var width = 960, height = 500;
22
23// var fill = d3.scale.category10();
24
25// var nodes = [
26// {id: 1},
27// {id: 2},
28// {id: 3},
29// {id: 4},
30// {id: 5}
31// ];
32
33// var links = [
34// {source: 1, target: 2},
35// {source: 2, target: 3}
36// ];
37
38// var svg = d3.select("body").append("svg")
39// .attr("width", width)
40// .attr("height", height);
41
42// var force = d3.layout.force()
43// .nodes(nodes)
44// .links(links)
45// .charge(-8*12)
46// .gravity(0.1)
47// .size([width, height])
48// .on("tick", tick)
49// .start();
50
51// svg.append('circle')
52// .attr({
53// "class": "xos",
54// r: 20,
55// cx: () => width / 2,
56// cy: () => height / 2,
57// })
58
59// var node = svg.selectAll(".node")
60// .data(nodes)
61// .enter().append("circle")
62// .attr("class", "node")
63// .attr("cx", ({ x }) => x)
64// .attr("cy", ({ y }) => y)
65// .attr("r", 8)
66// .style("fill", ({}, index) => fill(index & 3))
67// .style("stroke", ({}, index) => d3.rgb(fill(index & 3)).darker(2))
68// .call(force.drag)
69// .on("mousedown", ({}) => d3.event.stopPropagation());
70
71// var link = svg.selectAll(".link")
72// .data(links).enter().insert("line")
73// .attr("class", "link");
74
75// function tick(e) {
76// // Push different nodes in different directions for clustering.
77
78// node.attr("cx", function(d) { return d.x; })
79// .attr("cy", function(d) { return d.y; });
80
81// link.attr("x1", function(d) { return d.source.x; })
82// .attr("y1", function(d) { return d.source.y; })
83// .attr("x2", function(d) { return d.target.x; })
84// .attr("y2", function(d) { return d.target.y; });
85// }