forked from pokerG/os-ed-and-pl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
91 lines (78 loc) · 2.72 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<html>
<head>
<link rel="stylesheet" type="text/css" href="./script/style.css">
<script src="./script/vivagraph.min.js"></script>
<script type="text/javascript">
function onLoad() {
var graph = Viva.Graph.graph();
// Construct the graph
graph.addNode('anvaka', {url : 'http://www.kuqin.com/upimg/topic/Ruby.png'});
graph.addNode('manunt', {url : 'https://secure.gravatar.com/avatar/c81bfc2cf23958504617dd4fada3afa8'});
graph.addNode('thlorenz', {url : 'https://secure.gravatar.com/avatar/1c9054d6242bffd5fd25ec652a2b79cc'});
graph.addNode('bling', {url : 'https://secure.gravatar.com/avatar/24a5b6e62e9a486743a71e0a0a4f71af'});
graph.addNode('diyan', {url : 'https://secure.gravatar.com/avatar/01bce7702975191fdc402565bd1045a8?'});
graph.addNode('pocheptsov', {url : 'https://secure.gravatar.com/avatar/13da974fc9716b42f5d62e3c8056c718'});
graph.addNode('dimapasko', {url : 'https://secure.gravatar.com/avatar/8e587a4232502a9f1ca14e2810e3c3dd'});
graph.addLink('anvaka', 'manunt');
graph.addLink('anvaka', 'thlorenz');
graph.addLink('anvaka', 'bling');
graph.addLink('anvaka', 'diyan');
graph.addLink('anvaka', 'pocheptsov');
graph.addLink('anvaka', 'dimapasko');
// Set custom nodes appearance
var graphics = Viva.Graph.View.svgGraphics();
graphics.node(function(node) {
// The function is called every time renderer needs a ui to display node
return Viva.Graph.svg('image')
.attr('width', 24)
.attr('height', 24)
.link(node.data.url); // node.data holds custom object passed to graph.addNode();
})
.placeNode(function(nodeUI, pos){
// Shift image to let links go to the center:
nodeUI.attr('x', pos.x - 12).attr('y', pos.y - 12);
});
var renderer = Viva.Graph.View.renderer(graph,
{
graphics : graphics
});
renderer.run();
}
</script>
<style type='text/css'>
.node {
background-color: #00a2e8;
width: 10px;
height: 10px;
position: absolute;
}
.link {
background-color: #999;
position: absolute;
}
#graph1{
position: absolute;
vertical-align:middle;
width: 100%;
height: 100%;
}
#graph1 > svg {
width: 100%;
height: 100%;
}
</style>
</head>
<body onload='onLoad()' style='width:100%; height: 100%; position : absolute'>
<div style='width:100%; height:100%; position:absolute;'>
<div id='graph1' ></div>
</div>
<div>
<div class="contents-open" id="pl">
</div>
<div class="contents" id="ed">
</div>
<div class="contents" id="os">
</div>
</div>
</body>
</html>