Skip to the content

Taisen Brackets対戦

Knockout brackets as SVG, from a list of ties.

Taisen (対戦, たいせん) is Japanese for a matchup: two sides facing each other. About the name

Contents

Reference · Draw a bracket, a table or a road to the final

boutBoardfunction

The bout presentation board as a standalone SVG. Throws a RangeError for a board with no title, an athlete or official with no name, more than 12 officials, a role that is not a text, an unknown option value, or a width outside 720 to 4000.

Import it

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

Definition

function boutBoard(source: BoutBoardSource, options?: BoutBoardOptions): string

Parameters

NameTypeDescription
sourceBoutBoardSource

The bout, its athletes and its officials.

options (optional)BoutBoardOptions

The width, the look, the icon, the language and the flags.

Returns

string

The SVG, a string that begins with <svg.

Examples

import { boutBoard, boutBoardSize } from "@johnmorrisdotca/taisen-brackets";

const source = {
  title: "Women's 57-60 kg",
  phase: "Preliminaries",
  bout: 142,
  red: { code: "BRA", flag: "BR", name: "TAVARES M." },
  blue: { code: "USA", flag: "US", name: "MAYER M." },
  officials: [{ role: "referee", code: "MGL", flag: "MN", name: "KHISHIGEE Khas-Erdene" }, { code: "POL", flag: "PL", name: "GORNY Mariusz" }],
};
const svg = boutBoard(source, { width: 960 });
console.log(svg.includes("BOUT: 142"), svg.includes("REFEREE AND JUDGES"), JSON.stringify(boutBoardSize(source.officials.length, { width: 960 })));
true true {"width":960,"height":237}

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/taisen-brackets 0.20.0.