本文へ移動

Taisen Brackets対戦

対戦の一覧から、トーナメント表をSVGで描きます。

対戦(たいせん)は、二者が向かい合って勝負することです。 名前について(英語)

目次

リファレンス · トーナメント表・表・決勝までの道を描く

ResultsBoardOptions型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

What a results board can be told: the width, the look, the icon, the rank style, the name style and case, and the language.

インポート

import type { ResultsBoardOptions } from "@johnmorrisdotca/taisen-brackets";

定義

interface ResultsBoardOptions extends BroadcastOptions, Pick<RankingOptions, "nameStyle"> {
    rankStyle?: "box" | "medal" | "plain";
    precision?: number;
    ties?: boolean;
    nameCase?: "as-is" | "upper";
}

メンバー

名前型説明
rankStyle (省略可)"plain" | "box" | "medal" | undefined

box (the default: a red square, as a broadcast has it), medal (gold, silver and bronze boxes for the first three) or plain (a white numeral).

precision (省略可)number | undefined

Decimals for numeric values where a column names none (3 writes 38.387). Default: as many as the number has, up to three.

ties (省略可)boolean | undefined

Equal results share a rank (1, 2, 2, 4). Default true.

nameCase (省略可)"as-is" | "upper" | undefined

upper writes the names in capitals; as-is (the default) leaves them as given.

width (省略可)number | undefined

The width of the board; the height follows from the rows. Default 1280, from 320 to 4000.

look (省略可)BroadcastLook | undefined

blue (the default), night or paper.

icon (省略可)BroadcastIcon | undefined

The icon in the square at the left of the title: medal (the default), stopwatch, none, or an iconMark of your own.

iconMark (省略可)string | undefined

A mark of your own for that square (inline SVG or an image address), in place of icon.

flags (省略可)FlagRenderer | undefined

Draws a flag from its code, as for drawBracket; it is asked for the shape rect (Hata's "4:3").

flagHref (省略可)((code: string) => string | null | undefined) | undefined

The address of a flag as a picture to load, tried where flags gives none.

locale (省略可)string | Locale | undefined
words (省略可)Partial<Words> | undefined
title (省略可)string | undefined

The <title> of the drawing. Default: the board's own heading.

id (省略可)string | undefined
className (省略可)string | undefined
nameStyle (省略可)"surname-first" | "given-first" | "as-is" | undefined

surname-first (the default: SURNAME Given), given-first (Given SURNAME) or as-is, for a name given in two parts.

例

import { resultsBoard, type ResultsBoardOptions } from "@johnmorrisdotca/taisen-brackets";

const options: ResultsBoardOptions = { width: 960, look: "night", rankStyle: "medal", nameCase: "upper" };
console.log(resultsBoard({
  title: "Men's 100m butterfly",
  phase: "Results · Final",
  columns: [{ precision: 2 }],
  rows: [
    { code: "USA", flag: "US", name: "Michael Phillips", values: [50.58], record: "OR" },
    { code: "HUN", flag: "HU", name: "Laszlo Czigany", values: [50.59] },
  ],
}, options).startsWith("<svg"));
true

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/taisen-brackets 0.20.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。