MCPcopy Create free account
hub / github.com/plotly/plotly.js / dedupeRealRanges

Function dedupeRealRanges

src/traces/parcoords/axisbrush.js:437–461  ·  view source on GitHub ↗
(intervals)

Source from the content-addressed store, hash-verified

435}
436
437function dedupeRealRanges(intervals) {
438 // Fuses elements of intervals if they overlap, yielding discontiguous intervals, results.length <= intervals.length
439 // Currently uses closed intervals, ie. dedupeRealRanges([[400, 800], [300, 400]]) -> [300, 800]
440 var queue = intervals.slice();
441 var result = [];
442 var currentInterval;
443 var current = queue.shift();
444 while(current) { // [].shift === undefined, so we don't descend into an empty array
445 currentInterval = current.slice();
446 while((current = queue.shift()) && current[0] <= /* right-open interval would need `<` */ currentInterval[1]) {
447 currentInterval[1] = Math.max(currentInterval[1], current[1]);
448 }
449 result.push(currentInterval);
450 }
451
452 if(
453 result.length === 1 &&
454 result[0][0] > result[0][1]
455 ) {
456 // discard result
457 result = [];
458 }
459
460 return result;
461}
462
463function makeFilter() {
464 var filter = [];

Callers 2

makeFilterFunction · 0.85
cleanRangesFunction · 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…