Move javascript from view to chart.js.