Function: teamTheme()
teamTheme<
T>(o):T&TeamThemeColors
Defined in: packages/sdvplot/src/victory.ts:113
A Victory theme from team colours (teamColorPalette): the palette as the colorScale of every group, stack, pie
and legend, so each child of a VictoryGroup is drawn in its team's colour, and the first team's colour for a lone
line, area, bar or scatter. Built over base (a Victory theme), whose other keys and styles are kept. Pass it as a
VictoryChart's theme. With background, every colour keeps 3:1 contrast against it and aims to stay distinct from
the others (else the readable colour and one warning); the chart's own background and axis ink are the base theme's to set.
Type Parameters
T
T extends object = Record<never, never>
Parameters
o
Returns
T & TeamThemeColors
Example
import { loadLeague } from "@sportsdataverse/sdvplot";
import { teamTheme } from "@sportsdataverse/sdvplot/victory";
import { VictoryBar, VictoryChart, VictoryGroup, VictoryTheme } from "victory";
await loadLeague("nfl");
const rows = [
{ team: "KC", pf: 385 },
{ team: "BUF", pf: 525 },
];
// each of the group's bars in its team's colour
<VictoryChart
theme={teamTheme({ league: "nfl", teams: rows.map((r) => r.team), base: VictoryTheme.clean })}
domainPadding={60}
>
<VictoryGroup>
{rows.map((r) => (
<VictoryBar key={r.team} data={[r]} x="team" y="pf" />
))}
</VictoryGroup>
</VictoryChart>;