MCPcopy Create free account
hub / github.com/d3/d3-shape / stack

Function stack

src/stack.js:22–39  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

20 value = stackValue;
21
22 function stack(data) {
23 var sz = Array.from(keys.apply(this, arguments), stackSeries),
24 i, n = sz.length, j = -1,
25 oz;
26
27 for (const d of data) {
28 for (i = 0, ++j; i < n; ++i) {
29 (sz[i][j] = [0, +value(d, sz[i].key, j, data)]).data = d;
30 }
31 }
32
33 for (i = 0, oz = array(order(sz)); i < n; ++i) {
34 sz[oz[i]].index = i;
35 }
36
37 offset(sz, oz);
38 return sz;
39 }
40
41 stack.keys = function(_) {
42 return arguments.length ? (keys = typeof _ === "function" ? _ : constant(Array.from(_)), stack) : keys;

Callers 1

stack-test.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected