Created
April 9, 2011 15:42
-
-
Save stuartchaney/911483 to your computer and use it in GitHub Desktop.
ruby embedded highcharts js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="fb_chart" style="width: 100%; height: 300px;"></div> | |
<% content_for :javascripts do %> | |
<script type="text/javascript"> | |
new Highcharts.Chart({ | |
chart: { renderTo: 'fb_chart', defaultSeriesType: 'area' }, | |
title: { text: 'Facebook Publish to Token Rate per Day' }, | |
xAxis: { type: 'datetime' }, | |
yAxis: { | |
title: { text: false } | |
}, | |
tooltip: { | |
formatter: function () { | |
return Highcharts.dateFormat("%B %e %Y", this.x) + ': ' + | |
+ Highcharts.numberFormat(this.y, 2);} | |
}, | |
series: [{ | |
name: "Total Tokens", | |
pointInterval: <%= 1.day * 1000 %>, | |
pointStart: <%= 3.weeks.ago.at_midnight.to_i * 1000 %>, | |
data: <%= (3.weeks.ago.to_date..Date.today).map { |date| FbToken.total_on(date).to_i}.inspect %> | |
}, | |
{ | |
name: "Published", | |
pointInterval: <%= 1.day * 1000 %>, | |
pointStart: <%= 3.weeks.ago.at_midnight.to_i * 1000 %>, | |
data: <%= (3.weeks.ago.to_date..Date.today).map { |date| FbToken.published.total_on(date).to_i}.inspect %> | |
}] | |
}); | |
</script> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment