1 # Place all the behaviors and hooks related to the matching controller here.
2 # All this logic will automatically be available in application.js.
3 # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
5 cache_age_in_days = (milliseconds_age) ->
6 ONE_DAY = 1000 * 60 * 60 * 24
7 milliseconds_age / ONE_DAY
9 cache_age_hover = (milliseconds_age) ->
10 'Cache age ' + cache_age_in_days(milliseconds_age).toFixed(1) + ' days.'
12 cache_age_axis_label = (milliseconds_age) ->
13 cache_age_in_days(milliseconds_age).toFixed(0) + ' days'
15 float_as_percentage = (proportion) ->
16 (proportion.toFixed(4) * 100) + '%'
18 $.renderHistogram = (histogram_data) ->
20 element: 'cache-age-vs-disk-histogram',
25 ykeys: ['persisted', 'cache'],
26 labels: ['Persisted Storage Disk Utilization', 'Cached Storage Disk Utilization'],
29 xLabelFormat: cache_age_axis_label,
30 yLabelFormat: float_as_percentage,
31 dateFormat: cache_age_hover