delta: the change from one column to another
| Team | PF | Point diff. |
|---|---|---|
| KC | 385 | ▲ 59 |
| LAC | 402 | ▲ 101 |
| DEN | 425 | ▲ 114 |
| LV | 309 | ▼ 125 |
| BUF | 525 | ▲ 157 |
| MIA | 345 | ▼ 19 |
| NYJ | 338 | ▼ 66 |
| NE | 289 | ▼ 128 |
import { STANDINGS, type Standing } from "@sportsdataverse/examples/data";
import { defineTable } from "@sportsdataverse/sdvtables";
import { renderHTMLAsync } from "@sportsdataverse/sdvtables/html";
// delta(from, to) shows to - from: here points for minus points against, green up and red down.
const spec = defineTable<Standing>()
.columns((c) => [
c.text("team"),
c.int("pf", { label: "PF" }),
c.delta("pa", "pf", { label: "Point diff.", decimals: 0, arrows: true }),
])
.title("AFC, 2024")
.build();
await renderHTMLAsync(spec, STANDINGS);
Tags: kind · delta · gt_delta. All sdvtables examples.