MCPcopy Index your code
hub / github.com/microsoft/SandDance / stackZero

Function stackZero

docs/app/js/sanddance-app.js:130211–130224  ·  view source on GitHub ↗
(group, max, field, y0, y1)

Source from the content-addressed store, hash-verified

130209 }
130210}
130211function stackZero(group, max, field, y0, y1) {
130212 var lastPos = 0, lastNeg = 0, m = group.length, j = 0, v, t;
130213 for(; j < m; ++j){
130214 t = group[j];
130215 v = +field(t);
130216 if (v < 0) {
130217 t[y0] = lastNeg;
130218 t[y1] = lastNeg += v;
130219 } else {
130220 t[y0] = lastPos;
130221 t[y1] = lastPos += v;
130222 }
130223 }
130224}
130225function partition(data, groupby, sort, field) {
130226 var groups = [], get = (f)=>f(t), map, i, n, m, t, k, g, s, max; // partition data points into stack groups
130227 if (groupby == null) groups.push(data.slice());

Callers

nothing calls this directly

Calls 1

fieldFunction · 0.70

Tested by

no test coverage detected