app/views/stat_board/stats/_graph.html.erb
<div id="container"></div>
<%= javascript_include_tag "stat_board/highcharts" %>
<script>
var pointInterval = <%= date_steps.days * 1000 %>;
var pointStart = <%= start_at.to_time.to_i * 1000 %>;
Highcharts.chart('container', {
title: { text: '' },
xAxis: { type: 'datetime' },
yAxis: {
title: { text: 'Count' },
min: <%= StatBoard.models.map { |model| resources_by_date(model.to_s) }.map(&:first).min %>
},
series: [
<% StatBoard.models.each do |model| %>
{
name: "<%= model.to_s.pluralize %>",
pointInterval: pointInterval,
pointStart: pointStart,
data: <%= resources_by_date(model.to_s).to_s %>
},
<% end %>
]
});
</script>