Skip to main content

Function: fgPctByDistance()

fgPctByDistance(shots, binFt?, maxFt?): DistanceBin[]

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

FG% by shot_distance in binFt bins from 0 to maxFt; longer attempts are left out (aggregate.ts:177-192). The total within maxFt is the sum of attempts. binFt and maxFt must be finite numbers above 0 (else InputError).

Parameters​

shots​

readonly ShotRow[]

binFt?​

number = 1

maxFt?​

number = 35

Returns​

DistanceBin[]

Example​

import { fgPctByDistance } 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" },
];
fgPctByDistance(shots, 3)[0];