MCPcopy Index your code
hub / github.com/plotly/plotly.js / transitionFormat

Function transitionFormat

src/traces/indicator/plot.js:551–567  ·  view source on GitHub ↗
(valueformat, fmt, from, to)

Source from the content-addressed store, hash-verified

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);

Callers 2

drawBignumberFunction · 0.85
drawDeltaFunction · 0.85

Calls 1

mockAxisFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…