legendDiscrete: a key of named colours
Final regular-season game
WonLost
| Team | Qb | Week 18 |
|---|---|---|
![]() | Patrick Mahomes | L |
![]() | Justin Herbert | W |
![]() | Bo Nix | W |
![]() | Gardner Minshew | L |
![]() | Josh Allen | L |
![]() | Tua Tagovailoa | L |
![]() | Aaron Rodgers | W |
![]() | Drake Maye | W |
import { STANDINGS, type Standing } from "@sportsdataverse/examples/data";
import { defineTable } from "@sportsdataverse/sdvtables";
import { renderHTMLAsync } from "@sportsdataverse/sdvtables/html";
const spec = defineTable<Standing>()
.columns((c) => [
c.logo("team", { league: "nfl" }),
c.text("qb"),
c.colorResults("result_last", { label: "Week 18" }),
])
.legendDiscrete({ Won: "#5DA271", Lost: "#C84630" }, { heading: "Final regular-season game" })
.title("AFC, 2024")
.build();
await renderHTMLAsync(spec, STANDINGS);
Tags: decoration · legendDiscrete · gt_legend_discrete · gt_centered_legend. All sdvtables examples.







