Skip to content

Instantly share code, notes, and snippets.

@rclements
Created February 8, 2013 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rclements/4741481 to your computer and use it in GitHub Desktop.
Save rclements/4741481 to your computer and use it in GitHub Desktop.
# CONTROLLER
----------------------------------
@plutus_data = []
@amounts = current_user.per_diem_account.amounts.each do |amount|
@plutus_data << [amount.transaction.created_at.strftime('%Y, %m, %d'), amount.amount]
end
# VIEW
-----------------------------------
#graph
%script
window.App = window.App || {};
window.App.Data = window.App.Data || {};
window.App.Data.plutus_data = "#{@plutus_data.to_json}";
# JAVASCRIPT
------------------------------------
$ ->
load_chart = new Highcharts.Chart
chart:
renderTo: 'graph'
defaultSeriesType: 'line'
title:
text: 'Per Diem'
xAxis:
title: 'Time'
type: 'datetime'
labels:
formatter: ->
this.value
yAxis:
title:
text: 'Dollars'
plotOptions:
area:
marker:
enabled: false
symbol: 'circle'
radius: 2
states:
hover:
enabled: true
series: [
{
name: 'Per Diem'
data: window.App.Data.plutus_data
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment