- Timestamp:
- 09/27/13 13:23:39 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
SMC/trunk/SMC/src/web/scripts/js/smc-graph.js
r3628 r3629 16 16 var first_level_margin = 20; 17 17 var min_circle = 4; 18 var max_circle = 50;18 var max_circle = 80; 19 19 20 20 var show_count = 1; 21 var show_arrows = 0; 21 22 22 23 var comp_reg_url = "http://catalog.clarin.eu/ds/ComponentRegistry/?item="; … … 40 41 var userdocs_file = "userdocs.html"; 41 42 42 var opts = {"graph": {"value":"/smc/data/ smc-graph-basic.js",43 var opts = {"graph": {"value":"/smc/data/profiles.js", 43 44 "values":[{value: "/smc/data/smc-graph-basic.js", label:"SMC graph basic"}, 44 45 {value: "/smc/data/smc-graph-all.js", label:"SMC graph all"}, 45 46 {value: "/smc/data/smc-graph-profiles-datcats.js", label:"only profiles + datcats"}, 46 {value: "/smc/data/smc-graph-groups-profiles-datcats-rr.js", label:"profiles+datcats+groups+rr"} 47 {value: "/smc/data/smc-graph-groups-profiles-datcats-rr.js", label:"profiles+datcats+groups+rr"}, 48 {value: "/smc/data/profiles.js", label:"just profiles"} 49 47 50 /*, 48 51 {value: "/smc/data/smc-graph-mdrepo-stats.js", label:"instance data"}*/ … … 54 57 "charge":{"value":250, "min":10, "max":1000, "widget":"slider" }, 55 58 "friction":{"value":75, "min":1, "max":100, "widget":"slider" }, 56 "node-size": {"value":" 4", "values":["1","4","8","16","usage"], "widget":"selectone" },59 "node-size": {"value":"count", "values":["1","4","8","16","count"], "widget":"selectone" }, 57 60 "labels": {"value":"show", "values":["show","hide"], "widget":"selectone" }, 58 61 "curve": {"value":"straight", "values":["straight","arc"], "widget":"selectone" }, 59 "layout": {"value":" horizontal-tree", "values":["vertical-tree", "horizontal-tree", "weak-tree","force","dot", "freeze"], "widget":"selectone" },62 "layout": {"value":"force", "values":["vertical-tree", "horizontal-tree", "weak-tree","force","dot", "freeze"], "widget":"selectone" }, 60 63 "selected": {"widget":"hidden" }, 61 64 "link": {"widget":"link", "label":""}, … … 289 292 } 290 293 291 // compute the maximum number, but only if it will be needed (i.e. node-size= usage)292 if (opt("node-size")==" usage") {294 // compute the maximum number, but only if it will be needed (i.e. node-size=count) 295 if (opt("node-size")=="count") { 293 296 var init_count = []; 294 297 data.nodes.forEach(function(d,i){init_count.push(+d.count);}) … … 311 314 var ratio = w / (data_all.init_x_max - data_all.init_x_min); 312 315 var node_size_int = parseInt(opt("node-size")); 313 316 var link_distance = parseInt(opt("link-distance")) 317 314 318 // console.log (w + '-' + h); 315 319 var force = d3.layout.force() … … 317 321 .links(data.links) 318 322 .size([w, h]) 319 //.gravity(0.3) 323 320 324 .friction(parseInt(opt("friction")) / 100 ) 321 325 .linkDistance(parseInt(opt("link-distance"))) 326 .gravity(0.5) 327 /* Profiles: 328 329 .linkDistance(function(d){return link_distance / (d.weight * d.value) }) 330 .linkStrength(function(d){return d.weight})*/ 322 331 //.charge(parseInt(opt("charge")) * -1) 323 .charge(function(d) { if (opt("node-size")==" usage")332 .charge(function(d) { if (opt("node-size")=="count") 324 333 {var node_charge = (Math.sqrt(d.count)<=min_circle) ? min_circle : Math.sqrt(d.count) / data.node_size_ratio; 325 334 //console.log (node_charge + ':' + d.count); … … 346 355 347 356 // Per-type markers, as they don't inherit styles. 357 if (show_arrows) { 348 358 svg.append("svg:defs").selectAll("marker") 349 359 .data(["uses"]) … … 358 368 .append("svg:path") 359 369 .attr("d", "M0,-3L10,0L0,3"); 370 } 360 371 361 372 var path = svg.append("svg:g").selectAll("path") … … 366 377 .classed("uses", 1) 367 378 .classed("highlight", function(d) { d.highlight } ) 368 .attr("marker-end", function(d) { return "url(#uses)"; }); 369 /* .style("stroke-width", function(d) { return Math.sqrt(d.value); });*/ 370 379 .attr("marker-end", function(d) { return "url(#uses)"; }) 380 .style("stroke-width", function(d) { return Math.sqrt(d.value); }); 381 /* .style("stroke-width", function(d) { return d.value });*/ 382 383 path.append("title").text(function(d){ return d.value }); 371 384 372 385 var gnodes = svg.append("svg:g") … … 415 428 .on("click", function(d) {d.selected= d.selected ? 0 : 1; updateSelected() }) 416 429 .on("mouseover", highlight()).on("mouseout", unhighlight()) 417 .attr("r", function(d) { if (opt("node-size")==" usage")430 .attr("r", function(d) { if (opt("node-size")=="count") 418 431 {return (Math.sqrt(d.count)<=min_circle) ? min_circle : Math.sqrt(d.count) / data.node_size_ratio; 419 432 }
Note: See TracChangeset
for help on using the changeset viewer.