Skip to main content

colorPills: values in pills coloured on a scale

AFC, 2024
TeamNet EPA/play
KC0.063
LAC0.101
DEN0.108
LV-0.146
BUF0.190
MIA-0.019
NYJ-0.045
NE
import { STANDINGS, type Standing } from "@sportsdataverse/examples/data";
import { defineTable } from "@sportsdataverse/sdvtables";
import { renderHTMLAsync } from "@sportsdataverse/sdvtables/html";

// A domain fixes the scale so tables can be compared; without one the pills span the observed range and warn.
const spec = defineTable<Standing>()
.columns((c) => [
c.text("team"),
c.colorPills("net_epa", { label: "Net EPA/play", digits: 3, domain: [-0.2, 0.2] }),
])
.title("AFC, 2024")
.build();
await renderHTMLAsync(spec, STANDINGS);

Tags: kind · colorPills · gt_color_pills. All sdvtables examples.