colorRanks: color_tiles options (span, bias, evenBreaks, showText)
| Team | PF | PA | SRS rank | Wins |
|---|---|---|---|---|
| KC | 385 | 326 | 10 | 15 |
| LAC | 402 | 301 | 9 | 11 |
| DEN | 425 | 311 | 8 | 10 |
| LV | 309 | 434 | 26 | 4 |
| BUF | 525 | 368 | 4 | 13 |
| MIA | 345 | 364 | 21 | 8 |
| NYJ | 338 | 404 | 24 | 5 |
| NE | 289 | 417 | 29 | 4 |
import { STANDINGS, type Standing } from "@sportsdataverse/examples/data";
import { defineTable } from "@sportsdataverse/sdvtables";
import { renderHTMLAsync } from "@sportsdataverse/sdvtables/html";
// span puts points for and against on one scale; bias spreads the high end; evenBreaks deals the palette out in
// equal-count buckets; showText: false keeps only the colour.
const spec = defineTable<Standing>()
.columns((c) => [
c.text("team"),
c.colorRanks("pf", { label: "PF", span: ["pf", "pa"], bias: 1.5, palette: ["#FFFFFF", "#15607A"] }),
c.colorRanks("pa", { label: "PA", span: ["pf", "pa"], bias: 1.5, palette: ["#FFFFFF", "#15607A"] }),
c.colorRanks("srs_rank", { label: "SRS rank", evenBreaks: true }),
c.colorRanks("wins", { label: "Wins", showText: false, reverse: true }),
])
.title("AFC, 2024")
.build();
await renderHTMLAsync(spec, STANDINGS);
Tags: formatter · colorRanks · color_tiles · color_scales · reactablefmtr. All sdvtables examples.