-
Notifications
You must be signed in to change notification settings - Fork 8
/
index-x.html
166 lines (164 loc) · 3.54 KB
/
index-x.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>drawTopology 拓扑图插件</title>
<link rel="stylesheet" type="text/css" href="css/drawTopology.css">
<script type="text/javascript" src="js/drawTopology.js"></script>
</head>
<body>
<div id="canvasbox" class="canvasbox" style="width: 100%; min-height: 800px; height: 100%;"></div>
</body>
</html>
<script type="text/javascript">
var Stage = new drawTop.Stage({
id:'canvasbox',
Menu:{
btn:{
line:[{
name:'删除直线',
className:'No_line',
click:function(e){
e.Stage.clear(e.triggerDrawNode);
}
}],
rect:[{
name:'删除标签',
className:'No_node',
click:function(e){
e.Stage.clear(e.triggerDrawNode);
}
},{
name:'查看详情',
className:'showInfo',
dataKay:'k',
click:function(e){
console.log(e);
}
}],
rhombus:[{
name:'删除标签',
className:'No_node',
click:function(e){
e.Stage.clear(e.triggerDrawNode);
}
},{
name:'查看详情',
className:'showInfo',
dataKay:'k',
click:function(e){
console.log(e);
}
}],
}
},
doLink:{
doLinkJudge:function(e){
console.log(e);
return true;
}
}
});
var node_arr = [];
var color=["#f9be00","#7ab51d","#9e0382","#0087ea","#01b2e4","#64e571","#d9d60b","#55198a","#942128","#90495a"];
for (var i = 0; i < 800; i++) {
var node_s = new drawTop.Node('Node'+i,{strokeStyle:color[i%10],id:i,fillStyle:color[i%10],centerTextColor:'#fff',width:60,
});
// node_s.setLocation(62*i,30*i);
node_s.setLocation(Math.random()*600,Math.random()*500);
node_arr.push(node_s);
}
for (var j = 0; j < 600; j++) {
var node_s = new drawTop.Link(node_arr[j],node_arr[j+1],{lineStrokeStyle:color[j%10],
arrows:{
show:true,
}
});
node_arr.push(node_s);
}
Stage.add(node_arr);
var node=new drawTop.Node({
centerText:'且',
text:' ',
width:120,
radius:{
p1:14,
p2:14,
p3:14,
p4:14
},
type:'rhombus',
height:28,
LinePoint:{
place:{
top:[{
id:1025,
},{
id:1035,
},{
id:1045,
},{
id:1055,
}],
bottom:[{
id:1035,
},{
id:1045,
}],
},
PointTo:{
bottom:{
direction:'top',
way:{
1025:1025,
1035:1045,
1045:1035
}
},
right:'bottom',
left:'right',
top:'top'
},
link:{
arrows:{
show:false,
}
}
}
});
// var node3=new drawTop.Node();
var node2=new drawTop.Node({
centerText:'或',
x:200,
y:100,
text:' ',
width:60,
height:30,
LinePoint:{
place:{
bottom:[{
id:1035,
},{
id:1045,
}],
},
RLinkPoint:{
top:[{
id:1025,
},{
id:1035,
},{
id:1045,
}],
}
}
});
node2.addEvent('dblclick',function(e){
console.log(e);
});
Stage.add([node,node2]);//node3
// Stage.add(node2);
var data=Stage.getNodeData();
</script>