Defines an abstract class for performing Graph rendering and animation.
| Graph. | Defines an abstract class for performing Graph rendering and animation. |
| Graph.Plot | Generic Graph rendering and animation methods. |
| Functions | |
| getLabelContainer | Lazy fetcher for the label container. |
| getLabel | Lazy fetcher for the label DOM element. |
| hideLabels | Hides all labels (by hiding the label container). |
| clearLabels | Clears the label container. |
| disposeLabel | Removes a label. |
| hideLabel | Hides the corresponding Graph.Node label. |
| sequence | Iteratively performs an action while refreshing the state of the visualization. |
| animate | Animates a Graph by interpolating some Graph.Nodes properties. |
| plot | Plots a Graph. |
| plotLabel | Plots a label for a given node. |
| plotNode | Plots a Graph.Node. |
| plotLine | Plots a line. |
| fitsInCanvas | Returns true or false if the label for the node is contained in the canvas dom element or not. |
Generic Graph rendering and animation methods.
An abstract class for plotting a generic graph structure.
Hypertree.Plot, RGraph.Plot, ST.Plot.
The subclasses for this abstract class can be accessed by using the fx property of the Hypertree, RGraph, or ST instances created.
Hypertree.Plot, RGraph.Plot, ST.Plot, Hypertree, RGraph, ST, Graph.
| Functions | |
| getLabelContainer | Lazy fetcher for the label container. |
| getLabel | Lazy fetcher for the label DOM element. |
| hideLabels | Hides all labels (by hiding the label container). |
| clearLabels | Clears the label container. |
| disposeLabel | Removes a label. |
| hideLabel | Hides the corresponding Graph.Node label. |
| sequence | Iteratively performs an action while refreshing the state of the visualization. |
| animate | Animates a Graph by interpolating some Graph.Nodes properties. |
| plot | Plots a Graph. |
| plotLabel | Plots a label for a given node. |
| plotNode | Plots a Graph.Node. |
| plotLine | Plots a line. |
| fitsInCanvas | Returns true or false if the label for the node is contained in the canvas dom element or not. |
getLabel: function( id )
Lazy fetcher for the label DOM element.
| id | The label id (which is also a Graph.Node id). |
The label DOM element.
var rg = new RGraph(canvas, config); //can be also Hypertree or ST
var label = rg.fx.getLabel('someid');
alert(label.innerHTML);
disposeLabel: function( id )
Removes a label.
| id | A label id (which generally is also a Graph.Node id). |
var rg = new RGraph(canvas, config); //can be also Hypertree or ST
rg.fx.disposeLabel('labelid');
hideLabel: function( node, flag )
Hides the corresponding Graph.Node label.
| node | A Graph.Node. Can also be an array of Graph.Nodes. |
| flag | If true, nodes will be shown. Otherwise nodes will be hidden. |
var rg = new RGraph(canvas, config); //can be also Hypertree or ST
rg.fx.hideLabel(rg.graph.getNode('someid'), false);
sequence: function( options )
Iteratively performs an action while refreshing the state of the visualization.
| options | Some sequence options like |
var rg = new RGraph(canvas, config); //can be also Hypertree or ST
var i = 0;
rg.fx.sequence({
condition: function() {
return i == 10;
},
step: function() {
alert(i++);
},
onComplete: function() {
alert('done!');
}
});
animate: function( opt, versor )
Animates a Graph by interpolating some Graph.Nodes properties.
| opt | Animation options. This object contains as properties |
”linear”, “polar” and “moebius” animation options will interpolate Graph.Nodes “startPos” and “endPos” properties, storing the result in “pos”.
”fade:nodes” and “fade:vertex” animation options will interpolate Graph.Nodes and/or Graph.Adjacence “startAlpha” and “endAlpha” properties, storing the result in “alpha”.
...and other Hypertree, RGraph or ST controller methods.
var rg = new RGraph(canvas, config); //can be also Hypertree or ST
rg.fx.animate({
modes: ['linear'],
hideLabels: false
});
plot: function( opt, animating )
Plots a Graph.
| opt | optional Plotting options. |
var rg = new RGraph(canvas, config); //can be also Hypertree or ST rg.fx.plot();
plotLabel: function( canvas, node, controller )
Plots a label for a given node.
| canvas | A Canvas instance. |
| node | A Graph.Node. |
| controller | A configuration object. See also Hypertree, RGraph, ST. |
plotNode: function( node, canvas, animating )
Plots a Graph.Node.
| node | A Graph.Node. |
| canvas | A Canvas element. |
plotLine: function( adj, canvas, animating )
Plots a line.
| adj | A Graph.Adjacence. |
| canvas | A Canvas instance. |
fitsInCanvas: function( pos, canvas )
Returns true or false if the label for the node is contained in the canvas dom element or not.
| pos | A Complex instance (I’m doing duck typing here so any object with x and y parameters will do). |
| canvas | A Canvas instance. |
A boolean value specifying if the label is contained in the Canvas DOM element or not.
Lazy fetcher for the label container.
getLabelContainer: function()
Lazy fetcher for the label DOM element.
getLabel: function( id )
Hides all labels (by hiding the label container).
hideLabels: function ( hide )
Clears the label container.
clearLabels: function( force )
Removes a label.
disposeLabel: function( id )
Hides the corresponding Graph.Node label.
hideLabel: function( node, flag )
Iteratively performs an action while refreshing the state of the visualization.
sequence: function( options )
Animates a Graph by interpolating some Graph.Nodes properties.
animate: function( opt, versor )
Plots a Graph.
plot: function( opt, animating )
Plots a label for a given node.
plotLabel: function( canvas, node, controller )
Plots a Graph.Node.
plotNode: function( node, canvas, animating )
Plots a line.
plotLine: function( adj, canvas, animating )
Returns true or false if the label for the node is contained in the canvas dom element or not.
fitsInCanvas: function( pos, canvas )