Skip to main content

Function: logoMark()

logoMark(o): MuiMarkSlot

Defined in: packages/sdvplot/src/mui.ts:451

Team logos as a line's marks: <LineChart slots={{ mark: logoMark({ league }) }}>. Each mark is drawn as its series' team logo, size px tall and centred on the point: the series' id is the team (or give teams, series id to team). Which points get a mark is the series' showMark: ({ index }) => index === last puts one logo at the end of each line. A team with no logo draws nothing and warns once. Build it once (module scope or useMemo).

Parameters​

o​

MuiMarkOptions

Returns​

MuiMarkSlot

Example​

import { LineChart } from "@mui/x-charts/LineChart";
import { loadLeague } from "@sportsdataverse/sdvplot";
import { logoMark } from "@sportsdataverse/sdvplot/mui";

await loadLeague("nfl");
const end = ({ index }: { index: number }) => index === 2; // the last of three points
<LineChart
width={400}
height={240}
xAxis={[{ data: [1, 2, 3] }]}
series={[
{ id: "KC", data: [1, 2, 3], showMark: end },
{ id: "DEN", data: [0, 1, 2], showMark: end },
]}
slots={{ mark: logoMark({ league: "nfl", size: 28 }) }}
/>;