MCPcopy
hub / github.com/plotly/plotly.js / doAutoRange

Function doAutoRange

src/plots/cartesian/autorange.js:372–407  ·  view source on GitHub ↗
(gd, ax, presetRange)

Source from the content-addressed store, hash-verified

370}
371
372function doAutoRange(gd, ax, presetRange) {
373 ax.setScale();
374
375 if(ax.autorange) {
376 ax.range = presetRange ? presetRange.slice() : getAutoRange(gd, ax);
377
378 ax._r = ax.range.slice();
379 ax._rl = Lib.simpleMap(ax._r, ax.r2l);
380
381 // doAutoRange will get called on fullLayout,
382 // but we want to report its results back to layout
383
384 var axIn = ax._input;
385
386 // before we edit _input, store preGUI values
387 var edits = {};
388 edits[ax._attr + '.range'] = ax.range;
389 edits[ax._attr + '.autorange'] = ax.autorange;
390 Registry.call('_storeDirectGUIEdit', gd.layout, gd._fullLayout._preGUI, edits);
391
392 axIn.range = ax.range.slice();
393 axIn.autorange = ax.autorange;
394 }
395
396 var anchorAx = ax._anchorAxis;
397
398 if(anchorAx && anchorAx.rangeslider) {
399 var axeRangeOpts = anchorAx.rangeslider[ax._name];
400 if(axeRangeOpts) {
401 if(axeRangeOpts.rangemode === 'auto') {
402 axeRangeOpts.range = getAutoRange(gd, ax);
403 }
404 }
405 anchorAx._input.rangeslider[ax._name] = Lib.extendFlat({}, axeRangeOpts);
406 }
407}
408
409/**
410 * findExtremes

Callers 2

polar.jsFile · 0.85
subroutines.jsFile · 0.85

Calls 1

getAutoRangeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…