Skip to main content

dataBar: a bar per value, in each team's colour, with its logo

AFC, 2024
TeamWins
KC
15
Kansas City Chiefs
LAC
11
Los Angeles Chargers
DEN
10
Denver Broncos
LV
4
Las Vegas Raiders
BUF
13
Buffalo Bills
MIA
8
Miami Dolphins
NYJ
5
New York Jets
NE
4
New England Patriots
import { STANDINGS, type Standing } from "@sportsdataverse/examples/data";
import { defineTable } from "@sportsdataverse/sdvtables";
import { renderHTMLAsync } from "@sportsdataverse/sdvtables/html";

// reactablefmtr data_bars: the bar's length is wins over the most wins; team + league fill it in the team's colour
// (colorRef would read a colour column instead), and the value sits inside the bar's end in black or white.
const spec = defineTable<Standing>()
.columns((c) => [
c.text("team"),
c.dataBar("wins", {
label: "Wins",
team: "team",
league: "nfl",
mark: "logo",
roundEdges: true,
width: "260px",
}),
])
.title("AFC, 2024")
.build();
await renderHTMLAsync(spec, STANDINGS);

Tags: kind · dataBar · data_bars · reactablefmtr · nfl. All sdvtables examples.