1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00
raspap-webgui/bower_components/morrisjs/spec/lib/grid/y_label_format_spec.coffee
2015-02-25 14:08:14 +01:00

16 lines
443 B
CoffeeScript
Executable File

describe 'Morris.Grid#yLabelFormat', ->
it 'should use custom formatter for y labels', ->
formatter = (label) ->
flabel = parseFloat(label) / 1000
"#{flabel.toFixed(1)}k"
line = Morris.Line
element: 'graph'
data: [{x: 1, y: 1500}, {x: 2, y: 2500}]
xkey: 'x'
ykeys: ['y']
labels: ['dontcare']
preUnits: "$"
yLabelFormat: formatter
line.yLabelFormat(1500).should.equal "1.5k"