Optimized graph rendering (ported most of the features to javascript)