More about the JavaScript InfoVis Toolkit 1.1

I’ve been putting a lot of effort in the upcoming version of the JavaScript InfoVis Toolkit lately, and I though it would be a good idea to show some of the new features I came up with.

The new version isn’t finished yet, but I’ve come pretty far and wanted to make a sort of checkpoint for the things I’ve done, the things I’ll be doing and the things I’m thinking about doing.

So what have I been working on?

  • A new project page design.
  • A complete documentation. I made an API documentation that is also mixed with some narrative documentation for each Class, so you can learn how the visualizations are implemented and how to use them.
  • Packaging All visualizations will be packaged in the same file, and you’ll be able to make your own build based on what you’re going to use (Treemaps, Hypertrees, RGraphs, Spacetrees or any combination of those). This is a cool aspect of making modular code.
    The other good thing about modular code is that the size of the full package will drop in ~30% compared to version 1.0.8a
  • Examples I’ve been coding some new visualization examples that will be packaged with the library. Some of them are very similar to the ones found in 1.0.8a, but adapted for version 1.1. Other examples show some of the new features of the library, and others try to expose some features of version 1.0.8a that were not properly documented.

Library features

I’ve been building this library with four things in mind:

  • Extensibility The library has multiple access points where it can be extended in different ways. For example, all main Classes are mutable objects, so you can extend or implement any method of any class in-place, like for example re-implement the nodes coloring method in the Squarified treemap:

       //TM.Strip, TM.SliceAndDice also work
       TM.Squarified.implement({
         'setColor': function(json) {
           return json.data.$color;
         }
       });
    

    …or adding new node/edge plotting methods in the Hypertree, ST or RGraph:

    Hypertree.Plot.NodeTypes.implement({
      'my-node-rendering-method': function(node, canvas) {
        //implement node rendering here
      }
    });
    

    etc.

  • Customization The library provides many ways for customizing the visualizations. There are controller methods that determine the behavior of the visualization, and configuration parameters like node and edge types, color and dimensions. Node shapes can be square, rectangle, circle, ellipse, etc. and edge shapes: line, hyperline and arrow. I also added transition effects like Quart, Bounce, Elastic, Back, etc. for the animations.
  • Modularity As explained above, the code has been divided into modules, providing a way for making custom builds of the library. Modularity also takes care of namespacing: I only add Classes that are meant to be accessed by the user and I don’t pollute the window object with unnecessary global objects.
  • Composition A major improvement in this version is that all visualizations can co-exist in the same namespace. That means that multiple instances of different visualizations can be used and composed to make new visualizations. I haven’t explored this feature of the library yet, but this would mean that for example I can make a Treemap that has Hypertrees rendered as leaves, or a Spacetree that has Treemaps as nodes, or… well, any other combination of things.

Examples

As you might know, I don’t have the most suited computer for making screencasts, so sorry if you see some performance problems.

This is a short video I made of a RGraph example.

The main idea behind this example is Customization.
That can be seen for example in the different node types, edge types and colors used, as well as in the Elastic transition effect for the animation.

This is just an example to expose as much features as I can in one visualization, so don’t take this as a “useful” visualization example please.

Here is another short video: it illustrates how Graph Operations can be made with the Hypertree visualization.

You’ll see 4 consecutive operations:

  1. Removing a subtree The bottom right subtree will be removed with an animation.
  2. Removing edges Edges from the top left subtree will be removed with an animation.
  3. Adding a graph A graph will be added with an animation
  4. Morphing The graph will transform into another graph -with an animation

Enjoy.

4 Responses to “More about the JavaScript InfoVis Toolkit 1.1”


  1. 1 Nitin Bhide

    I have made a Treemap visualization of 2009 General Elections of India using the Treemap component from the JIT. It is available at http://thinkingcraftsman.in/articles/election2009vis/results2009.htm.

    Thank you for excellent toolkit.

    Nitin

  2. 2 Nicolas

    Nice work! :)

  3. 3 Debora

    Hi Nicolas,
    We are trying to implement your software (rgraph) in a research network map for our group at the University.
    We have still with some problems to accomplish that and I hope you could help. We are acessing a data bank through a PHP function, returning an Array.
    So we use the file json.php (This package provides a simple encoder and decoder for JSON notation) in order to transform this array in a javascript object.

    $json = new Services_JSON();
    $resposta = $json->encode($dados);

    The Question is: How to pass this object to the file static1-rgraph.js, so as it will assume the value of var D in function init()?

    Also
    Do you have any other implementation where the data results from a consult in a data base (data bank or text file)?
    Congratulations for your very interesting work.
    Kind regards,
    Debora

  4. 4 Nicolas

    Hi,

    I don’t think this is the better place for discussing this, I guess that poping that question in the google group for this toolkit would be better:

    http://groups.google.com/group/javascript-information-visualization-toolkit

    I’ll try to answer to the question:

    “How to pass this object to the file static1-rgraph.js, so as it will assume the value of var D in function init()?”

    This is done by making an Ajax call to get the json result from your file.
    In order to execute your php file and be able to make an Ajax call from the client (say from the init function) to the service exposed by your php file you need something like a server (apache, etc).
    Once you placed your file server side then in the init function you can make an ajax call like this (I’m assuming you’re using MooTools):

    //canvas and rgraph initialization code...
    var canvas = new Canvas(/* ... */);
    var rgraph = new RGraph(/* ... */);
    
    var jsonRequest = new Request.JSON({
      url: "http://site.com/yourphpfile.php", 
    
      onComplete: function(json){
        rgraph.loadTreeFromJSON(json);
        rgraph.compute();
        rgraph.plot();
    }}).get({'someparametername': 'someparametervalue'});
    

    If you want to know more about the MooTools request object check it out here:

    http://mootools.net/docs/core/Request/Request.JSON

    I’m sorry but I can’t package any examples having server side interaction because I’d need to package a standalone server with the library, and it seems kind of overkill.

    If you have further questions please send them to the google group for this library (I putted the link to it above).

    Regards,

Comments are currently closed.