(valueformat, fmt, from, to)
| 549 | |
| 550 | // Function to override the number formatting used during transitions |
| 551 | function transitionFormat(valueformat, fmt, from, to) { |
| 552 | // For now, do not display SI prefix if start and end value do not have any |
| 553 | if(valueformat.match('s') && // If using SI prefix |
| 554 | (from >= 0 !== to >= 0) && // If sign change |
| 555 | (!fmt(from).slice(-1).match(SI_PREFIX) && !fmt(to).slice(-1).match(SI_PREFIX)) // Has no SI prefix |
| 556 | ) { |
| 557 | var transitionValueFormat = valueformat.slice().replace('s', 'f').replace(/\d+/, function(m) { return parseInt(m) - 1;}); |
| 558 | var transitionAx = mockAxis(gd, {tickformat: transitionValueFormat}); |
| 559 | return function(v) { |
| 560 | // Switch to fixed precision if number is smaller than one |
| 561 | if(Math.abs(v) < 1) return Axes.tickText(transitionAx, v).text; |
| 562 | return fmt(v); |
| 563 | }; |
| 564 | } else { |
| 565 | return fmt; |
| 566 | } |
| 567 | } |
| 568 | |
| 569 | function drawBignumber() { |
| 570 | var bignumberAx = mockAxis(gd, {tickformat: trace.number.valueformat}, trace._range); |
no test coverage detected
searching dependent graphs…