Skip to main content

surface(): any sport, any league, as SVG

import { surface } from "@sportsdataverse/sporty";
import { toSVG } from "@sportsdataverse/sporty/svg";

// One entry point for the nine sports; options are typed per sport, so "offense" is checked against basketball.
const court = surface("basketball", "nba", { displayRange: "offense" });

// `arcs: "svg"` writes each circle as an arc command instead of 200 sampled points: same drawing, smaller file.
toSVG(court, { width: 480, arcs: "svg" });

Tags: surface · toSVG · displayRange · basketball · nba. All sporty examples.