Skip to main content

Function: teamSeriesOptions()

teamSeriesOptions(team, o): LwcTeamSeriesOptions

Defined in: packages/sdvplot/src/lightweight-charts.ts:195

A LineSeries' options in a team's colour, for chart.addSeries(LineSeries, ...). With units, the prices read as probabilities ("58.5%") or American odds ("+150", "-120") on the price scale, the crosshair and the last-value line. With background, the colour keeps 3:1 contrast against it and aims to stay distinct from the other teams on the chart (when it cannot, it keeps the readable colour and warns once). A team that does not resolve takes fallback and warns; it never moves a real team's colour.

Parameters​

team​

Value

o​

TeamSeriesOptions

Returns​

LwcTeamSeriesOptions

Example​

import { loadLeague } from "@sportsdataverse/sdvplot";
import { teamSeriesOptions } from "@sportsdataverse/sdvplot/lightweight-charts";

await loadLeague("nfl");
const teams = ["PHI", "KC"];
const phi = teamSeriesOptions("PHI", { league: "nfl", teams, units: "probability", background: "#181a1b" });
// in the browser: chart.addSeries(LineSeries, phi)
[phi.color, phi.priceFormat?.formatter(0.5846)];