MCPcopy Create free account
hub / github.com/microsoft/SandDance / stackNormalize

Function stackNormalize

docs/tests/v2/es6/js/sanddance.js:111319–111332  ·  view source on GitHub ↗
(group, max, field, y0, y1)

Source from the content-addressed store, hash-verified

111317}
111318
111319function stackNormalize(group, max, field, y0, y1) {
111320 var scale = 1 / group.sum,
111321 last = 0,
111322 m = group.length,
111323 j = 0,
111324 v = 0,
111325 t;
111326
111327 for (; j < m; ++j) {
111328 t = group[j];
111329 t[y0] = last;
111330 t[y1] = last = scale * (v += Math.abs(field(t)));
111331 }
111332}
111333
111334function stackZero(group, max, field, y0, y1) {
111335 var lastPos = 0,

Callers

nothing calls this directly

Calls 1

fieldFunction · 0.50

Tested by

no test coverage detected