Skip to main content

Function: basketballZones()

basketballZones(league?, o?): readonly BasketballZoneArea[]

Defined in: packages/sporty/src/basketball/zones.ts:131

The six zones as fillable rings, cut at depth top (default the half-court line). Rings and labels are basket-centred, like basketballZoneOf's input: the hoop at the origin, y toward half court, in the league's units times scale. They are not in a surface frame, so map every point through the SAME frame as the shots before drawing. For stats.nba.com legacy shots in the hoop-at-the-bottom chart, build them with scale: 10 and map each point [x, y] through FRAMES["nba-legacy-vertical"] (f.x({ x, y }), f.y({ x, y })), which gives [x / 10, y / 10 - 41.75]: feet, with the hoop moved to (0, -41.75). Unmapped, the zones miss the shots by that hoop offset. Port of blazing-the-nets main lib/data/court.ts:141-175.

Parameters​

league?​

"custom" | "ncaa" | "nfhs" | string & object | "fiba" | "nba" | "nba g league" | "wnba"

o?​

Omit<ZoneOptions, "league"> & object = {}

Returns​

readonly BasketballZoneArea[]

Example​

import { BASKETBALL_ZONE_LABELS, basketballZones } from "@sportsdataverse/sporty";

basketballZones("nba", { scale: 10, top: 350 }).map((z) => BASKETBALL_ZONE_LABELS[z.zone]);