Function: surface()
Call Signature
surface(
sport,league,opts?):Scene
Defined in: packages/sporty/src/api.ts:165
Build a surface scene for any of the nine sports. Options are typed per sport, so a misspelled option, colour key
or display range compiles to an error. A runtime Sport (or a union) goes through the generic overload; an unknown
sport (untyped callers) or league throws UnknownLeagueError.
Parameters
sport
"baseball"
league
"custom" | "little league" | "milb" | "mlb" | "ncaa" | "nfhs" | "pony" | string & object
opts?
SurfaceOptions<BaseballParamUpdates, "infield_dirt" | "infield_grass" | "pitchers_mound" | "base" | "pitchers_plate" | "batters_box" | "catchers_box" | "foul_line" | "running_lane" | "plot_background", "full" | "infield">
Returns
Example
import { surface } from "@sportsdataverse/sporty";
import { toSVG } from "@sportsdataverse/sporty/svg";
const rink = surface("hockey", "nhl", { displayRange: "offense" });
toSVG(rink, { width: 480, precision: 2, arcs: "svg" });
Call Signature
surface(
sport,league,opts?):Scene
Defined in: packages/sporty/src/api.ts:170
Build a surface scene for any of the nine sports. Options are typed per sport, so a misspelled option, colour key
or display range compiles to an error. A runtime Sport (or a union) goes through the generic overload; an unknown
sport (untyped callers) or league throws UnknownLeagueError.
Parameters
sport
"basketball"
league
"custom" | "ncaa" | "nfhs" | string & object | "fiba" | "nba" | "nba g league" | "wnba"
opts?
SurfaceOptions<BasketballParamUpdates, "plot_background" | "court_apron" | "center_circle_outline" | "center_circle_fill" | "division_line" | "endline" | "sideline" | "two_point_range" | "three_point_line" | "painted_area" | "lane_space_mark" | "free_throw_circle_fill" | "free_throw_circle_dash" | "restricted_arc" | "inbounding_line" | "substitution_line" | "team_bench_line" | "backboard" | "basket_ring" | "net" | "offensive_half_court" | "defensive_half_court" | "lane_boundary" | "free_throw_circle_outline" | "baseline_lower_defensive_box" | "lane_lower_defensive_box", "full" | "in_bounds_only" | "in bounds only" | "offense" | "offence" | "offensivehalfcourt" | "offensive_half_court" | "offensive half court" | "defense" | "defence" | "defensivehalfcourt" | "defensive_half_court" | "defensive half court" | "offensivekey" | "offensive_key" | "offensive key" | "attackingkey" | "attacking_key" | "attacking key" | "defensivekey" | "defensive_key" | "defensive key" | "defendingkey" | "defending_key" | "defending key" | "offensivepaint" | "offensive_paint" | "offensive paint" | "attackingpaint" | "attacking_paint" | "attacking paint" | "offensivelane" | "offensive_lane" | "offensive lane" | "attackinglane" | "attacking_lane" | "attacking lane" | "defensivepaint" | "defensive_paint" | "defensive paint" | "defendingpaint" | "defending_paint" | "defending paint" | "defensivelane" | "defensive_lane" | "defensive lane" | "defendinglane" | "defending_lane" | "defending lane">
Returns
Example
import { surface } from "@sportsdataverse/sporty";
import { toSVG } from "@sportsdataverse/sporty/svg";
const rink = surface("hockey", "nhl", { displayRange: "offense" });
toSVG(rink, { width: 480, precision: 2, arcs: "svg" });
Call Signature
surface(
sport,league,opts?):Scene
Defined in: packages/sporty/src/api.ts:175
Build a surface scene for any of the nine sports. Options are typed per sport, so a misspelled option, colour key
or display range compiles to an error. A runtime Sport (or a union) goes through the generic overload; an unknown
sport (untyped callers) or league throws UnknownLeagueError.
Parameters
sport
"curling"
league
"custom" | string & object | "curling canada" | "wcf"
opts?
SurfaceOptions<CurlingParamUpdates, "plot_background" | "sheet_apron" | "centre_zone" | "button" | "tee_line" | "back_line" | "hog_line" | "centre_line" | "hack_line" | "courtesy_line" | "end_1" | "end_2" | "hack" | "house_rings", "full" | "in_bounds_only" | "in bounds only" | "house">
Returns
Example
import { surface } from "@sportsdataverse/sporty";
import { toSVG } from "@sportsdataverse/sporty/svg";
const rink = surface("hockey", "nhl", { displayRange: "offense" });
toSVG(rink, { width: 480, precision: 2, arcs: "svg" });
Call Signature
surface(
sport,league,opts?):Scene
Defined in: packages/sporty/src/api.ts:180
Build a surface scene for any of the nine sports. Options are typed per sport, so a misspelled option, colour key
or display range compiles to an error. A runtime Sport (or a union) goes through the generic overload; an unknown
sport (untyped callers) or league throws UnknownLeagueError.
Parameters
sport
"football"
league
"custom" | "ncaa" | string & object | "cfl" | "nfhs11" | "nfhs6" | "nfhs8" | "nfhs9" | "nfl"
opts?
SurfaceOptions<FootballParamUpdates, "plot_background" | "sideline" | "field_apron" | "end_line" | "field_border" | "field_border_outline" | "red_zone_border" | "red_zone_border_outline" | "goal_line" | "major_yard_line" | "minor_yard_line" | "try_mark" | "coaching_box_line" | "directional_arrow" | "restricted_area" | "coaching_box" | "team_bench_area" | "team_bench_area_outline" | "yardage_marker" | "offensive_half" | "defensive_half" | "offensive_endzone" | "defensive_endzone", "full" | "in_bounds_only" | "in bounds only" | "offense" | "offence" | "defense" | "defence" | "offensivehalffield" | "offensive_half_field" | "offensive half field" | "defensivehalffield" | "defensive_half_field" | "defensive half field" | "redzone" | "red_zone" | "red zone" | "oredzone" | "offensive_red_zone" | "offensive red zone" | "dredzone" | "defensive_red_zone" | "defensive red zone">
Returns
Example
import { surface } from "@sportsdataverse/sporty";
import { toSVG } from "@sportsdataverse/sporty/svg";
const rink = surface("hockey", "nhl", { displayRange: "offense" });
toSVG(rink, { width: 480, precision: 2, arcs: "svg" });
Call Signature
surface(
sport,league,opts?):Scene
Defined in: packages/sporty/src/api.ts:185
Build a surface scene for any of the nine sports. Options are typed per sport, so a misspelled option, colour key
or display range compiles to an error. A runtime Sport (or a union) goes through the generic overload; an unknown
sport (untyped callers) or league throws UnknownLeagueError.
Parameters
sport
"hockey"
league
"custom" | "ncaa" | string & object | "ahl" | "echl" | "iihf" | "nhl" | "nwhl" | "ohl" | "phf" | "pwhl" | "qmjhl" | "ushl"
opts?
SurfaceOptions<HockeyParamUpdates, "plot_background" | "goal_line" | "boards" | "center_line" | "referee_crease" | "zone_line" | "center_faceoff_spot" | "goal_crease_outline" | "goal_crease_fill" | "center_faceoff_circle" | "odzone_faceoff_circle" | "goal_frame" | "off_ice_officials_box" | "ozone_ice" | "nzone_ice" | "dzone_ice" | "restricted_trapezoid" | "faceoff_spot_ring" | "faceoff_spot_stripe" | "faceoff_line" | "goal_fill" | "team_a_bench" | "team_b_bench" | "team_a_penalty_box" | "team_b_penalty_box", "full" | "in_bounds_only" | "in bounds only" | "offense" | "offence" | "defense" | "defence" | "defensive_zone" | "neutral_zone" | "offensive_zone" | "nzone" | "neutral" | "neutral zone" | "ozone" | "offensive zone" | "attacking_zone" | "attacking zone" | "dzone" | "defensive zone" | "defending_zone" | "defending zone">
Returns
Example
import { surface } from "@sportsdataverse/sporty";
import { toSVG } from "@sportsdataverse/sporty/svg";
const rink = surface("hockey", "nhl", { displayRange: "offense" });
toSVG(rink, { width: 480, precision: 2, arcs: "svg" });
Call Signature
surface(
sport,league,opts?):Scene
Defined in: packages/sporty/src/api.ts:190
Build a surface scene for any of the nine sports. Options are typed per sport, so a misspelled option, colour key
or display range compiles to an error. A runtime Sport (or a union) goes through the generic overload; an unknown
sport (untyped callers) or league throws UnknownLeagueError.
Parameters
sport
"lacrosse"
league
"custom" | string & object | "ncaam" | "ncaaw" | "nll" | "pll" | "usam" | "usaw" | "world lacrosse"
opts?
SurfaceOptions<LacrosseParamUpdates, "plot_background" | "sideline" | "field_apron" | "end_line" | "goal_line" | "defensive_zone" | "neutral_zone" | "offensive_zone" | "boards" | "center_line" | "referee_crease" | "goal_frame" | "team_a_bench" | "team_b_bench" | "team_a_penalty_box" | "team_b_penalty_box" | "referee_crease_fill" | "change_area_outline" | "change_area_fill" | "off_field_officials_box" | "wing_line" | "restraining_line" | "defensive_area_line" | "center_circle" | "goal_circle_fill" | "goal_circle" | "goal_arc" | "goal_fan" | "goal_fan_hash_mark" | "goal_mouth" | "goal_mouth_hash_mark" | "below_goal_marking" | "goal_net" | "center_face_off_marker" | "corner_face_off_marker", "full" | "in_bounds_only" | "in bounds only" | "offense" | "offence" | "defense" | "defence" | "offensivehalffield" | "offensive_half_field" | "offensive half field" | "defensivehalffield" | "defensive_half_field" | "defensive half field">
Returns
Example
import { surface } from "@sportsdataverse/sporty";
import { toSVG } from "@sportsdataverse/sporty/svg";
const rink = surface("hockey", "nhl", { displayRange: "offense" });
toSVG(rink, { width: 480, precision: 2, arcs: "svg" });
Call Signature
surface(
sport,league,opts?):Scene
Defined in: packages/sporty/src/api.ts:195
Build a surface scene for any of the nine sports. Options are typed per sport, so a misspelled option, colour key
or display range compiles to an error. A runtime Sport (or a union) goes through the generic overload; an unknown
sport (untyped callers) or league throws UnknownLeagueError.
Parameters
sport
"soccer"
league
"custom" | "ncaa" | string & object | "epl" | "fifa" | "mls" | "nwsl"
opts?
SurfaceOptions<SoccerParamUpdates, "plot_background" | "goal_line" | "center_circle" | "pitch_apron" | "touchline" | "corner_arc" | "halfway_line" | "penalty_box" | "goal_box" | "penalty_mark" | "center_mark" | "goal" | "offensive_half_pitch" | "defensive_half_pitch" | "corner_defensive_mark", "full" | "in_bounds_only" | "in bounds only" | "offense" | "offence" | "defense" | "defence" | "offensivehalfpitch" | "offensive_half_pitch" | "offensive half pitch" | "defensivehalfpitch" | "defensive_half_pitch" | "defensive half pitch">
Returns
Example
import { surface } from "@sportsdataverse/sporty";
import { toSVG } from "@sportsdataverse/sporty/svg";
const rink = surface("hockey", "nhl", { displayRange: "offense" });
toSVG(rink, { width: 480, precision: 2, arcs: "svg" });
Call Signature
surface(
sport,league,opts?):Scene
Defined in: packages/sporty/src/api.ts:200
Build a surface scene for any of the nine sports. Options are typed per sport, so a misspelled option, colour key
or display range compiles to an error. A runtime Sport (or a union) goes through the generic overload; an unknown
sport (untyped callers) or league throws UnknownLeagueError.
Parameters
sport
"tennis"
league
"custom" | "ncaa" | string & object | "atp" | "ita" | "itf" | "usta" | "wta"
opts?
SurfaceOptions<TennisParamUpdates, "plot_background" | "court_apron" | "net" | "center_mark" | "doubles_alley" | "backcourt" | "baseline" | "serviceline" | "center_serviceline" | "singles_sideline" | "doubles_sideline" | "ad_court" | "deuce_court", "full" | "in_bounds_only" | "in bounds only" | "serve" | "serving" | "servicehalf" | "service_half" | "service half" | "servinghalf" | "serving_half" | "serving half" | "receive" | "receiving" | "receivicehalf" | "receivice_half" | "receivice half" | "receivinghalf" | "receiving_half" | "receiving half" | "receivehalf" | "receive_half" | "receive half">
Returns
Example
import { surface } from "@sportsdataverse/sporty";
import { toSVG } from "@sportsdataverse/sporty/svg";
const rink = surface("hockey", "nhl", { displayRange: "offense" });
toSVG(rink, { width: 480, precision: 2, arcs: "svg" });
Call Signature
surface(
sport,league,opts?):Scene
Defined in: packages/sporty/src/api.ts:205
Build a surface scene for any of the nine sports. Options are typed per sport, so a misspelled option, colour key
or display range compiles to an error. A runtime Sport (or a union) goes through the generic overload; an unknown
sport (untyped callers) or league throws UnknownLeagueError.
Parameters
sport
"volleyball"
league
"custom" | "ncaa" | string & object | "fivb" | "usa volleyball"
opts?
SurfaceOptions<VolleyballParamUpdates, "plot_background" | "court_apron" | "sideline" | "end_line" | "center_line" | "free_zone" | "front_zone" | "service_zone_mark" | "attack_line" | "defensive_backcourt" | "offensive_backcourt" | "substitution_zone", "full" | "in_bounds_only" | "in bounds only" | "offense" | "offence" | "offensivehalfcourt" | "offensive_half_court" | "offensive half court" | "defense" | "defence" | "defensivehalfcourt" | "defensive_half_court" | "defensive half court">
Returns
Example
import { surface } from "@sportsdataverse/sporty";
import { toSVG } from "@sportsdataverse/sporty/svg";
const rink = surface("hockey", "nhl", { displayRange: "offense" });
toSVG(rink, { width: 480, precision: 2, arcs: "svg" });
Call Signature
surface<
S>(sport,league,opts?):Scene
Defined in: packages/sporty/src/api.ts:210
Build a surface scene for any of the nine sports. Options are typed per sport, so a misspelled option, colour key
or display range compiles to an error. A runtime Sport (or a union) goes through the generic overload; an unknown
sport (untyped callers) or league throws UnknownLeagueError.
Type Parameters
S
S extends Sport
Parameters
sport
S
league
LeagueOf<S>
opts?
OptionsOf<S>
Returns
Example
import { surface } from "@sportsdataverse/sporty";
import { toSVG } from "@sportsdataverse/sporty/svg";
const rink = surface("hockey", "nhl", { displayRange: "offense" });
toSVG(rink, { width: 480, precision: 2, arcs: "svg" });