bubble: a circle sized and coloured by its value
| Team | Points for | Points against |
|---|---|---|
| KC | 385 | 326 |
| LAC | 402 | 301 |
| DEN | 425 | 311 |
| LV | 309 | 434 |
| BUF | 525 | 368 |
| MIA | 345 | 364 |
| NYJ | 338 | 404 |
| NE | 289 | 417 |
import { STANDINGS, type Standing } from "@sportsdataverse/examples/data";
import { defineTable } from "@sportsdataverse/sdvtables";
import { renderHTMLAsync } from "@sportsdataverse/sdvtables/html";
// reactablefmtr bubble_grid: the circle's width is the value over the column's largest, its colour a ramp over the
// column's range. maxSize shrinks reactablefmtr's 100px to fit a row.
const spec = defineTable<Standing>()
.columns((c) => [
c.text("team"),
c.bubble("pf", { label: "Points for", maxSize: 44 }),
c.bubble("pa", { label: "Points against", maxSize: 44, colors: ["#FA8C00", "#FFFFFF", "#15607A"] }),
])
.title("AFC, 2024")
.build();
await renderHTMLAsync(spec, STANDINGS);
Tags: kind · bubble · bubble_grid · reactablefmtr. All sdvtables examples.