MCPcopy Create free account
hub / github.com/breck7/scroll / insideOut

Function insideOut

external/.d3.js:19507–19530  ·  view source on GitHub ↗
(series)

Source from the content-addressed store, hash-verified

19505}
19506
19507function insideOut(series) {
19508 var n = series.length,
19509 i,
19510 j,
19511 sums = series.map(sum),
19512 order = appearance(series),
19513 top = 0,
19514 bottom = 0,
19515 tops = [],
19516 bottoms = [];
19517
19518 for (i = 0; i < n; ++i) {
19519 j = order[i];
19520 if (top < bottom) {
19521 top += sums[j];
19522 tops.push(j);
19523 } else {
19524 bottom += sums[j];
19525 bottoms.push(j);
19526 }
19527 }
19528
19529 return bottoms.reverse().concat(tops);
19530}
19531
19532function reverse(series) {
19533 return none(series).reverse();

Callers

nothing calls this directly

Calls 4

appearanceFunction · 0.85
mapMethod · 0.80
concatMethod · 0.80
reverseMethod · 0.80

Tested by

no test coverage detected