Skip to main content

Function: logoMarkers()

logoMarkers(rows, o): LwcSeriesPrimitive

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

Team logos on a Lightweight Charts series: a series primitive (series.attachPrimitive(...)) whose renderer paints each row's logo centred on its x (a time, as in the series' data) and y (a price on the series' scale), placed with the chart's own timeToCoordinate / priceToCoordinate, height of the pane tall (a fraction, as in the spec adapters). Lightweight Charts' series markers draw only shapes and text, so logos take a primitive. The images start loading when it is attached, and the chart redraws as each one lands; building it fetches nothing. A team with no logo draws nothing and warns once, as sdvplot/echarts does; an image that fails to load is never drawn and warns once; a row at a time the chart has no point for, or off the pane, is not drawn.

Parameters​

rows​

readonly Row[]

o​

LogoMarkersOptions

Returns​

LwcSeriesPrimitive

Example​

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

await loadLeague("nfl");
// Super Bowl LIX's final reading (ESPN): 3600 seconds played, Philadelphia's win probability 1
const rows = [{ t: 3600, wp: 1, team: "PHI" }];
const logos = logoMarkers(rows, { x: "t", y: "wp", team: "team", league: "nfl", units: "probability" });
// in the browser: series.attachPrimitive(logos)
typeof logos.paneViews;