app/views/spectrums/stats.html.erb
<div class="container-fluid">
<h3 class="span12"><%= Spectrum.count :all %> spectra uploaded to date <small>| Spectra for the past 52 weeks</small></h3>
<div class="span12" id="spectrums" style="height:100px;"></div>
</div>
<div class="container-fluid">
<hr />
<div class="span6">
<h3><%= User.count :all %> contributors</h3>
<p>New users for the past 52 weeks</p>
<div id="users" style="height:100px;"></div>
</div>
<div class="span6">
<h3><%= SpectraSet.count :all %> sets</h3>
</div>
</div>
<script type="text/javascript">
(function () {
flotoptions_minimal = {
yaxis: { show: false },
xaxis: { show: true },
grid: {
borderWidth: 0,
//backgroundColor: "#222",
//color: "#444",
markers: []
}
// Palette "i eat the rainbow" by svartedauden on Colourlovers: http://www.colourlovers.com/palette/1630898/i_eat_the_rainbow, CC-BY-NC
//colors: [ "#E02130", "#FAB243", "#429867", "#2B5166" ]//, "#482344" ]
}
var spectra = <%= Spectrum.weekly_tallies.to_a.sort.to_json %>
$.plot($("#spectrums"), [
{
data: spectra,
bars: { show: true,
lineWidth: 0,
fillColor: "#08f",
barWidth: 0.5
}
}
],flotoptions_minimal)
var users = <%= User.weekly_tallies.to_a.sort.to_json %>
$.plot($("#users"), [
{
data: users,
bars: { show: true,
lineWidth: 0,
fillColor: "#f08",
barWidth: 0.5
}
}
],flotoptions_minimal)
})()
</script>