On controllers

Posted in: javascript infovis toolkit
Controllers are a straightforward way to customize the JavaScript infovis toolkit (JIT) visualizations. A controller is a JavaScript object that "implements" an interface. The interface methods will then be called at different stages of the visualization, allowing you to, for example, place labels and add event handlers to them, performing actions before and after the animation, making ajax - calls to load data dynamically to the tree, etc. The controller interface is defined as:
var ControllerInterface = {
       onCreateLabel: function (domElement, node) {},

       onPlaceLabel: function (domElement, node) {},

       onBeforePlotLine: function(adj) {},

       onAfterPlotLine: function(adj) {},

       onBeforeCompute: function (node) {},

       onAfterCompute: function () {}

       request: function(nodeId, level, onComplete) {},

where: Note that you should not declare any of these methods on your controller object if you are not going to use them. Note also that is not mandatory to provide a controller object to the main classes. You can find some example uses for the controller object at the spacetree, hypertree, treemap and rgraph tutorials. Be sure to know what JSON structure feeds the JIT visualizations before you read the tutorials. Hope it was helpful.
blog comments powered by Disqus