Which features a renderer draws: isVisiblePolygon
{
"baseball little league": "14 of 14 polygons drawn",
"basketball fiba": "60 of 64 polygons drawn",
"curling curling canada": "30 of 30 polygons drawn",
"football cfl": "444 of 496 polygons drawn",
"hockey ahl": "63 of 63 polygons drawn",
"lacrosse ncaam": "73 of 73 polygons drawn",
"soccer epl": "35 of 35 polygons drawn",
"tennis atp": "23 of 23 polygons drawn",
"volleyball fivb": "39 of 39 polygons drawn"
}import { SPORTS, leagues, surface } from "@sportsdataverse/sporty";
import { isVisiblePolygon } from "@sportsdataverse/sporty/plot";
// A feature with a transparent fill and no stroke (or no finite points) is skipped by every renderer.
// isVisiblePolygon is that rule, for code that draws a scene itself.
Object.fromEntries(
SPORTS.map((sport) => {
const league = leagues(sport).find((l) => l !== "custom") ?? "";
const polygons = surface(sport, league).features.filter((f) => f.kind === "polygon");
const drawn = polygons.filter(isVisiblePolygon).length;
return [`${sport} ${league}`, `${drawn} of ${polygons.length} polygons drawn`];
}),
);
Tags: plot · isVisiblePolygon. All sporty examples.