nysol-view 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/mnetpie.rb +556 -0
- metadata +17 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1f52c0ae2b589b1fdeb641bf44c75434da538ff
|
4
|
+
data.tar.gz: 6e11e1a5307b236553ad2ae659abac971d60072c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60751369d0f43b615af2f0c67d0a5f7d099cce2ad04b80a3068a3e21eead4bc67cc7e35998d1f8f55cc0a8a02f93077a9ccc0a5c74dcefc98d6912facb4b5afc
|
7
|
+
data.tar.gz: 4b097a2968ea6c07cec6054858e60360ac322ed253b79f1136cc1638c9be37b608b13212bd16fbfec1663f200c1468ce83f429f41211a728b2152b0435c131c7
|
data/bin/mnetpie.rb
ADDED
@@ -0,0 +1,556 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#encoding:utf-8
|
3
|
+
|
4
|
+
require "rubygems"
|
5
|
+
require "nysol/mcmd"
|
6
|
+
require "nysol/viewjs"
|
7
|
+
|
8
|
+
$cmd = $0.sub(/.*\//,"")
|
9
|
+
|
10
|
+
$version = 1.0
|
11
|
+
$revision = "###VERSION###"
|
12
|
+
|
13
|
+
def help ()
|
14
|
+
|
15
|
+
STDERR.puts <<EOF
|
16
|
+
------------------------
|
17
|
+
#{$cmd} version #{$version}
|
18
|
+
------------------------
|
19
|
+
概要) Nodeデータ&EdgeファイルからグラフD3を使ったHTMLを作成する
|
20
|
+
|
21
|
+
書式) #{$cmd} ni= ei= ef= nf= [nodeSizeFld=] [nodeColorFld=] [edgeWidthFld=] [edgeColorFld=] pieDataFld= pieTipsFld= picFld= o= -undirect
|
22
|
+
|
23
|
+
circle pieChart 画像 をNodeとして利用可能
|
24
|
+
|
25
|
+
EOF
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
def ver()
|
30
|
+
$revision ="0" if $revision =~ /VERSION/
|
31
|
+
STDERR.puts "version #{$version} revision #{$revision}"
|
32
|
+
exit
|
33
|
+
end
|
34
|
+
|
35
|
+
help() if ARGV.size <= 0 or ARGV[0]=="--help"
|
36
|
+
ver() if ARGV[0]=="--version"
|
37
|
+
|
38
|
+
paralist=[
|
39
|
+
"ei=","ni=","ef=","nf=","o=",
|
40
|
+
"nodeSizeFld=","pieDataFld=","pieTipsFld=",
|
41
|
+
"nodeTipsFld=","picFld=","nodeColorFld=",
|
42
|
+
"edgeWidthFld=","edgeColorFld=",
|
43
|
+
"--help","-undirect","-offline"
|
44
|
+
]
|
45
|
+
nparalist=[
|
46
|
+
"ei=","ni=","ef=","nf="
|
47
|
+
]
|
48
|
+
|
49
|
+
args=MCMD::Margs.new(ARGV, paralist.join(","),nparalist.join(',') )
|
50
|
+
|
51
|
+
# mcmdのメッセージは警告とエラーのみ
|
52
|
+
ENV["KG_VerboseLevel"]="2" unless args.bool("-mcmdenv")
|
53
|
+
|
54
|
+
|
55
|
+
# ni nf nodeSizeFld= pieDataFld= pieTipsFld=,nodeTipsFld= picFld=
|
56
|
+
# ei ef edgeWidthFld=,
|
57
|
+
|
58
|
+
# EDGE Para
|
59
|
+
ei = args. file("ei=","r")
|
60
|
+
ef = args.field("ef=", ei) # ef1=ef["names"][0] ef2=ef["names"][1]
|
61
|
+
if ef["names"].size() != 2 then
|
62
|
+
raise "ef= takes just two field names"
|
63
|
+
end
|
64
|
+
edgeWidthFld = args.field("edgeWidthFld=" , ei) #eszf
|
65
|
+
edgeColorFld = args.field("edgeColorFld=" , ei)
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
# Node Para
|
70
|
+
ni = args. file("ni=","r")
|
71
|
+
nf = args.field("nf=", ni) # nf1=nf["names"][0]
|
72
|
+
if nf["names"].size() != 1 then
|
73
|
+
raise "nf= takes just one field name"
|
74
|
+
end
|
75
|
+
|
76
|
+
pieDataFld = args.field("pieDataFld=", ni)
|
77
|
+
pieTipsFld = args.field("pieTipsFld=", ni)
|
78
|
+
picFld = args.field("picFld=", ni)
|
79
|
+
|
80
|
+
unless ( ( pieDataFld == nil && pieTipsFld == nil ) || ( pieDataFld != nil && pieTipsFld != nil ) ) then
|
81
|
+
raise "pieDataFld= pieTipsFld= are necessary at the same time"
|
82
|
+
end
|
83
|
+
|
84
|
+
if picFld != nil && pieDataFld !=nil then
|
85
|
+
raise "picFld= cannot be specified with pieDataFld= pieTipsFld="
|
86
|
+
end
|
87
|
+
|
88
|
+
nodeSizeFld = args.field("nodeSizeFld=", ni)
|
89
|
+
nodeTipFld = args.field("nodeTipsFld=", ni)
|
90
|
+
|
91
|
+
#circleの時のみ使える
|
92
|
+
nodeColorFld = args.field("nodeColorFld=", ni)
|
93
|
+
|
94
|
+
if nodeColorFld != nil then
|
95
|
+
|
96
|
+
if picFld != nil || pieDataFld !=nil || pieTipsFld !=nil then
|
97
|
+
raise "nodeColorFld= cannot be specified with pieDataFld= pieTipsFld= picFld="
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
undirect=args.bool("-undirect")
|
102
|
+
localFlg=args.bool("-offline")
|
103
|
+
|
104
|
+
oFile = args.file("o=", "w")
|
105
|
+
|
106
|
+
caseNo = 0
|
107
|
+
if pieDataFld != nil && pieTipsFld != nil then
|
108
|
+
caseNo = 1
|
109
|
+
elsif picFld != nil then
|
110
|
+
caseNo = 2
|
111
|
+
end
|
112
|
+
|
113
|
+
# caseNo 0:circle 1:piechart 2:画像
|
114
|
+
|
115
|
+
wf=MCMD::Mtemp.new
|
116
|
+
nftmp = wf.file()
|
117
|
+
nftmp1 = wf.file()
|
118
|
+
eftmp = wf.file()
|
119
|
+
efctmp = wf.file()
|
120
|
+
efxtmp = wf.file()
|
121
|
+
|
122
|
+
nodefld =[]
|
123
|
+
nodedmy1 = []
|
124
|
+
nodedmy2 = []
|
125
|
+
|
126
|
+
nodefld << "#{nf["names"][0]}:node"
|
127
|
+
|
128
|
+
if nodeSizeFld != nil then
|
129
|
+
nodefld << "#{nodeSizeFld['names'][0]}:nodesize"
|
130
|
+
else
|
131
|
+
nodedmy1 << "nodesize"
|
132
|
+
nodedmy2 << "50"
|
133
|
+
end
|
134
|
+
|
135
|
+
if nodeTipFld != nil then
|
136
|
+
nodefld << "#{nodeTipFld['names'][0]}:nodeT"
|
137
|
+
else
|
138
|
+
nodedmy1 << "nodeT"
|
139
|
+
nodedmy2 << ""
|
140
|
+
end
|
141
|
+
|
142
|
+
if nodeColorFld != nil then
|
143
|
+
nodefld << "#{nodeColorFld['names'][0]}:nodeClr"
|
144
|
+
else
|
145
|
+
nodedmy1 << "nodeClr"
|
146
|
+
nodedmy2 << "skyblue"
|
147
|
+
end
|
148
|
+
|
149
|
+
|
150
|
+
if caseNo == 1 then
|
151
|
+
nodefld << "#{pieDataFld['names'][0]}:pieD"
|
152
|
+
nodefld << "#{pieTipsFld['names'][0]}:pieT"
|
153
|
+
|
154
|
+
elsif caseNo == 2 then
|
155
|
+
nodefld << "#{picFld['names'][0]}:pic"
|
156
|
+
end
|
157
|
+
|
158
|
+
|
159
|
+
f = ""
|
160
|
+
f << "mcut i=#{ni} f=#{nodefld.join(',')} |"
|
161
|
+
if nodedmy1.size() != 0 then
|
162
|
+
f << "msetstr a=#{nodedmy1.join(',')} v=#{nodedmy2.join(',')} |"
|
163
|
+
end
|
164
|
+
|
165
|
+
|
166
|
+
if caseNo == 1 then
|
167
|
+
|
168
|
+
f << "mshare k=node f=pieD:pieDS |"
|
169
|
+
f << "mnumber k=node a=nodeid -B o=#{nftmp1}"
|
170
|
+
system(f)
|
171
|
+
|
172
|
+
# make Pie TIPS GROUP
|
173
|
+
f = ""
|
174
|
+
f << "muniq k=pieT i=#{nftmp1} |"
|
175
|
+
f << "mnumber -q a=pieTno |"
|
176
|
+
f << "mjoin k=pieT f=pieTno i=#{nftmp1} |"
|
177
|
+
f << "msortf f=nodeid%n,pieTno%n o=#{nftmp} "
|
178
|
+
system(f)
|
179
|
+
|
180
|
+
else
|
181
|
+
|
182
|
+
f << "mnumber a=nodeid%n -q o=#{nftmp}"
|
183
|
+
system(f)
|
184
|
+
|
185
|
+
end
|
186
|
+
|
187
|
+
# MAKE EDGE DATA
|
188
|
+
edgefld = []
|
189
|
+
edgedmy1 = []
|
190
|
+
edgedmy2 = []
|
191
|
+
|
192
|
+
edgefld << "#{ef['names'][0]}:edgeS"
|
193
|
+
edgefld << "#{ef['names'][1]}:edgeE"
|
194
|
+
|
195
|
+
if edgeWidthFld != nil then
|
196
|
+
edgefld << "#{edgeWidthFld['names'][0]}:edgesize"
|
197
|
+
else
|
198
|
+
edgedmy1 << "edgesize"
|
199
|
+
edgedmy2 << "1"
|
200
|
+
end
|
201
|
+
|
202
|
+
if edgeColorFld != nil then
|
203
|
+
edgefld << "#{edgeColorFld['names'][0]}:edgecolor"
|
204
|
+
else
|
205
|
+
edgedmy1 << "edgecolor"
|
206
|
+
edgedmy2 << "black"
|
207
|
+
end
|
208
|
+
|
209
|
+
f = ""
|
210
|
+
f << "mcut i=#{ei} f=#{edgefld.join(',')} |"
|
211
|
+
if edgedmy1.size() != 0 then
|
212
|
+
f << "msetstr a=#{edgedmy1.join(',')} v=#{edgedmy2.join(',')} |"
|
213
|
+
end
|
214
|
+
|
215
|
+
f << "mnumber a=preNo -q |"
|
216
|
+
f << "mbest k=edgeS,edgeE s=preNo%nr |"
|
217
|
+
f << "mnumber s=preNo%n a=edgeID |"
|
218
|
+
f << "mjoin k=edgeS K=node f=nodeid:edgeSid m=#{nftmp} |"
|
219
|
+
f << "mjoin k=edgeE K=node f=nodeid:edgeEid m=#{nftmp} o=#{eftmp}"
|
220
|
+
system(f)
|
221
|
+
|
222
|
+
|
223
|
+
#双方向チェック一応
|
224
|
+
f =""
|
225
|
+
f << "mfsort i=#{eftmp} f=edgeS,edgeE |"
|
226
|
+
f << "mcount k=edgeS,edgeE a=edgecnt |"
|
227
|
+
f << "mselnum c=[2,] f=edgecnt |"
|
228
|
+
f << "msetstr a=biflg v=1 o=#{efctmp}"
|
229
|
+
system(f)
|
230
|
+
|
231
|
+
|
232
|
+
f=""
|
233
|
+
f << "mjoin k=edgeID f=biflg m=#{efctmp} -n i=#{eftmp} | "
|
234
|
+
f << "msortf f=edgeID%n o=#{efxtmp}"
|
235
|
+
system(f)
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
gdata="{\"nodes\":["
|
241
|
+
if caseNo == 1 then
|
242
|
+
MCMD::Mcsvin::new("i=#{nftmp} k=nodeid -q"){|csv|
|
243
|
+
nodedatastk = []
|
244
|
+
nodedatas =""
|
245
|
+
csv.each{|val,top,btm|
|
246
|
+
name = val["node"]
|
247
|
+
r = val["nodesize"]
|
248
|
+
title = val["nodeT"]
|
249
|
+
if top then
|
250
|
+
nodedatas =""
|
251
|
+
nodedatas << "{"
|
252
|
+
nodedatas << "\"name\": \"#{name}\","
|
253
|
+
nodedatas << "\"title\": \"#{title}\","
|
254
|
+
nodedatas << "\"r\": #{r},"
|
255
|
+
nodedatas << "\"node\": ["
|
256
|
+
end
|
257
|
+
|
258
|
+
pieTno = val["pieTno"]
|
259
|
+
pieT = val["pieT"]
|
260
|
+
pieDS = val["pieDS"]
|
261
|
+
nodedatas << "{"
|
262
|
+
nodedatas << "\"group\": #{pieTno},"
|
263
|
+
nodedatas << "\"color\": #{pieDS},"
|
264
|
+
nodedatas << "\"value\": #{pieDS},"
|
265
|
+
nodedatas << "\"title\": \"#{pieT}\""
|
266
|
+
nodedatas << "}"
|
267
|
+
|
268
|
+
if btm then
|
269
|
+
nodedatas << "]"
|
270
|
+
nodedatas << "}"
|
271
|
+
nodedatastk << nodedatas
|
272
|
+
nodedatas =""
|
273
|
+
else
|
274
|
+
nodedatas << ","
|
275
|
+
end
|
276
|
+
}
|
277
|
+
gdata << nodedatastk.join(',')
|
278
|
+
|
279
|
+
}
|
280
|
+
else
|
281
|
+
|
282
|
+
MCMD::Mcsvin::new("i=#{nftmp}"){|csv|
|
283
|
+
|
284
|
+
nodedatastk = []
|
285
|
+
csv.each{|val|
|
286
|
+
name = val["node"]
|
287
|
+
r = val["nodesize"]
|
288
|
+
title = val["nodeT"]
|
289
|
+
pic = val["pic"]
|
290
|
+
nclr = val["nodeClr"]
|
291
|
+
nodedatas =""
|
292
|
+
nodedatas << "{"
|
293
|
+
nodedatas << "\"name\": \"#{name}\","
|
294
|
+
nodedatas << "\"title\": \"#{title}\","
|
295
|
+
nodedatas << "\"pic\": \"#{pic}\","
|
296
|
+
nodedatas << "\"color\": \"#{nclr}\","
|
297
|
+
nodedatas << "\"r\": #{r}"
|
298
|
+
nodedatas << "}"
|
299
|
+
nodedatastk << nodedatas
|
300
|
+
}
|
301
|
+
gdata << nodedatastk.join(',')
|
302
|
+
}
|
303
|
+
|
304
|
+
end
|
305
|
+
|
306
|
+
gdata << "],\"links\": ["
|
307
|
+
|
308
|
+
|
309
|
+
MCMD::Mcsvin::new("i=#{efxtmp}"){|csv|
|
310
|
+
edgedatastk = []
|
311
|
+
csv.each{|val|
|
312
|
+
es = val["edgeSid"]
|
313
|
+
et = val["edgeEid"]
|
314
|
+
esize = val["edgesize"]
|
315
|
+
ecolor = val["edgecolor"]
|
316
|
+
edgedatas = ""
|
317
|
+
edgedatas << "{"
|
318
|
+
edgedatas << "\"source\": #{es},"
|
319
|
+
edgedatas << "\"target\": #{et},"
|
320
|
+
edgedatas << "\"length\": 500,"
|
321
|
+
edgedatas << "\"ewidth\": #{esize},"
|
322
|
+
edgedatas << "\"color\": \"#{ecolor}\""
|
323
|
+
edgedatas << "}"
|
324
|
+
edgedatastk << edgedatas
|
325
|
+
}
|
326
|
+
gdata << edgedatastk.join(',')
|
327
|
+
}
|
328
|
+
gdata << "]}"
|
329
|
+
|
330
|
+
direct = ".attr('marker-end','url(#arrowhead)')"
|
331
|
+
if undirect then
|
332
|
+
direct = ""
|
333
|
+
end
|
334
|
+
|
335
|
+
nodeTemplate =<<NodeNormal
|
336
|
+
node
|
337
|
+
.append("circle")
|
338
|
+
.attr("r",function(d){return d.r/4;})
|
339
|
+
.attr("fill", function(d){return d.color;})
|
340
|
+
.append("title")
|
341
|
+
.text(function(d){return d.title;})
|
342
|
+
|
343
|
+
NodeNormal
|
344
|
+
|
345
|
+
nodemakeTemplate =<<NodeMakeNormal
|
346
|
+
for(var i=0 ; i< graph.nodes.length;i++){
|
347
|
+
graph.nodes[i].id = i
|
348
|
+
}
|
349
|
+
NodeMakeNormal
|
350
|
+
|
351
|
+
if pieDataFld != nil then
|
352
|
+
nodeTemplate =<<NodePIe
|
353
|
+
node.selectAll("path")
|
354
|
+
.data( function(d, i){
|
355
|
+
return pie(d.node);
|
356
|
+
})
|
357
|
+
.enter()
|
358
|
+
.append("svg:path")
|
359
|
+
.attr("d", arc)
|
360
|
+
.attr("fill", function(d, i) {
|
361
|
+
return color(d.data.group);
|
362
|
+
})
|
363
|
+
.append("title")
|
364
|
+
.text(function(d){return d.data.title;})
|
365
|
+
|
366
|
+
node.append("circle")
|
367
|
+
.attr("r",function(d){return d.r/4;})
|
368
|
+
.attr({
|
369
|
+
'fill': 'white'
|
370
|
+
})
|
371
|
+
.append("title")
|
372
|
+
.text(function(d){return d.title;});
|
373
|
+
NodePIe
|
374
|
+
|
375
|
+
nodemakeTemplate =<<NodeMakePie
|
376
|
+
for(var i=0 ; i< graph.nodes.length;i++){
|
377
|
+
var r = graph.nodes[i].r
|
378
|
+
for(var j=0 ; j< graph.nodes[i].node.length;j++){
|
379
|
+
graph.nodes[i].node[j]['r'] = r
|
380
|
+
}
|
381
|
+
graph.nodes[i].id = i
|
382
|
+
}
|
383
|
+
NodeMakePie
|
384
|
+
|
385
|
+
elsif picFld !=nil
|
386
|
+
|
387
|
+
nodeTemplate =<<NodePic
|
388
|
+
node
|
389
|
+
.append("image")
|
390
|
+
.attr("height",function(d){return d.r;})
|
391
|
+
.attr("width",function(d){return d.r;})
|
392
|
+
.attr("x",function(d){return -1 * d.r/2; })
|
393
|
+
.attr("y",function(d){return -1 * d.r/2; })
|
394
|
+
.attr("xlink:href",function(d){return d.pic; })
|
395
|
+
.append("title")
|
396
|
+
.text(function(d){return d.title;})
|
397
|
+
NodePic
|
398
|
+
|
399
|
+
|
400
|
+
end
|
401
|
+
|
402
|
+
|
403
|
+
d3js_str="<script type='text/javascript' src='http://d3js.org/d3.v3.min.js'></script>"
|
404
|
+
|
405
|
+
if localFlg then
|
406
|
+
d3js_str = "<script> " + ViewJs::d3jsMin() + "</script>"
|
407
|
+
end
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
outTemplate =<<OUT
|
413
|
+
<!DOCTYPE html>
|
414
|
+
<html lang="en">
|
415
|
+
<head>
|
416
|
+
<meta charset="utf-8">
|
417
|
+
#{d3js_str}
|
418
|
+
<style>
|
419
|
+
|
420
|
+
</style>
|
421
|
+
</head>
|
422
|
+
<body>
|
423
|
+
|
424
|
+
<script type="text/javascript">
|
425
|
+
|
426
|
+
var graph = #{gdata} ;
|
427
|
+
|
428
|
+
|
429
|
+
var width = 4000,
|
430
|
+
height = 3000;
|
431
|
+
|
432
|
+
var color = d3.scale.category10();
|
433
|
+
|
434
|
+
#{nodemakeTemplate}
|
435
|
+
|
436
|
+
for(var i=0 ; i< graph.links.length;i++){
|
437
|
+
graph.links[i].id = i
|
438
|
+
}
|
439
|
+
|
440
|
+
var pie = d3.layout.pie()
|
441
|
+
.sort(null)
|
442
|
+
.value(function(d) { return d.value; });
|
443
|
+
|
444
|
+
var arc = d3.svg.arc()
|
445
|
+
.outerRadius( function(d){ return d.data.r ; })
|
446
|
+
.innerRadius( function(d){ return d.data.r/2 ; } );
|
447
|
+
|
448
|
+
var svg = d3.select("body").append("svg")
|
449
|
+
.attr("width", width)
|
450
|
+
.attr("height", height);
|
451
|
+
|
452
|
+
d3.select("svg").append('defs').append('marker')
|
453
|
+
.attr({'id':'arrowhead',
|
454
|
+
'viewBox':'-0 -5 10 10',
|
455
|
+
'refX':30,
|
456
|
+
'refY':0,
|
457
|
+
'orient':'auto-start-reverse',
|
458
|
+
'markerWidth':5,
|
459
|
+
'markerHeight':5,
|
460
|
+
'xoverflow':'visible'})
|
461
|
+
.append('path')
|
462
|
+
.attr('d', 'M 0,-5 L 10 ,0 L 0,5')
|
463
|
+
.attr('fill', '#999')
|
464
|
+
.style('stroke','none');
|
465
|
+
|
466
|
+
var g = svg.append("g");
|
467
|
+
var node = g.selectAll(".node");
|
468
|
+
var link = g.selectAll(".link");
|
469
|
+
nodes = graph.nodes
|
470
|
+
links = graph.links
|
471
|
+
|
472
|
+
var force =
|
473
|
+
d3.layout.force()
|
474
|
+
.linkDistance(200)
|
475
|
+
.linkStrength(3.5)
|
476
|
+
.charge(-3500)
|
477
|
+
.gravity(0.1)
|
478
|
+
.friction(0.95)
|
479
|
+
.size([width, height])
|
480
|
+
.on("tick", function() {
|
481
|
+
link
|
482
|
+
.attr("x1", function(d) { return d.source.x; })
|
483
|
+
.attr("y1", function(d) { return d.source.y; })
|
484
|
+
.attr("x2", function(d) { return d.target.x; })
|
485
|
+
.attr("y2", function(d) { return d.target.y; });
|
486
|
+
|
487
|
+
node
|
488
|
+
.attr("x", function(d) { return d.x; })
|
489
|
+
.attr("y", function(d) { return d.y; })
|
490
|
+
.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"});
|
491
|
+
});
|
492
|
+
|
493
|
+
|
494
|
+
node = node.data(nodes, function( d ) { return d.id; } );
|
495
|
+
link = link.data(links, function( d ) { return d.id; } );
|
496
|
+
|
497
|
+
|
498
|
+
link
|
499
|
+
.enter()
|
500
|
+
.append("line")
|
501
|
+
.attr("class", "link")
|
502
|
+
.style("stroke", function( d ) { return d.color; } )
|
503
|
+
.style("stroke-width", function( d ) { return d.ewidth; })
|
504
|
+
#{direct}
|
505
|
+
|
506
|
+
|
507
|
+
node
|
508
|
+
.enter()
|
509
|
+
.append("g")
|
510
|
+
.attr("class", "node")
|
511
|
+
.style({})
|
512
|
+
.call(force.drag)
|
513
|
+
.on("contextmenu", function(nd) {
|
514
|
+
d3.event.preventDefault();
|
515
|
+
force.stop()
|
516
|
+
nodes.splice( nd.index, 1 );
|
517
|
+
links = links.filter(function(nl) {
|
518
|
+
return nl.source.index != nd.index && nl.target.index != nd.index;
|
519
|
+
});
|
520
|
+
node = node.data(nodes, function( d ) { return d.id; } );
|
521
|
+
node.exit().remove();
|
522
|
+
link = link.data( links, function( d ) { return d.id; } );
|
523
|
+
link.exit().remove();
|
524
|
+
force.nodes(nodes)
|
525
|
+
.links(links)
|
526
|
+
.start();
|
527
|
+
|
528
|
+
});
|
529
|
+
|
530
|
+
#{nodeTemplate}
|
531
|
+
|
532
|
+
|
533
|
+
node
|
534
|
+
.append("text")
|
535
|
+
.attr("text-anchor", "middle")
|
536
|
+
.style("stroke", "black")
|
537
|
+
.text(function(d) {
|
538
|
+
return d.name;
|
539
|
+
});
|
540
|
+
|
541
|
+
|
542
|
+
force.nodes(nodes)
|
543
|
+
.links(links)
|
544
|
+
.start();
|
545
|
+
|
546
|
+
|
547
|
+
</script>
|
548
|
+
</body>
|
549
|
+
</html>
|
550
|
+
OUT
|
551
|
+
|
552
|
+
File.open(oFile,"w"){|fp|
|
553
|
+
fp.puts outTemplate
|
554
|
+
}
|
555
|
+
|
556
|
+
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nysol-view
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NYSOL
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nysol
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 3.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.11'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.11'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '10.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
55
|
description: "\t nysol VIEW tools\n"
|
@@ -62,19 +62,21 @@ executables:
|
|
62
62
|
- msankey.rb
|
63
63
|
- mbar.rb
|
64
64
|
- mpie.rb
|
65
|
+
- mnetpie.rb
|
65
66
|
- mdtree.rb
|
66
67
|
extensions: []
|
67
68
|
extra_rdoc_files: []
|
68
69
|
files:
|
69
|
-
-
|
70
|
+
- bin/m2gv.rb
|
71
|
+
- bin/mautocolor.rb
|
70
72
|
- bin/mbar.rb
|
71
73
|
- bin/mdtree.rb
|
72
74
|
- bin/mgv.rb
|
73
|
-
- bin/m2gv.rb
|
74
|
-
- bin/mautocolor.rb
|
75
75
|
- bin/mnest2tree.rb
|
76
|
-
- bin/
|
76
|
+
- bin/mnetpie.rb
|
77
77
|
- bin/mpie.rb
|
78
|
+
- bin/msankey.rb
|
79
|
+
- lib/nysol/viewjs.rb
|
78
80
|
homepage: http://www.nysol.jp/
|
79
81
|
licenses: []
|
80
82
|
metadata: {}
|
@@ -84,17 +86,17 @@ require_paths:
|
|
84
86
|
- lib
|
85
87
|
required_ruby_version: !ruby/object:Gem::Requirement
|
86
88
|
requirements:
|
87
|
-
- -
|
89
|
+
- - ">="
|
88
90
|
- !ruby/object:Gem::Version
|
89
91
|
version: '0'
|
90
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
93
|
requirements:
|
92
|
-
- -
|
94
|
+
- - ">="
|
93
95
|
- !ruby/object:Gem::Version
|
94
96
|
version: '0'
|
95
97
|
requirements: []
|
96
98
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.
|
99
|
+
rubygems_version: 2.5.2.3
|
98
100
|
signing_key:
|
99
101
|
specification_version: 4
|
100
102
|
summary: nysol VIEW tools
|