Move d3 chart JS into JS file