convert chart.coffee to js