Skip to main content

withPatterns

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

await loadLeague("nfl");
const logos = logoDots([{ team: "KC", pf: 385, pa: 326 }], { x: "pf", y: "pa", team: "team", league: "nfl" });
// renderChartSvg from "@tanstack/charts/svg"; here a stand-in that returns an empty chart
const renderChartSvg = (_scene: unknown, _o: { idPrefix?: string }) => '<svg class="ts-chart"></svg>';
withPatterns(renderChartSvg, logos)({}, { idPrefix: "epa" });

Tags: docstring · withPatterns. All sdvplot examples.