working js for charts