Skip to main content

Function: leagueIndex()

leagueIndex(league, cell): LeagueIndex

Defined in: packages/sdvplot/src/shots/aggregate.ts:175

The league index every player chart compares against (aggregate.ts:140-146), on a hexagon radius or any binner lattice; it stores the resolved lattice, so equalArea becomes the square's side.

Parameters​

league​

readonly ShotRow[]

cell​

number | BinnerOptions

Returns​

LeagueIndex

Example​

import { leagueIndex } from "@sportsdataverse/sdvplot/shots";

// Brooklyn shots from the sportsdataverse-data nba_stats_shots release, 2025-26
const shots = [
{ x_legacy: -1, y_legacy: 7, shot_distance: 1, shot_value: 2, shot_result: "Made" },
{ x_legacy: 0, y_legacy: 0, shot_distance: 0, shot_value: 2, shot_result: "Missed" },
{ x_legacy: -44, y_legacy: 252, shot_distance: 26, shot_value: 3, shot_result: "Made" },
];
leagueIndex(shots, 15).cells;