import type { PoolRace, PoolStyle } from "./pool.types.ts"; import type { Chart, ChartOptions } from "./charts.types.ts"; /** One split of a swimmer: the metres it covers, the seconds it took, and its pace. */ export interface SplitRow { /** The distance at which the split ends, in metres of the race. */ distance: number; /** The seconds of the split itself, and the cumulative time at its end. */ seconds: number; cumulative: number; /** Seconds per 100 m. */ pace: number; } /** What a swimmer's splits come to. */ export interface SwimmerSplits { lane: number; name: string; splits: SplitRow[]; } /** The numbers behind a splits chart. */ export interface SplitsTotals { swimmers: number; /** The metres of the race and the metres between splits. */ distance: number; splitEvery: number; /** The swimmers' splits, in the order down the pool. */ rows: SwimmerSplits[]; /** The fastest split of the field: whose it is, which one (from 1) and its pace; undefined with no splits. */ fastest: { lane: number; name: string; split: number; seconds: number; pace: number; } | undefined; slowest: { lane: number; name: string; split: number; seconds: number; pace: number; } | undefined; } /** What a splits chart takes beyond a chart's own options. */ export interface SplitsOptions extends ChartOptions { /** The pool: the course (`short` for 25 m), the lanes, the look of the water and the deck. */ pool?: Omit; /** Write each bar's time on it. On by default. */ labels?: boolean; } /** * The splits of a race as a chart: pace bars in the lanes of a pool (`pool.race.pace`), a title, a sentence that sums it up, the numbers (`totals`) and an HTML table of every split for a reader who cannot see the * drawing. The splits are cumulative times, one every 50 m (every 25 m in a short course pool) unless the race says another distance. * @example * ```ts * import { splitsChart } from "@johnmorrisdotca/kyogijo-stadiums/charts"; * const chart = splitsChart({ * distance: 100, * swimmers: [ * { lane: 4, name: "A. Swimmer", splits: [25.1, 52.4] }, * { lane: 5, name: "B. Swimmer", splits: [25.6, 52.9] }, * ], * }); * console.log(chart.totals.fastest?.name, chart.totals.fastest?.pace, chart.draw().startsWith(";