moved d3 script from template to view