Function: perspectiveLogoColumn()
perspectiveLogoColumn<
R>(rows,teamCol,o):R&Record<string,string|null>[]
Defined in: packages/sdvplot/src/perspective.ts:370
The rows with a column of each team's logo URL, right after the team column, as Python's perspective_logo_column
adds it. Each distinct team is resolved once. A team that does not resolve, or has no archived logo, gets a null URL,
with one warning for each reason. Show the column as links with perspectiveConfig(rows, { logoCol }): Perspective
5.5's Datagrid draws no images. The rows given are not changed.
Type Parameters
R
R extends Readonly<Record<string, unknown>>
Parameters
rows
readonly R[]
teamCol
string
o
Returns
R & Record<string, string | null>[]
new rows, each with the URL (a string, or null) in name.
Throws
InputError for a teamCol no row has, a name a row already has, or a season outside the league's.
UnresolvedTeamError with strict: true.
Example
import { loadLeague } from "@sportsdataverse/sdvplot";
import { perspectiveConfig, perspectiveLogoColumn } from "@sportsdataverse/sdvplot/perspective";
await loadLeague("nfl");
const epa = [
{ posteam: "BAL", epa_per_play: 0.218 },
{ posteam: "BUF", epa_per_play: 0.1885 },
];
const rows = perspectiveLogoColumn(epa, "posteam", { league: "nfl" });
const config = perspectiveConfig(rows, { teamCol: "posteam", league: "nfl", logoCol: "posteam_logo" });
[Object.keys(rows[0] ?? {}), config.columns_config.posteam_logo];