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

Function stack

external/.d3.js:19381–19423  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19379}
19380
19381function stack() {
19382 var keys = constant$1([]),
19383 order = none,
19384 offset = none$1,
19385 value = stackValue;
19386
19387 function stack(data) {
19388 var sz = Array.from(keys.apply(this, arguments), stackSeries),
19389 i, n = sz.length, j = -1,
19390 oz;
19391
19392 for (const d of data) {
19393 for (i = 0, ++j; i < n; ++i) {
19394 (sz[i][j] = [0, +value(d, sz[i].key, j, data)]).data = d;
19395 }
19396 }
19397
19398 for (i = 0, oz = array(order(sz)); i < n; ++i) {
19399 sz[oz[i]].index = i;
19400 }
19401
19402 offset(sz, oz);
19403 return sz;
19404 }
19405
19406 stack.keys = function(_) {
19407 return arguments.length ? (keys = typeof _ === "function" ? _ : constant$1(Array.from(_)), stack) : keys;
19408 };
19409
19410 stack.value = function(_) {
19411 return arguments.length ? (value = typeof _ === "function" ? _ : constant$1(+_), stack) : value;
19412 };
19413
19414 stack.order = function(_) {
19415 return arguments.length ? (order = _ == null ? none : typeof _ === "function" ? _ : constant$1(Array.from(_)), stack) : order;
19416 };
19417
19418 stack.offset = function(_) {
19419 return arguments.length ? (offset = _ == null ? none$1 : _, stack) : offset;
19420 };
19421
19422 return stack;
19423}
19424
19425function expand(series, order) {
19426 if (!((n = series.length) > 0)) return;

Callers

nothing calls this directly

Calls 3

constant$1Function · 0.85
arrayFunction · 0.85
fromMethod · 0.45

Tested by

no test coverage detected