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

Function addItem

src/plots/cartesian/autorange.js:509–541  ·  view source on GitHub ↗
(i)

Source from the content-addressed store, hash-verified

507 var collapseOpts = {tozero: tozero, extrapad: extrapad};
508
509 function addItem(i) {
510 di = data[i];
511 if(!isNumeric(di)) return;
512 ppadiplus = ppadplus(i);
513 ppadiminus = ppadminus(i);
514
515 if(vpadLinearized) {
516 dmin = ax.c2l(di) - vpadminus(i);
517 dmax = ax.c2l(di) + vpadplus(i);
518 } else {
519 vmin = di - vpadminus(i);
520 vmax = di + vpadplus(i);
521 // special case for log axes: if vpad makes this object span
522 // more than an order of mag, clip it to one order. This is so
523 // we don't have non-positive errors or absurdly large lower
524 // range due to rounding errors
525 if(isLog && vmin < vmax / 10) vmin = vmax / 10;
526
527 dmin = ax.c2l(vmin);
528 dmax = ax.c2l(vmax);
529 }
530
531 if(tozero) {
532 dmin = Math.min(0, dmin);
533 dmax = Math.max(0, dmax);
534 }
535 if(goodNumber(dmin)) {
536 collapseMinArray(minArray, dmin, ppadiminus, collapseOpts);
537 }
538 if(goodNumber(dmax)) {
539 collapseMaxArray(maxArray, dmax, ppadiplus, collapseOpts);
540 }
541 }
542
543 // For efficiency covering monotonic or near-monotonic data,
544 // check a few points at both ends first and then sweep

Callers 1

findExtremesFunction · 0.70

Calls 3

goodNumberFunction · 0.85
collapseMinArrayFunction · 0.85
collapseMaxArrayFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…