Move js functions to data.js and chart.js