Skip to main content

Function: vsLeague()

vsLeague(player, league): DistanceVsLeague[]

Defined in: packages/sdvplot/src/shots/distance.ts:80

Pair player and league distance bins (same binFt and maxFt, else InputError) and take the difference (aggregate.ts:200-209).

Parameters​

player​

readonly DistanceBin[]

league​

readonly DistanceBin[]

Returns​

DistanceVsLeague[]

Example​

import { fgPctByDistance, vsLeague } from "@sportsdataverse/sdvplot/shots";

// Brooklyn shots from the sportsdataverse-data nba_stats_shots release, 2025-26
const made = { x_legacy: 0, y_legacy: 0, shot_distance: 0, shot_value: 2, shot_result: "Made" };
const missed = { ...made, shot_result: "Missed" };
vsLeague(fgPctByDistance([made]), fgPctByDistance([made, missed]))[0];