- Timestamp:
- 08/27/13 13:26:06 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
SMC/trunk/SMC/src/web/scripts/js/smc-graph.js
r3478 r3479 31 31 var userdocs_file = "userdocs.html"; 32 32 */ 33 var source_file = "/smc/smc-graph.d3"; 33 //now graph-param is used 34 //var source_file = "/smc/smc-graph.d3"; 34 35 /*var source_file = "/smc/cmd-dep-graph.d3.js";*/ 35 36 var detail_file = "smc_stats_detail.html"; 36 37 var userdocs_file = "userdocs.html"; 37 38 38 var opts = {"depth-before": {"value":2, "min":0, "max":10, "widget":"slider"}, 39 var opts = {"graph": {"value":"/smc/data/smc-graph-basic.js", 40 "values":[{value: "/smc/data/smc-graph-basic.js", label:"SMC graph basic"}, 41 {value: "/smc/data/smc-graph-all.js", label:"SMC graph all"}, 42 {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"} 44 /*, 45 {value: "/smc/data/smc-graph-mdrepo-stats.js", label:"instance data"}*/ 46 47 ], "widget":"selectone" }, 48 "depth-before": {"value":2, "min":0, "max":10, "widget":"slider"}, 39 49 "depth-after":{"value":2, "min":0, "max":10, "widget":"slider"}, 40 50 "link-distance": {"value":120, "min":10, "max":300, "widget":"slider" }, … … 64 74 * @function 65 75 */ 66 function initGraph ( )76 function initGraph (graph_source) 67 77 { 68 78 69 79 // load data 70 d3.json( source_file,80 d3.json(graph_source, 71 81 function(json) { 72 82 // return if data missing 73 if (json==null) { notifyUser("source data missing: " + source_file ); return null}83 if (json==null) { notifyUser("source data missing: " + graph_source ); return null} 74 84 data_all = json; 75 85 data_all.links.forEach(function(d) { … … 163 173 var group_divs = target_container.selectAll("div.node-detail").data(nest) 164 174 .enter().append("div") 165 .attr("id", function (d) { return "detail-" + d.key }) 166 .classed("node-detail cmds-ui-block init-show", 1); 175 .attr("id", function (d) { return "detail-" + d.key }) 176 .classed("node-detail cmds-ui-block", 1) 177 // collapse groups in index, but expand right away in detail view 178 .classed("init-show", (target_container_selector != index_container_selector)); 167 179 168 180 var group_headers = group_divs.append("div").classed("header", 1) … … 184 196 if (target_container_selector == index_container_selector) { 185 197 index_container = target_container; 186 item_li.attr("id", function (d) { return "n-" + d.name }); 198 item_li.attr("id", function (d) { return "n-" + d.name }) 199 .attr("title", function(d) { return d.id }); 187 200 item_li.classed("highlight", function (d) { return d.selected }); 188 201 /* item_li.classed("highlight", liveSelected);*/ … … 244 257 // setting defaults 245 258 // for now, ignore the params, as they are always the same 259 246 260 //data = typeof data !== 'undefined' ? data : dataToShow(nodes_sel); 261 262 if ($(this).is('#input-graph')) { 263 console.log("graph-source changed! reinitializing graph"); 264 initGraph(data); 265 } 266 247 267 data = dataToShow(nodes_sel); 248 target_container = graph_container ; 268 269 target_container = graph_container ; 249 270 250 271 if (data == null) { … … 527 548 528 549 // loading css to store in extra variable, for later use = injecting into exported SVG 529 $.get("scripts/style/ cmd-dep-graph.css", function(data) {550 $.get("scripts/style/smc-graph.css", function(data) { 530 551 // console.log(data) 531 552 css = data
Note: See TracChangeset
for help on using the changeset viewer.