|
@ -501,6 +501,8 @@ Network.prototype.setData = function(data, disableStart) { |
|
|
if (disableStart === undefined) { |
|
|
if (disableStart === undefined) { |
|
|
disableStart = false; |
|
|
disableStart = false; |
|
|
} |
|
|
} |
|
|
|
|
|
// we set initializing to true to ensure that the hierarchical layout is not performed until both nodes and edges are added.
|
|
|
|
|
|
this.initializing = true; |
|
|
|
|
|
|
|
|
if (data && data.dot && (data.nodes || data.edges)) { |
|
|
if (data && data.dot && (data.nodes || data.edges)) { |
|
|
throw new SyntaxError('Data must contain either parameter "dot" or ' + |
|
|
throw new SyntaxError('Data must contain either parameter "dot" or ' + |
|
@ -509,7 +511,6 @@ Network.prototype.setData = function(data, disableStart) { |
|
|
|
|
|
|
|
|
// set options
|
|
|
// set options
|
|
|
this.setOptions(data && data.options); |
|
|
this.setOptions(data && data.options); |
|
|
|
|
|
|
|
|
// set all data
|
|
|
// set all data
|
|
|
if (data && data.dot) { |
|
|
if (data && data.dot) { |
|
|
// parse DOT file
|
|
|
// parse DOT file
|
|
@ -531,15 +532,21 @@ Network.prototype.setData = function(data, disableStart) { |
|
|
this._setNodes(data && data.nodes); |
|
|
this._setNodes(data && data.nodes); |
|
|
this._setEdges(data && data.edges); |
|
|
this._setEdges(data && data.edges); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this._putDataInSector(); |
|
|
this._putDataInSector(); |
|
|
if (!disableStart) { |
|
|
|
|
|
// find a stable position or start animating to a stable position
|
|
|
|
|
|
if (this.constants.stabilize) { |
|
|
|
|
|
this._stabilize(); |
|
|
|
|
|
|
|
|
if (disableStart == false) { |
|
|
|
|
|
if (this.constants.hierarchicalLayout.enabled == true) { |
|
|
|
|
|
this._resetLevels(); |
|
|
|
|
|
this._setupHierarchicalLayout(); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
// find a stable position or start animating to a stable position
|
|
|
|
|
|
if (this.constants.stabilize) { |
|
|
|
|
|
this._stabilize(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
this.start(); |
|
|
this.start(); |
|
|
} |
|
|
} |
|
|
|
|
|
this.initializing = false; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -681,7 +688,6 @@ Network.prototype.setOptions = function (options) { |
|
|
this.setSize(this.constants.width, this.constants.height); |
|
|
this.setSize(this.constants.width, this.constants.height); |
|
|
this.moving = true; |
|
|
this.moving = true; |
|
|
this.start(); |
|
|
this.start(); |
|
|
|
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -1348,6 +1354,7 @@ Network.prototype._addNodes = function(ids) { |
|
|
} |
|
|
} |
|
|
this.moving = true; |
|
|
this.moving = true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this._updateNodeIndexList(); |
|
|
this._updateNodeIndexList(); |
|
|
if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { |
|
|
if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { |
|
|
this._resetLevels(); |
|
|
this._resetLevels(); |
|
@ -1481,15 +1488,14 @@ Network.prototype._addEdges = function (ids) { |
|
|
var data = edgesData.get(id, {"showInternalIds" : true}); |
|
|
var data = edgesData.get(id, {"showInternalIds" : true}); |
|
|
edges[id] = new Edge(data, this, this.constants); |
|
|
edges[id] = new Edge(data, this, this.constants); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.moving = true; |
|
|
this.moving = true; |
|
|
this._updateValueRange(edges); |
|
|
this._updateValueRange(edges); |
|
|
this._createBezierNodes(); |
|
|
this._createBezierNodes(); |
|
|
|
|
|
this._updateCalculationNodes(); |
|
|
if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { |
|
|
if (this.constants.hierarchicalLayout.enabled == true && this.initializing == false) { |
|
|
this._resetLevels(); |
|
|
this._resetLevels(); |
|
|
this._setupHierarchicalLayout(); |
|
|
this._setupHierarchicalLayout(); |
|
|
} |
|
|
} |
|
|
this._updateCalculationNodes(); |
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -2242,7 +2248,7 @@ Network.prototype.focusOnNode = function (nodeId, zoomLevel) { |
|
|
this.redraw(); |
|
|
this.redraw(); |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
console.log("This nodeId cannot be found.") |
|
|
|
|
|
|
|
|
console.log("This nodeId cannot be found."); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|