Skip to content

Instantly share code, notes, and snippets.

@universal
Created November 14, 2012 09:17
Show Gist options
  • Save universal/4071141 to your computer and use it in GitHub Desktop.
Save universal/4071141 to your computer and use it in GitHub Desktop.
highcharts with datetime
#user_totals_chart
:javascript
Chart = {}
Chart.series = [{
data: #{User.order("created_at").group("date(created_at)").select("count(id) as total, date(created_at) as created_at").all.map {|u| [u.created_at.to_i * 1000, u.total.to_i]}},
name: 'Benutzer'
}];
:coffeescript
new Highcharts.Chart
chart:
renderTo: 'user_totals_chart'
zoomType: 'x'
title: { text: 'Benutzer/Tag'}
xAxis: { type: 'datetime' }
yAxis:
title: { text: 'Anzahl' }
series: Chart.series
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment