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

Function concatExtremes

src/plots/cartesian/autorange.js:320–370  ·  view source on GitHub ↗
(gd, ax, noMatch)

Source from the content-addressed store, hash-verified

318}
319
320function concatExtremes(gd, ax, noMatch) {
321 var axId = ax._id;
322 var fullData = gd._fullData;
323 var fullLayout = gd._fullLayout;
324 var minArray = [];
325 var maxArray = [];
326 var i, j, d;
327
328 function _concat(cont, indices) {
329 for(i = 0; i < indices.length; i++) {
330 var item = cont[indices[i]];
331 var extremes = (item._extremes || {})[axId];
332 if(item.visible === true && extremes) {
333 for(j = 0; j < extremes.min.length; j++) {
334 d = extremes.min[j];
335 collapseMinArray(minArray, d.val, d.pad, {extrapad: d.extrapad});
336 }
337 for(j = 0; j < extremes.max.length; j++) {
338 d = extremes.max[j];
339 collapseMaxArray(maxArray, d.val, d.pad, {extrapad: d.extrapad});
340 }
341 }
342 }
343 }
344
345 _concat(fullData, ax._traceIndices);
346 _concat(fullLayout.annotations || [], ax._annIndices || []);
347 _concat(fullLayout.shapes || [], ax._shapeIndices || []);
348
349 // Include the extremes from other matched axes with this one
350 if(ax._matchGroup && !noMatch) {
351 for(var axId2 in ax._matchGroup) {
352 if(axId2 !== ax._id) {
353 var ax2 = getFromId(gd, axId2);
354 var extremes2 = concatExtremes(gd, ax2, true);
355 // convert padding on the second axis to the first with lenRatio
356 var lenRatio = ax._length / ax2._length;
357 for(j = 0; j < extremes2.min.length; j++) {
358 d = extremes2.min[j];
359 collapseMinArray(minArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad});
360 }
361 for(j = 0; j < extremes2.max.length; j++) {
362 d = extremes2.max[j];
363 collapseMaxArray(maxArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad});
364 }
365 }
366 }
367 }
368
369 return {min: minArray, max: maxArray};
370}
371
372function doAutoRange(gd, ax, presetRange) {
373 ax.setScale();

Callers 1

getAutoRangeFunction · 0.85

Calls 3

_concatFunction · 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…