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

medalTablefunction

The medal table as an SVG. Throws a RangeError for a row with no name, a medal count that is not a whole number from 0, an option that is not one of its values, or a bad size or theme.

Import it

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

Definition

function medalTable(source: MedalTableSource, options?: MedalTableOptions): string

Parameters

NameTypeDescription
sourceMedalTableSource

The title, the event and the rows.

options (optional)MedalTableOptions

The sort, ties, rows, columns, the size, the theme and the language.

Returns

string

The SVG, a string that begins with <svg.

Examples

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

const svg = medalTable({
  subtitle: "Men's judo +100 kg",
  rows: [
    { name: "France", flag: "FR", gold: 6, silver: 1, bronze: 3 },
    { name: "Japan", flag: "JP", gold: 5, silver: 3, bronze: 2 },
    { name: "Soviet Union", code: "URS", note: "1922–1991", gold: 1, bronze: 4 },
  ],
}, { size: "portrait" });
console.log(svg.includes("Soviet Union"), svg.includes("1922–1991"), svg.includes("URS"));
true true true

What it prints (run when this page was built)

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