Javascript Pivot Table implementation.