Skip to main content

Function: headshotIcons()

headshotIcons<T>(league, players, o?): UnovisIcons<T>

Defined in: packages/sdvplot/src/unovis.ts:259

ESPN player headshots for a Unovis Graph's nodes, as logoIcons: nodeIcon: (n) => heads(n.player), with the container's svgDefs: heads.svgDefs. A gsis id with no headshot has no icon, with one warning; an ESPN id's URL is built without checking the image exists, so an id ESPN has no photo for keeps an empty icon, with no warning.

Type Parameters​

T​

T

Parameters​

league​

"cfb" | "mbb" | "mlb" | "nba" | "nfl" | "nhl" | "wbb" | "wnba"

players​

readonly T[]

o?​

UnovisHeadshotOptions = {}

Returns​

UnovisIcons<T>

Example​

import { headshotIcons } from "@sportsdataverse/sdvplot/unovis";

// Patrick Mahomes and Travis Kelce, by ESPN athlete id
const heads = headshotIcons("nfl", [3139477, 15847]);
[heads(3139477), heads.svgDefs.length > 0];