Graph.Label.js

Summary
Graph.Label.js
Graph.LabelAn interface for plotting/hiding/showing labels.
Graph.Label.NativeImplements labels natively, using the Canvas text API.
Functions
plotLabelPlots a label for a given node.
Graph.Label.DOMAbstract Class implementing some DOM label methods.
Functions
getLabelContainerLazy fetcher for the label container.
getLabelLazy fetcher for the label element.
hideLabelsHides all labels (by hiding the label container).
clearLabelsClears the label container.
disposeLabelRemoves a label.
hideLabelHides the corresponding Graph.Node label.
Graph.Label.HTMLImplements HTML labels.
Functions
plotLabelPlots a label for a given node.
Graph.Label.SVGImplements SVG labels.
Functions
plotLabelPlots a label for a given node.

Graph.Label

An interface for plotting/hiding/showing labels.

Description

This is a generic interface for plotting/hiding/showing labels.  The Graph.Label interface is implemented in multiple ways to provide different label types.

For example, the Graph.Label interface is implemented as Graph.Label.HTML to provide HTML label elements.  Also we provide the Graph.Label.SVG interface for SVG type labels.  The Graph.Label.Native interface implements these methods with the native Canvas text rendering functions.

All subclasses (Graph.Label.HTML, Graph.Label.SVG and Graph.Label.Native) implement the method plotLabel.

Graph.Label.Native

Implements labels natively, using the Canvas text API.

Summary
Functions
plotLabelPlots a label for a given node.

Functions

plotLabel

plotLabel: function(canvas,
node,
controller)

Plots a label for a given node.

Parameters

canvas(object) A Canvas instance.
node(object) A Graph.Node.
controller(object) A configuration object.

Example

var viz = new $jit.Viz(options);
var node = viz.graph.getNode('nodeId');
viz.labels.plotLabel(viz.canvas, node, viz.config);

Graph.Label.DOM

Abstract Class implementing some DOM label methods.

Implemented by

Graph.Label.HTML and Graph.Label.SVG.

Summary
Functions
getLabelContainerLazy fetcher for the label container.
getLabelLazy fetcher for the label element.
hideLabelsHides all labels (by hiding the label container).
clearLabelsClears the label container.
disposeLabelRemoves a label.
hideLabelHides the corresponding Graph.Node label.

Functions

getLabelContainer

getLabelContainer: function()

Lazy fetcher for the label container.

Returns

The label container DOM element.

Example

var viz = new $jit.Viz(options);
var labelContainer = viz.labels.getLabelContainer();
alert(labelContainer.innerHTML);

getLabel

getLabel: function(id)

Lazy fetcher for the label element.

Parameters

id(string) The label id (which is also a Graph.Node id).

Returns

The label element.

Example

var viz = new $jit.Viz(options);
var label = viz.labels.getLabel('someid');
alert(label.innerHTML);

hideLabels

hideLabels: function (hide)

Hides all labels (by hiding the label container).

Parameters

hide(boolean) A boolean value indicating if the label container must be hidden or not.

Example

var viz = new $jit.Viz(options);
rg.labels.hideLabels(true);

clearLabels

clearLabels: function(force)

Clears the label container.

Useful when using a new visualization with the same canvas element/widget.

Parameters

force(boolean) Forces deletion of all labels.

Example

var viz = new $jit.Viz(options);
viz.labels.clearLabels();

disposeLabel

disposeLabel: function(id)

Removes a label.

Parameters

id(string) A label id (which generally is also a Graph.Node id).

Example

var viz = new $jit.Viz(options);
viz.labels.disposeLabel('labelid');

hideLabel

hideLabel: function(node,
show)

Hides the corresponding Graph.Node label.

Parameters

node(object) A Graph.Node.  Can also be an array of Graph.Nodes.
show(boolean) If true, nodes will be shown.  Otherwise nodes will be hidden.

Example

var rg = new $jit.Viz(options);
viz.labels.hideLabel(viz.graph.getNode('someid'), false);

Graph.Label.HTML

Implements HTML labels.

Extends

All Graph.Label.DOM methods.

Summary
Functions
plotLabelPlots a label for a given node.

Functions

plotLabel

plotLabel: function(canvas,
node,
controller)

Plots a label for a given node.

Parameters

canvas(object) A Canvas instance.
node(object) A Graph.Node.
controller(object) A configuration object.

Example

var viz = new $jit.Viz(options);
var node = viz.graph.getNode('nodeId');
viz.labels.plotLabel(viz.canvas, node, viz.config);

Graph.Label.SVG

Implements SVG labels.

Extends

All Graph.Label.DOM methods.

Summary
Functions
plotLabelPlots a label for a given node.

Functions

plotLabel

plotLabel: function(canvas,
node,
controller)

Plots a label for a given node.

Parameters

canvas(object) A Canvas instance.
node(object) A Graph.Node.
controller(object) A configuration object.

Example

var viz = new $jit.Viz(options);
var node = viz.graph.getNode('nodeId');
viz.labels.plotLabel(viz.canvas, node, viz.config);
plotLabel: function(canvas,
node,
controller)
Plots a label for a given node.
getLabelContainer: function()
Lazy fetcher for the label container.
getLabel: function(id)
Lazy fetcher for the label element.
hideLabels: function (hide)
Hides all labels (by hiding the label container).
clearLabels: function(force)
Clears the label container.
disposeLabel: function(id)
Removes a label.
hideLabel: function(node,
show)
Hides the corresponding Graph.Node label.
A Graph node.
plotLabel: function(canvas,
node,
controller)
Plots a label for a given node.
plotLabel: function(canvas,
node,
controller)
Plots a label for a given node.
An interface for plotting/hiding/showing labels.
Implements HTML labels.
Implements SVG labels.
Implements labels natively, using the Canvas text API.
A canvas widget used by all visualizations.
Abstract Class implementing some DOM label methods.
Close