Sha256: ce8088821ffcfa1d2e39455a31af41eaf33607a1617ca23e84f6320aae0a6e0e
Contents?: true
Size: 604 Bytes
Versions: 3
Compression:
Stored size: 604 Bytes
Contents
var format = (function() { var formatFloat = function(number, precision) { precision = precision || 2; var base = Math.pow(10, precision); return Math.round(number * base) / base; } var metricTemplate = _.template('<div class="bar {{state}}" style="width: {{percent}}%">{{metric}}</div>'); var metric = function(e, max) { var max = (max || 1); var data = { 'state': e.state, 'percent': (e.metric / max * 100), 'metric': formatFloat(e.metric) } return metricTemplate(data); }; return { 'float': formatFloat, 'metric': metric } })();
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
riemann-dash-0.2.5 | lib/riemann/dash/public/format.js |
riemann-dash-0.2.4 | lib/riemann/dash/public/format.js |
riemann-dash-0.2.3 | lib/riemann/dash/public/format.js |