share/views/public/js/rbbt.plots/rbbt.plots.graph.adapters.js in rbbt-rest-1.8.47 vs share/views/public/js/rbbt.plots/rbbt.plots.graph.adapters.js in rbbt-rest-1.8.48

- old
+ new

@@ -136,10 +136,16 @@ rbbt.plots.graph.view_cytoscape = function(graph_model, elem, style, layout, extra){ rbbt.plots.graph.update(graph_model).then(function(updated_model){ var dataset = rbbt.plots.graph.build_cytoscape(updated_model) require_js(['/js/cytoscape/js/src/AC_OETags.js', '/js/cytoscape/js/src/cytoscapeweb.js', '/js/cytoscape'], function(){ + var win = elem.find('.window') + if (win.length == 0){ + win = $('<div>').addClass('window').css('height', '500px') + elem.append(win) + } + if (undefined === win.attr('id')) win.attr('id', 'cytoscape_' + Math.ceil(Math.random() * 100000)) var tool = $(elem).cytoscape_tool({ knowledge_base: 'user', namespace: 'Hsa/feb2014', entities: dataset.nodes, network: dataset, @@ -191,9 +197,20 @@ require_js('/js/controls/save', function(){ cytoscape_save(tool) }) tool.cytoscape_tool('draw'); }) + }) +} + +rbbt.plots.graph.update_cytoscape = function(graph_model, elem){ + rbbt.plots.graph.update(graph_model).then(function(updated_model){ + var dataset = rbbt.plots.graph.build_cytoscape(updated_model) + $(elem).cytoscape_tool({ + entities: dataset.nodes, + network: dataset + }) + $(elem).cytoscape_tool('update_network') }) } rbbt.plots.graph.view_d3js_graph = function(graph_model, elem, node_obj){ rbbt.plots.graph.update(graph_model).then(function(updated_model){