I’ve tried a few different things, and this is as close I have been able to get:
<script type="text/javascript" charset="utf-8">
$(function () {
new Highcharts.Chart({
chart: { renderTo: 'orders_chart' },
title: { text: 'Orders by Day' },
xAxis: { type: 'datetime' },
yAxis: {
title: { text: 'Dollars' }
},
tooltip: {
formatter: function () {
return Highcharts.dateFormat("%B %e %Y", this.x) + ': ' +
'$' + Highcharts.numberFormat(this.y, 2);
}
},
series: [{
pointInterval: <%= 1.day * 1000 %>,
pointStart: <%= 0.days.ago.at_midnight.to_i * 1000 %>,
data: <%= @daily_count[0] %>
}]
});
});
</script>
The problem is specifically: data: <%= @daily_count[0] %> this currently gives me one datapoint. I’ve tried just <%= @daily_count %> but that doesn’t work. What I need is a way to put an array, and specifically [daily_count[0], daily_count[1]...] into data.
try using
to_json