Changed drawChart javascript function