Function: withTeamSeries()
withTeamSeries<
F>(opts,rows,o):F
Defined in: packages/sdvplot/src/uplot.ts:209
Team colours for a uPlot chart's series: row i's team strokes series[i + 1] (series 0 is uPlot's x), and with
fill also fills the area under it. The rest of each series is kept and the options are copied, never changed. With
background, every colour keeps 3:1 contrast against it (dark mode) and aims to stay distinct from the others (when
it cannot, it keeps the readable colour and warns once).
Type Parameters
F
F extends object
Parameters
opts
F
rows
readonly Row[]
o
Returns
F
Example
import { loadLeague } from "@sportsdataverse/sdvplot";
import { withTeamSeries } from "@sportsdataverse/sdvplot/uplot";
await loadLeague("nfl");
withTeamSeries(
{ width: 640, height: 320, series: [{}, { label: "Kansas City" }, { label: "Buffalo" }] },
[{ team: "KC" }, { team: "BUF" }],
{ team: "team", league: "nfl", background: "#181a1b" },
);