Skip to main content

Function: axisLogos()

axisLogos(o): G2AxisLabels

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

Team logos as a horizontal band axis' labels (a column chart's axis.x), through G2's labelRender: each label is HTML, the logo size px tall and centred on its tick. Needs @antv/component 2.1.12 or later (G2's axis package, an optional peer): 2.1.11 and earlier lay an HTML label out differently, and each logo would sit half a band left. A category with no logo keeps its text and warns once. G2 lays an HTML label out one band wide along a horizontal axis only; for a vertical axis (a bar chart's, or under transpose) draw a logoMark at the axis' position instead. HTML labels are page elements over the chart, not pixels on its canvas: a toDataURL export leaves them out.

Parameters​

o​

G2AxisOptions

Returns​

G2AxisLabels

Example​

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

await loadLeague("nfl");
// { type: "interval", encode: { x: "team", y: "wins" }, axis: { x: { ...<this>, title: false } } }
axisLogos({ league: "nfl", size: 28 }).labelRender({ label: "KC" });