gridTables by a group column: the Super Bowl LIX teams' seasons, side by side
Before Super Bowl LIX
Every 2024 regular-season game of the two finalists
Kansas City, 15-2
| Wk | Opp. | Score | |
|---|---|---|---|
| 1 | ![]() | 27-20 | W |
| 2 | ![]() | 26-25 | W |
| 3 | ![]() | 22-17 | W |
| 4 | ![]() | 17-10 | W |
| 5 | ![]() | 26-13 | W |
| 7 | ![]() | 28-18 | W |
| 8 | ![]() | 27-20 | W |
| 9 | ![]() | 30-24 | W |
| 10 | ![]() | 16-14 | W |
| 11 | ![]() | 21-30 | L |
| 12 | ![]() | 30-27 | W |
| 13 | ![]() | 19-17 | W |
| 14 | ![]() | 19-17 | W |
| 15 | ![]() | 21-7 | W |
| 16 | ![]() | 27-19 | W |
| 17 | ![]() | 29-10 | W |
| 18 | ![]() | 0-38 | L |
Philadelphia, 14-3
| Wk | Opp. | Score | |
|---|---|---|---|
| 1 | ![]() | 34-29 | W |
| 2 | ![]() | 21-22 | L |
| 3 | ![]() | 15-12 | W |
| 4 | ![]() | 16-33 | L |
| 6 | ![]() | 20-16 | W |
| 7 | ![]() | 28-3 | W |
| 8 | ![]() | 37-17 | W |
| 9 | ![]() | 28-23 | W |
| 10 | ![]() | 34-6 | W |
| 11 | ![]() | 26-18 | W |
| 12 | ![]() | 37-20 | W |
| 13 | ![]() | 24-19 | W |
| 14 | ![]() | 22-16 | W |
| 15 | ![]() | 27-13 | W |
| 16 | ![]() | 33-36 | L |
| 17 | ![]() | 41-7 | W |
| 18 | ![]() | 20-13 | W |
import { KC_PHI_GAMES_2024 } from "@sportsdataverse/examples/data";
import { defineTable } from "@sportsdataverse/sdvtables";
import { gridTables } from "@sportsdataverse/sdvtables/export";
import { prepare } from "@sportsdataverse/sdvtables/html";
// Each game from each team's side, then one table per team: the grouping batchToPNG writes as one file per team,
// laid out here on one page instead.
const games = (team: "KC" | "PHI") =>
KC_PHI_GAMES_2024.filter((g) => g.home_team === team || g.away_team === team).map((g) => {
const home = g.home_team === team;
const pts = home ? g.home_score : g.away_score;
const opp = home ? g.away_score : g.home_score;
return {
week: g.week,
opponent: home ? g.away_team : g.home_team,
score: `${pts}-${opp}`,
result: pts > opp ? "W" : "L",
};
});
const spec = defineTable<ReturnType<typeof games>[number]>()
.columns((c) => [
c.int("week", { label: "Wk" }),
c.logo("opponent", { league: "nfl", label: "Opp." }),
c.text("score", { label: "Score" }),
c.colorResults("result", { label: "" }),
])
.theme("athletic", { density: "compact" })
.build();
await prepare(spec);
// one spec, two tables: each copy gets its own id, so each keeps its own styles
gridTables(
[
{ spec, rows: games("KC") },
{ spec, rows: games("PHI") },
],
{
ncol: 2,
gap: 40,
labels: ["Kansas City, 15-2", "Philadelphia, 14-3"],
title: "Before Super Bowl LIX",
subtitle: "Every 2024 regular-season game of the two finalists",
sourceNote: "Source: nflverse games",
},
);
Tags: node · table · export · gridTables · colorResults · logo · nfl. All sdvtables examples.



















