-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo7.html
75 lines (71 loc) · 2.15 KB
/
demo7.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>MetricFlow</title>
<style>
</style>
<script src="../src/components/metricflow-1.2.0.min.js"></script>
<script>
window.onload = function () {
let options = {
'link-width-offset':-1,
'link-color':"lightblue"
};
let metricFlow = MetricFlow("graph",options)
/*定义节点数据*/
let node1Data= {
"x":20,
"y":200,
"id":"node1",
"title":{'name':"节点1"}
};
let node2Data= {
"x":300,
"y":50,
"id":"node2",
"from":"node1",
"title":{'name':"节点2"}
};
let node3Data= {
"x":300,
"y":300,
"id":"node3",
"from":"node1",
"title":{'name':"节点3"}
};
let node4Data= {
"x":500,
"y":200,
"id":"node4",
"from":['node2','node3'],
"title":{'name':"节点3"},
"data":[
{'name':"1.xxxx"},
{'name':"2.xxxx"},
]
};
let nodes = [node1Data,node2Data,node3Data,node4Data];
metricFlow.createNodes(nodes,f);
}
function f(data) {
data['style'] = {
'border-width':'3px',//边框厚度 v1.1.3增加
'border-color':'blue',//边框颜色
'title-color':'blue',//标题背景颜色
'title-font-color':'white',//标题字体颜色
'title-font-size':'13px',//标题字体大小
'data-color':'white',//数据背景颜色
'data-font-size':'13px',//数据字体大小
'data-font-color':'black',//数据字体颜色
}
return data
}
</script>
</head>
<body>
<!--定义一个画布 graph -->
<div id="graph" height="700px" width="1100px" >
</div>
</body>
</html>