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

Function getEndText

src/plots/cartesian/dragbox.js:1066–1083  ·  view source on GitHub ↗
(ax, end)

Source from the content-addressed store, hash-verified

1064}
1065
1066function getEndText(ax, end) {
1067 var initialVal = ax.range[end];
1068 var diff = Math.abs(initialVal - ax.range[1 - end]);
1069 var dig;
1070
1071 // TODO: this should basically be ax.r2d but we're doing extra
1072 // rounding here... can we clean up at all?
1073 if(ax.type === 'date') {
1074 return initialVal;
1075 } else if(ax.type === 'log') {
1076 dig = Math.ceil(Math.max(0, -Math.log(diff) / Math.LN10)) + 3;
1077 return numberFormat('.' + dig + 'g')(Math.pow(10, initialVal));
1078 } else { // linear numeric (or category... but just show numbers here)
1079 dig = Math.floor(Math.log(Math.abs(initialVal)) / Math.LN10) -
1080 Math.floor(Math.log(diff) / Math.LN10) + 4;
1081 return numberFormat('.' + String(dig) + 'g')(initialVal);
1082 }
1083}
1084
1085function zoomAxRanges(axList, r0Fraction, r1Fraction, updates, linkedAxes) {
1086 for(var i = 0; i < axList.length; i++) {

Callers 1

clickFnFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…