refactored chart js code from index.html to charting.js