- Timestamp:
- 09/27/13 13:21:14 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
SMC/trunk/SMC/src/web/scripts/js/smc-graph.js
r3479 r3628 17 17 var min_circle = 4; 18 18 var max_circle = 50; 19 20 var show_count = 1; 21 19 22 var comp_reg_url = "http://catalog.clarin.eu/ds/ComponentRegistry/?item="; 20 23 var mdrepo_url_search = "http://localhost:8680/exist/apps/cr-xq/mdrepo/index.html?operation=searchRetrieve&x-context=&query="; … … 41 44 {value: "/smc/data/smc-graph-all.js", label:"SMC graph all"}, 42 45 {value: "/smc/data/smc-graph-profiles-datcats.js", label:"only profiles + datcats"}, 43 {value: "/smc/data/smc-graph-groups-profiles-datcats-rr ", label:"profile groups + profiles + datcats + relations"}46 {value: "/smc/data/smc-graph-groups-profiles-datcats-rr.js", label:"profiles+datcats+groups+rr"} 44 47 /*, 45 48 {value: "/smc/data/smc-graph-mdrepo-stats.js", label:"instance data"}*/ … … 188 191 .attr("class", "node-item"); 189 192 item_li.append("span") 190 .text(function (d) { return d.name + ' |' + d.count + '|' }) 193 /* .text(function (d) { return d.name})*/ 194 .text(renderItemText) 191 195 .on("click", function(d) { d.selected= d.selected ? 0 : 1 ; updateSelected() }); 192 196 … … 218 222 219 223 /* profile_item_detail.append("a")*/ 220 item_detail.append("a")224 /* item_detail.append("a") 221 225 .classed("scan", function (d) { return !(d.type=='Profile') } ) 222 226 .attr("target",'_blank') 223 227 .attr("href",function (d) { if (d.type=='Profile') { return mdrepo_url_search + 'cmd.profile=%22' + d.id + '%22'; } 224 228 else { return mdrepo_url_scan + 'cmd:' + d.name; } } ) 225 .text(' mdrepo-view '); 229 .text(' mdrepo-view ');*/ 226 230 227 231 item_detail_detail = item_detail.append("div").html( … … 243 247 } 244 248 249 function renderItemText(d) { 250 if (show_count) { 251 return d.name + ' |' + d.count + '|'; 252 } 253 else { 254 return d.name; 255 } 256 } 257 245 258 function filterIndex (search_string){ 246 259 var filtered_index_nodes = data_all.nodes.filter(function(d, i) { … … 276 289 } 277 290 291 // compute the maximum number, but only if it will be needed (i.e. node-size=usage) 292 if (opt("node-size")=="usage") { 293 var init_count = []; 294 data.nodes.forEach(function(d,i){init_count.push(+d.count);}) 295 data.count_max = d3.max(init_count); 296 data.node_size_ratio = Math.sqrt(data.count_max) / max_circle; 297 } 298 278 299 // information about the displayed data 279 300 notifyUser("show nodes: " + data_show.nodes.length + "; " 280 + "show links: " + data_show.links.length); 301 + "show links: " + data_show.links.length + "; " 302 + "max count:" + data.count_max + "; " 303 + "node_size_ration:" + data.node_size_ratio); 281 304 282 305 … … 297 320 .friction(parseInt(opt("friction")) / 100 ) 298 321 .linkDistance(parseInt(opt("link-distance"))) 299 .charge(parseInt(opt("charge")) * -1) 322 //.charge(parseInt(opt("charge")) * -1) 323 .charge(function(d) { if (opt("node-size")=="usage") 324 {var node_charge = (Math.sqrt(d.count)<=min_circle) ? min_circle : Math.sqrt(d.count) / data.node_size_ratio; 325 //console.log (node_charge + ':' + d.count); 326 return node_charge * -1 * parseInt(opt("charge")); 327 } 328 //{ return -d.count * parseInt(opt("charge")); } 329 else { return parseInt(opt("charge")) * -1} }) 300 330 .on("tick", tick) 301 331 .start(); … … 386 416 .on("mouseover", highlight()).on("mouseout", unhighlight()) 387 417 .attr("r", function(d) { if (opt("node-size")=="usage") 388 {return (Math.sqrt(d.count)<=min_circle) ? min_circle : Math.sqrt(d.count) / data _all.node_size_ratio;418 {return (Math.sqrt(d.count)<=min_circle) ? min_circle : Math.sqrt(d.count) / data.node_size_ratio; 389 419 } 390 420 else { return node_size_int; } … … 392 422 393 423 gnodes.append("title") 394 .text(function (d) { return d.name + ' |' + d.count + '|' }) 395 /* .text(function(d) { return d.name; });*/ 424 /* .text(function (d) { return d.name + ' |' + d.count + '|' })*/ 425 .text(renderItemText); 396 426 397 427
Note: See TracChangeset
for help on using the changeset viewer.