Refactored javascript code

There was no real need to generate baseline data before drawing the real
data. d3.js already provide a way to handle update of the graph when new
data is bound to a selection.