resultsBoard関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The results board as a standalone SVG. Throws a RangeError for a board with no title or no rows, more than 24 rows, a row with no name, a value that is not a number, a text or null, a precision
that is not a whole number from 0 to 6, an unknown option value, or a width outside 720 to 4000.
インポート
import { resultsBoard } from "@johnmorrisdotca/taisen-brackets";
定義
function resultsBoard(source: ResultsBoardSource, options?: ResultsBoardOptions): string
引数
| 名前 | 型 | 説明 |
|---|---|---|
source | ResultsBoardSource | The title, the phase, the columns and the rows. |
options (省略可) | ResultsBoardOptions | The width, the look, the icon, the rank style, the language and the flags. |
戻り値
string
The SVG, a string that begins with <svg.
例
import { resultsBoard, resultsBoardSize } from "@johnmorrisdotca/taisen-brackets";
const source = {
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] },
],
};
const svg = resultsBoard(source, { width: 960 });
console.log(svg.includes("MEN'S 100M BUTTERFLY"), svg.includes("50.58"), JSON.stringify(resultsBoardSize(source.rows.length, { width: 960 })));true true {"width":960,"height":171}出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。