Skip to main content

Function: logoDots()

logoDots<R, X, Y>(rows, o): TanstackImageDot<R, X, Y>[]

Defined in: packages/sdvplot/src/tanstack.ts:278

Team logos as TanStack dot marks, one per logo, each filled with its logo: every row's logo is size px tall, centred on the row's (x, y) fields in the chart's scales, and uncut (the dot's radius is the logo box's half-diagonal). Map them to marks with TanStack's dot, and pass the chart a withPatterns serializer so the patterns are in its SVG. A team with no logo draws nothing and warns once. The dots keep TanStack's focus, tooltip and keyboard navigation; each datum is the caller's row (plus sdv_* fields).

Type Parameters​

R​

R extends object

X​

X extends string

Y​

Y extends string

Parameters​

rows​

readonly R[]

o​

TanstackDotOptions<X, Y>

Returns​

TanstackImageDot<R, X, Y>[]

Example​

import { loadLeague } from "@sportsdataverse/sdvplot";
import { logoDots } from "@sportsdataverse/sdvplot/tanstack";

await loadLeague("nfl");
const rows = [
{ team: "KC", pf: 385, pa: 326 },
{ team: "LAC", pf: 402, pa: 301 },
];
const logos = logoDots(rows, { x: "pf", y: "pa", team: "team", league: "nfl", size: 32 });
// defineChart({ marks: logos.map((d) => dot(d.data, d.options)), ... }) and
// mountChart(el, { definition, renderSvg: withPatterns(renderChartSvg, logos), ... })
logos.map((d) => d.options);