Skip to content

Instantly share code, notes, and snippets.

@mohitjain1
Created February 23, 2013 17:28
Show Gist options
  • Save mohitjain1/5020584 to your computer and use it in GitHub Desktop.
Save mohitjain1/5020584 to your computer and use it in GitHub Desktop.
total stats
<script type="text/javascript">
$(function () {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'gifts_growth'
},
title: {
text: 'Incremental Growth Charts - Users, Companies, Reports, Groups'
},
xAxis: {
type: 'datetime'
},
yAxis: {
title: {
text: 'Counts'
}
},
tooltip: {
formatter: function() {
return ''+
Highcharts.dateFormat('%e. %b', this.x) +' -> '+ this.y;
}
},
plotOptions: {
spline: {
lineWidth: 4,
states: {
hover: {
lineWidth: 5
}
},
marker: {
enabled: false,
states: {
hover: {
enabled: true,
symbol: 'circle',
radius: 5,
lineWidth: 1
}
}
}
}
},
series: [
{
name: 'Total Users',
pointInterval: <%= 1.day * 1000 %>,
pointStart: <%= 30.days.ago.to_i * 1000 %>,
data: <%= User.total_records_counts_array_in_past_n_days %>
}, {
name: 'Total Reports',
pointInterval: <%= 1.day * 1000 %>,
pointStart: <%= 30.days.ago.to_i * 1000 %>,
data: <%= Report.total_records_counts_array_in_past_n_days %>
}
, {
name: 'Total Groups',
pointInterval: <%= 1.day * 1000 %>,
pointStart: <%= 30.days.ago.to_i * 1000 %>,
data: <%= Group.total_records_counts_array_in_past_n_days %>
}, {
name: 'Total Companies',
pointInterval: <%= 1.day * 1000 %>,
pointStart: <%= 30.days.ago.to_i * 1000 %>,
data: <%= Company.total_records_counts_array_in_past_n_days %>
}, {
name: 'Total Submissions',
pointInterval: <%= 1.day * 1000 %>,
pointStart: <%= 30.days.ago.to_i * 1000 %>,
data: <%= Submission.total_records_counts_array_in_past_n_days %>
}
, {
name: 'Total Activities',
pointInterval: <%= 1.day * 1000 %>,
pointStart: <%= 30.days.ago.to_i * 1000 %>,
data: <%= Activity.total_records_counts_array_in_past_n_days %>
}
]
,
navigation: {
menuItemStyle: {
fontSize: '10px'
}
}
});
});
});
</script>
<div id="gifts_growth" style="min-width: 400px; height: 400px; "></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment