Chart bars demo

This simple demo shows how easy it is to set up some very effective chart animation.
It doesn't make a visible difference if there are 5 bars rendered or 25. Even 80 wouldn't slow the rendering too much.

 
 
 
 
 
 
 
 
 


var bars = document.getElementById('chart').getElementsByTagName('div'),
    myMorph = new jsMorph(),
    update = function (myMorph, bars, data, height, duration, delay) {
      myMorph.reset();
      for(var n = bars.length; n--;) {
        myMorph.concat(bars[n],
          {'margin-top': data[n]*(height || 1)},
          {duration : (duration || 800), delay : n*(delay || 0)},
          function(n) {return --n*n*n*n*n+1});
      }
      myMorph.start();
    };
		
update(myMorph, bars, data, 200, 800, 100); // data coming from an ajax request as Array