Skip to content

Instantly share code, notes, and snippets.

@stoplion
Created March 21, 2012 15:15
Show Gist options
  • Save stoplion/2148256 to your computer and use it in GitHub Desktop.
Save stoplion/2148256 to your computer and use it in GitHub Desktop.
Promise interface to call HighCharts
thirty_days_of_apps = $.getJSON application_chart_url
thirty_days_of_apps.done (data) ->
draw_chart(data, 'application_chart', 'Job Applications in last 30 days', 'Applications', 'areaspline')
draw_number_of_apps(data)
thirty_days_of_apps.fail ->
console.log "You failed congrats!"
draw_number_of_apps = (data) ->
total_apps_last_seven_days =+ num[1] for num in data[-7..]
$('.total_apps_last_seven_days').html total_apps_last_seven_days
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment