PitchKit
API Reference@pitchkit/coreFunctions

computeHeatmapBins()

function computeHeatmapBins<T>(layer, dimensions): HeatmapBin[];

Defined in: packages/core/src/heatmap/bins.ts:25

Divides the pitch into a binsX x binsY grid (in provider coordinates) and buckets each datum by point count, or by summed weight if the layer provides one. Pure — knows nothing about pixels/canvas/color, which keeps it independently testable and reusable regardless of render backend, mirroring computePitchGeometry.

Points outside the pitch extent are ignored rather than clamped into an edge bin — they're not part of the pitch's heat distribution. Points exactly on the far edge (x === length or y === width) land in the last bin rather than being dropped.

Type Parameters

Type Parameter
T

Parameters

ParameterType
layerHeatmapLayer<T>
dimensionsPitchDimensions

Returns

HeatmapBin[]

On this page