Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | espaco | 1 | describe 'Morris.Grid#yLabelFormat', -> |
| 2 | |||
| 3 | it 'should use custom formatter for y labels', -> |
||
| 4 | formatter = (label) -> |
||
| 5 | flabel = parseFloat(label) / 1000 |
||
| 6 | "#{flabel.toFixed(1)}k" |
||
| 7 | line = Morris.Line |
||
| 8 | element: 'graph' |
||
| 9 | data: [{x: 1, y: 1500}, {x: 2, y: 2500}] |
||
| 10 | xkey: 'x' |
||
| 11 | ykeys: ['y'] |
||
| 12 | labels: ['dontcare'] |
||
| 13 | preUnits: "$" |
||
| 14 | yLabelFormat: formatter |
||
| 15 | line.yLabelFormat(1500).should.equal "1.5k" |