Skip to content

movingSpan

The points averaged at index i of the ordered x values xs when each average spans a stretch of x, as [start, end] indices (inclusive), or null when the stretch has no length. A trailing stretch runs from just after span(x) up to x; a centered one is as long and centered on x, from just after its start up to its end. A stretch reaching past the first or last x holds the points it covers so far.

Parameters

import {movingSpan} from "@d3plus/math";
xsrequiredArray.<number>

The x values, in ascending order.

irequirednumber

The point's index.

spanrequiredFunction

Returns where the stretch ending at an x starts.

centerbooleanDefault false

Whether the stretch is centered on the point.