colorPills: values in pills coloured on a scale
| Team | Net EPA/play |
|---|---|
| KC | 0.063 |
| LAC | 0.101 |
| DEN | 0.108 |
| LV | -0.146 |
| BUF | 0.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.