MCPcopy Create free account
hub / github.com/idank/explainshell / stack

Function stack

explainshell/web/static/js/d3.v3.js:5575–5596  ·  view source on GitHub ↗
(data, index)

Source from the content-addressed store, hash-verified

5573 d3.layout.stack = function() {
5574 var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY;
5575 function stack(data, index) {
5576 var series = data.map(function(d, i) {
5577 return values.call(stack, d, i);
5578 });
5579 var points = series.map(function(d) {
5580 return d.map(function(v, i) {
5581 return [ x.call(stack, v, i), y.call(stack, v, i) ];
5582 });
5583 });
5584 var orders = order.call(stack, points, index);
5585 series = d3.permute(series, orders);
5586 points = d3.permute(points, orders);
5587 var offsets = offset.call(stack, points, index);
5588 var n = series.length, m = series[0].length, i, j, o;
5589 for (j = 0; j < m; ++j) {
5590 out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
5591 for (i = 1; i < n; ++i) {
5592 out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);
5593 }
5594 }
5595 return data;
5596 }
5597 stack.values = function(x) {
5598 if (!arguments.length) return values;
5599 values = x;

Callers

nothing calls this directly

Calls 1

callMethod · 0.45

Tested by

no test coverage detected