Options.Controller.js

Summary
Options.Controller.js
Options.ControllerProvides controller methods.

Options.Controller

Provides controller methods.  Controller methods are callback functions that get called at different stages of the animation, computing or plotting of the visualization.

Implemented by

All visualizations except charts (AreaChart, BarChart and PieChart).

Syntax

Options.Controller = {
  onBeforeCompute: $.empty,
  onAfterCompute:  $.empty,
  onCreateLabel:   $.empty,
  onPlaceLabel:    $.empty,
  onComplete:      $.empty,
  onBeforePlotLine:$.empty,
  onAfterPlotLine: $.empty,
  onBeforePlotNode:$.empty,
  onAfterPlotNode: $.empty,
  request:         false
};

Example

var viz = new $jit.Viz({
  onBeforePlotNode: function(node) {
    if(node.selected) {
      node.setData('color', '#ffc');
    } else {
      node.removeData('color');
    }
  },
  onBeforePlotLine: function(adj) {
    if(adj.nodeFrom.selected && adj.nodeTo.selected) {
      adj.setData('color', '#ffc');
    } else {
      adj.removeData('color');
    }
  },
  onAfterCompute: function() {
    alert("computed!");
  }
});

Parameters

onBeforeCompute(node)This method is called right before performing all computations and animations.  The selected Graph.Node is passed as parameter.
onAfterCompute()This method is triggered after all animations or computations ended.
onCreateLabel(domElement, node)This method receives a new label DIV element as first parameter, and the corresponding Graph.Node as second parameter.  This method will only be called once for each label.  This method is useful when adding events or styles to the labels used by the JIT.
onPlaceLabel(domElement, node)This method receives a label DIV element as first parameter and the corresponding Graph.Node as second parameter.  This method is called each time a label has been placed in the visualization, for example at each step of an animation, and thus it allows you to update the labels properties, such as size or position.  Note that onPlaceLabel will be triggered after updating the labels positions.  That means that, for example, the left and top css properties are already updated to match the nodes positions.  Width and height properties are not set however.
onBeforePlotNode(node)This method is triggered right before plotting each Graph.Node.  This method is useful for changing a node style right before plotting it.
onAfterPlotNode(node)This method is triggered right after plotting each Graph.Node.
onBeforePlotLine(adj)This method is triggered right before plotting a Graph.Adjacence.  This method is useful for adding some styles to a particular edge before being plotted.
onAfterPlotLine(adj)This method is triggered right after plotting a Graph.Adjacence.

Used in ST, TM.Base and Icicle visualizations

request(nodeId, level, onComplete)This method is used for buffering information into the visualization.  When clicking on an empty node, the visualization will make a request for this node’s subtrees, specifying a given level for this subtree (defined by levelsToShow).  Once the request is completed, the onComplete callback should be called with the given result.  This is useful to provide on-demand information into the visualizations withought having to load the entire information from start.  The parameters used by this method are nodeId, which is the id of the root of the subtree to request, level which is the depth of the subtree to be requested (0 would mean just the root node).  onComplete is an object having the callback method onComplete.onComplete(json) that should be called once the json has been retrieved.
A visualization that displays stacked area charts.
A visualization that displays stacked bar charts.
A visualization that displays stacked bar charts.
A Graph node.
A Graph adjacence (or edge) connecting two Graph.Nodes.
A Tree layout with advanced contraction and expansion animations.
Abstract class providing base functionality for TM.Squarified, TM.Strip and TM.SliceAndDice visualizations.
Icicle space filling visualization.
Close