share/views/public/js/rbbt.plots/rbbt.plots.graph.adapters.js in rbbt-rest-1.8.138 vs share/views/public/js/rbbt.plots/rbbt.plots.graph.adapters.js in rbbt-rest-1.8.139
- old
+ new
@@ -64,10 +64,11 @@
var edges = []
forArray(model.edges, function(edge){
var clean = clean_hash(edge)
if (undefined === clean.id) clean.id = clean.code
+ clean.id = clean.code + "@" + clean.database
edges.push({data: clean})
})
var cy_model = {}
cy_model.elements = {nodes: nodes, edges: edges}
@@ -99,10 +100,14 @@
selector: 'node[shape]',
style: { 'shape': 'data(shape)' }
},
{
+ selector: 'edge',
+ style: { 'curve-style': 'bezier'}
+ },
+ {
selector: 'edge[color]',
style: { 'line-color': 'data(color)',
'target-arrow-color': 'data(color)'}
},
{
@@ -111,22 +116,39 @@
},
{
selector: 'edge[width]',
style: { 'width': 'data(width)'}
},
- {
- selector: 'edge[target-arrow-shape]',
- style: { 'target-arrow-shape': 'data(target-arrow-shape)'}
- },
- {
- selector: 'edge[target-arrow-color]',
- style: { 'target-arrow-color': 'data(target-arrow-color)'}
- }
+ //{
+ // selector: 'edge[target-arrow-shape]',
+ // style: { 'target-arrow-shape': 'data(target-arrow-shape)'}
+ //},
+ //{
+ // selector: 'edge[target-arrow-color]',
+ // style: { 'target-arrow-color': 'data(target-arrow-color)'}
+ //}
]
- var default_layout = { name: 'cose' }
+ var default_layout = {
+ name: 'cose',
+ idealEdgeLength: 100,
+ nodeOverlap: 20,
+ refresh: 20,
+ fit: true,
+ padding: 30,
+ randomize: false,
+ componentSpacing: 100,
+ nodeRepulsion: 400000,
+ edgeElasticity: 100,
+ nestingFactor: 5,
+ gravity: 80,
+ numIter: 1000,
+ initialTemp: 200,
+ coolingFactor: 0.95,
+ minTemp: 1.0
+ }
if (undefined === style) style = default_style
if (undefined === layout) layout = default_layout
var deferred = m.deferred()
@@ -137,19 +159,20 @@
require_js(['/plugins/cytoscapejs/cytoscape.js'], function(){
var cy_params = {
container: elem,
elements: cy_model.elements,
style: style,
+ layout: layout,
}
if (undefined !== extra) forHash(extra, function(k,v){ cy_params[k,v] })
var cy = cytoscape(cy_params)
cy.layout(layout)
- cy.one('layoutready', function(){
+ cy.one('layoutstop', function(){
deferred.resolve(this)
})
})
}, rbbt.exception.report)
@@ -236,10 +259,9 @@
})
}
rbbt.plots.graph.view_d3js_graph = function(graph_model, elem, node_obj){
rbbt.plots.graph.update(graph_model).then(function(updated_model){
- console.log(updated_model)
var dataset = rbbt.plots.graph.build_d3(updated_model)
if (undefined === node_obj){
node_obj = function(node){
var g = node.append('g').attr('class', function(d){ if(undefined === d.shape) d.shape = 'circle'; return "node " + d.shape})