Skip to main content

Function: passArcLayer()

passArcLayer(rows, o): PassArcLayerProps

Defined in: packages/sdvplot/src/deckgl.ts:293

deck.gl ArcLayer props: one arc per row from (x, y) to (xend, yend), in the team's colours: its primary colour at the source and its secondary at the target (which: "secondary" swaps them), so the two ends tell the direction apart where the two colours differ (see background). Each team keeps one colour per end, the teams taken in the order they first appear. With background, every colour keeps 3:1 contrast against it and aims to stay distinct from the other teams' (the shared team palette; when it cannot, it keeps the readable colour and warns once). A team that does not resolve takes fallback, as given (its contrast is not checked); a row with a missing coordinate is left out with one warning.

Parameters​

rows​

readonly Row[]

o​

PassArcOptions

Returns​

PassArcLayerProps

Example​

import { loadLeague } from "@sportsdataverse/sdvplot";
import { passArcLayer } from "@sportsdataverse/sdvplot/deckgl";

await loadLeague("soccer");
// France's first completed pass of the 2018 World Cup final (StatsBomb open data through SPADL, metres from the
// corner); France is ESPN soccer team 478
const pass = { team: "478", start_x: 54.68750000000001, start_y: 6.375, end_x: 56.4375, end_y: 1.2750000000000057 };
const props = passArcLayer([pass], {
x: "start_x",
y: "start_y",
xend: "end_x",
yend: "end_y",
team: "team",
league: "soccer",
idSystem: "team_id",
tilt: 90,
});
// in the browser: new ArcLayer({ ...props, coordinateSystem: "cartesian" })
props.data[0]?.sourceColor;