agenda-libre-ruby/app/assets/javascripts/stats.js.coffee

23 lines
670 B
CoffeeScript
Raw Normal View History

$(document).on 'turbolinks:load', ->
# Sparline generation along the data tables
$('table.list.dates tbody tr').each ->
vals = $(this).find('td.quantity').map ->
val = $(this).find('a').html().replace(' ', '').trim()
if (val && val != '')
return parseInt val
else
return 0
$(this).find('.sparkline').sparkline vals, width: '5em'
2014-11-06 00:23:01 +01:00
$('table.list.dates tfoot').each ->
vals = $(this).find('th.quantity').map ->
return parseInt $(this).html().replace(' ', '')
$(this).find('.sparkline').sparkline vals,
type: 'bar'
height: '3em'
2014-11-29 19:48:10 +01:00
barWidth: '100%'
2014-11-06 00:23:01 +01:00
barColor: '#9CC5EE'
barSpacing: 2