Skip to main content

Function: logoMark()

logoMark(rows, o): G2ImageMark

Defined in: packages/sdvplot/src/g2.ts:227

Team logos as a G2 image mark: one logo per row, size px tall, centred on the row's (x, y) fields in the view's scales. Put it last in a view's children (G2: chart.options({ type: "view", children: [..., mark] })), or in an Ant Design Charts config's annotations, which reach G2 as they are. A team with no logo draws nothing and warns once.

Parameters​

rows​

readonly Row[]

o​

G2MarkOptions

Returns​

G2ImageMark

Example​

import { loadLeague } from "@sportsdataverse/sdvplot";
import { logoMark } from "@sportsdataverse/sdvplot/g2";

await loadLeague("nfl");
const rows = [
{ team: "KC", pf: 385, pa: 326 },
{ team: "LAC", pf: 402, pa: 301 },
];
// chart.options({ type: "view", data: rows, children: [{ type: "point", encode: { x: "pf", y: "pa" } }, <this>] })
logoMark(rows, { x: "pf", y: "pa", team: "team", league: "nfl", size: 32 });