2016-07-02 16:48:47 +02:00
|
|
|
$(document).on 'turbolinks:load', ->
|
2014-11-08 14:19:51 +01:00
|
|
|
# Sparline generation along the data tables
|
2014-10-19 16:20:44 +02:00
|
|
|
$('table.list.dates tbody tr').each ->
|
2014-11-06 15:36:25 +01:00
|
|
|
vals = $(this).find('td.quantity').map ->
|
|
|
|
val = $(this).find('a').html().replace(' ', '').trim()
|
|
|
|
if (val && val != '')
|
2014-10-19 16:20:44 +02:00
|
|
|
return parseInt val
|
2014-11-06 15:36:25 +01:00
|
|
|
else
|
|
|
|
return 0
|
2014-10-19 16:20:44 +02:00
|
|
|
|
|
|
|
$(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
|