Skip to main content

Function: teamStylesheet()

teamStylesheet(o): StyleBlock[]

Defined in: packages/sdvplot/src/cytoscape.ts:181

A Cytoscape stylesheet that draws elements in team colours: a node whose data.team is a team's id is filled with its colour (a headshot node shows the colour as its border), its initials in the ink that reads on it, and an edge with that data.team is stroked in it, arrow included. The base blocks draw passNetwork's elements: node size, headshot nodes (data.image as the background, the name below), initials nodes, directed bezier edges as wide as data.width px. Elements whose team does not resolve take fallback. data.team holds the resolved team id, as passNetwork writes it; for your own elements, resolve the ids first (or pass idSystem: "team_id").

Parameters​

o​

TeamStylesheetOptions

Returns​

StyleBlock[]

Example​

import { loadLeague } from "@sportsdataverse/sdvplot";
import { teamStylesheet } from "@sportsdataverse/sdvplot/cytoscape";

await loadLeague("nfl");
const style = teamStylesheet({ league: "nfl", teams: ["KC", "PHI"], background: "#181a1b" });
// in the browser: cytoscape({ container, elements, style })
style.length;