The pages are in English; this contents, the search and the buttons are in Japanese.
Gallery: layouts and backgrounds
Small multiples in one SVG, with a title, a subtitle, a key and a credit line, in the size of a social card, a square post or a phone; and the grounds behind a drawing or a grid: seven patterns and a photograph.
- Sizes for a card, a post and a phone3
- Columns, gaps and the last row3
- A key they share1
- Charts and scores in a cell1
- Light, dark and Japanese2
- A ground behind a drawing7
- A ground behind a grid2
- A photograph behind the surface2
21 pictures, each drawn by the build from the code under it, which the Copy button copies. They are drawn as they come near the screen. Open in a page loads the published package from jsDelivr, which serves only released versions.
Sizes for a card, a post and a phone#
preset fixes the size: card is 1200 by 675, square 1080 by 1080, phone 390 wide in one column and as tall as the drawings need.
A social card
import { drawGrid } from "@johnmorrisdotca/kyogijo-stadiums/layouts";
const svg = drawGrid([{ drawing: { sport: "nhl" }, label: "Rink" }, { drawing: { sport: "nba" }, label: "Court" }, { drawing: { sport: "soccer" }, label: "Pitch" }, { drawing: { sport: "mlb", park: "fenway-park" }, label: "Ballpark" }], {
preset: "card",
title: "Four surfaces",
subtitle: "Each drawn to scale from its rulebook",
endnote: "Drawn with Kyogijo",
});A square post
import { drawGrid } from "@johnmorrisdotca/kyogijo-stadiums/layouts";
const svg = drawGrid([{ drawing: { sport: "nhl" }, label: "Rink" }, { drawing: { sport: "nba" }, label: "Court" }, { drawing: { sport: "soccer" }, label: "Pitch" }, { drawing: { sport: "mlb", park: "fenway-park" }, label: "Ballpark" }], {
preset: "square",
title: "Four surfaces",
subtitle: "Each drawn to scale",
endnote: "Drawn with Kyogijo",
background: "grid",
});A phone's width
The picture is as tall as the drawings need.
import { drawGrid } from "@johnmorrisdotca/kyogijo-stadiums/layouts";
const svg = drawGrid([{ drawing: { sport: "nhl" }, label: "Rink" }, { drawing: { sport: "nba" }, label: "Court" }, { drawing: { sport: "soccer" }, label: "Pitch" }, { drawing: { sport: "mlb", park: "fenway-park" }, label: "Ballpark" }], {
preset: "phone",
title: "Four surfaces",
subtitle: "One column",
endnote: "Drawn with Kyogijo",
});Columns, gaps and the last row#
columns and gap are yours; with neither, the grid picks the columns that make the drawings largest. The last row is centred.
Two columns
Two columns of three rows, as tall as the drawings need.
import { drawGrid } from "@johnmorrisdotca/kyogijo-stadiums/layouts";
const svg = drawGrid(["fenway-park", "wrigley-field", "oracle-park", "coors-field", "yankee-stadium", "tokyo-dome"].map((park) => ({ drawing: { sport: "mlb", park }, label: park })), {
columns: 2,
width: 800,
title: "Six parks",
endnote: "Each park's fence from its published figures",
});Three columns, a wide gap
import { drawGrid } from "@johnmorrisdotca/kyogijo-stadiums/layouts";
const svg = drawGrid(["fenway-park", "wrigley-field", "oracle-park", "coors-field", "yankee-stadium", "tokyo-dome"].map((park) => ({ drawing: { sport: "mlb", park }, label: park })), { columns: 3, gap: 40, width: 900 });Five drawings in three columns
import { drawGrid } from "@johnmorrisdotca/kyogijo-stadiums/layouts";
const svg = drawGrid(["nhl", "nba", "soccer", "mlb", "curling"].map((sport) => ({ drawing: { sport }, label: sport })), { columns: 3, width: 900 });A key they share#
legend is a list of { label, color, shape, hollow }, set under the title; the description for a screen reader lists it.
Three marks
import { drawGrid } from "@johnmorrisdotca/kyogijo-stadiums/layouts";
const svg = drawGrid([{ sport: "nhl" }, { sport: "nhl", orientation: "portrait" }], {
width: 900,
title: "Shots on the rink",
subtitle: "Wide and tall",
legend: [
{ label: "Goal", color: "#c8102e" },
{ label: "Shot", color: "#1f5fa8", hollow: true },
{ label: "Block", color: "#6b6f72", shape: "x" },
],
});Charts and scores in a cell#
A cell is the options of drawKyogijo, a drawing's SVG, a chart or { drawing, label }: a chart is drawn by its own draw(), with ids of its own.
Two shot charts and a score
import { nbaShotChart } from "@johnmorrisdotca/kyogijo-stadiums/charts";
import { drawGrid } from "@johnmorrisdotca/kyogijo-stadiums/layouts";
const shots = (n) => Array.from({ length: n }, (_, i) => ({ x: ((i * 97) % 480) - 240, y: (i * 61) % 300, made: i % 3 === 0 }));
const svg = drawGrid(
[
{ drawing: nbaShotChart(shots(90), { league: 46, minShots: 2 }), label: "First half" },
{ drawing: nbaShotChart(shots(140), { league: 46, minShots: 2 }), label: "Second half" },
{ drawing: { sport: "nba", away: { name: "Australia", abbr: "AUS", score: 108, color: "#00843d" }, home: { name: "Japan", abbr: "JPN", score: 112, color: "#bc002d" }, status: "final" }, label: "Final" },
],
{ columns: 2, width: 1000, title: "A game in three pictures", endnote: "Synthetic shots" },
);Light, dark and Japanese#
theme forces light or dark on the grid and on every drawing in it; language sets the grid's own words and the language of the drawings that have none of their own.
Dark
import { drawGrid } from "@johnmorrisdotca/kyogijo-stadiums/layouts";
const svg = drawGrid([{ drawing: { sport: "nhl" }, label: "Rink" }, { drawing: { sport: "nba" }, label: "Court" }, { drawing: { sport: "soccer" }, label: "Pitch" }, { drawing: { sport: "mlb", park: "fenway-park" }, label: "Ballpark" }], {
preset: "card",
theme: "dark",
title: "Four surfaces",
subtitle: "Dark",
background: { pattern: "felt", color: "#16241f" },
});In Japanese
import { drawGrid } from "@johnmorrisdotca/kyogijo-stadiums/layouts";
const svg = drawGrid([{ drawing: { sport: "nhl" }, label: "Rink" }, { drawing: { sport: "nba" }, label: "Court" }, { drawing: { sport: "soccer" }, label: "Pitch" }, { drawing: { sport: "mlb", park: "fenway-park" }, label: "Ballpark" }], {
preset: "card",
language: "ja",
title: "4つの競技場",
subtitle: "それぞれルールブックどおりの寸法で描いています",
endnote: "Kyogijoで描画",
});A ground behind a drawing#
background on a drawing lays a pattern (and a colour, and a photograph) on the apron, under the surface. Every pattern is a few shapes in the drawing's own ink, so it follows light and dark.
Ground: felt
import { drawKyogijo } from "@johnmorrisdotca/kyogijo-stadiums";
const svg = drawKyogijo({ sport: "nba", background: "felt" });Ground: grass
import { drawKyogijo } from "@johnmorrisdotca/kyogijo-stadiums";
const svg = drawKyogijo({ sport: "nba", background: "grass" });Ground: wood
import { drawKyogijo } from "@johnmorrisdotca/kyogijo-stadiums";
const svg = drawKyogijo({ sport: "nba", background: "wood" });Ground: ice
import { drawKyogijo } from "@johnmorrisdotca/kyogijo-stadiums";
const svg = drawKyogijo({ sport: "nba", background: "ice" });Ground: paper
import { drawKyogijo } from "@johnmorrisdotca/kyogijo-stadiums";
const svg = drawKyogijo({ sport: "nba", background: "paper" });Ground: grid
import { drawKyogijo } from "@johnmorrisdotca/kyogijo-stadiums";
const svg = drawKyogijo({ sport: "nba", background: "grid" });Ground: dots
import { drawKyogijo } from "@johnmorrisdotca/kyogijo-stadiums";
const svg = drawKyogijo({ sport: "nba", background: "dots" });A ground behind a grid#
The same option on a grid lays the ground under every drawing and the words; a colour of your own sits under the pattern.
Wood
import { drawGrid } from "@johnmorrisdotca/kyogijo-stadiums/layouts";
const svg = drawGrid([{ drawing: { sport: "nhl" }, label: "Rink" }, { drawing: { sport: "nba" }, label: "Court" }, { drawing: { sport: "soccer" }, label: "Pitch" }, { drawing: { sport: "mlb", park: "fenway-park" }, label: "Ballpark" }], {
width: 900,
columns: 2,
background: { pattern: "wood", color: "#e6d3b3" },
title: "On the table",
});Ice
import { drawGrid } from "@johnmorrisdotca/kyogijo-stadiums/layouts";
const svg = drawGrid([{ drawing: { sport: "nhl" }, label: "Rink" }, { drawing: { sport: "nba" }, label: "Court" }, { drawing: { sport: "soccer" }, label: "Pitch" }, { drawing: { sport: "mlb", park: "fenway-park" }, label: "Ballpark" }], {
width: 900,
columns: 2,
background: { pattern: "ice", color: "#e9f2f8" },
title: "On the ice",
});A photograph behind the surface#
image is an address or a data: image held to the rules of a team's logo, drawn over the ground's colour and under the pattern at imageOpacity. The picture here is a made-up scene written as an SVG document; pass the address of a real photograph.
A photograph behind a court
import { drawKyogijo } from "@johnmorrisdotca/kyogijo-stadiums";
const photo = "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 225'><defs><linearGradient id='s' x1='0' y1='0' x2='0' y2='1'><stop offset='0' stop-color='#274b7a'/><stop offset='.62' stop-color='#f0b36a'/><stop offset='1' stop-color='#3d5a3b'/></linearGradient></defs><rect width='400' height='225' fill='url(#s)'/><path d='M0 170L60 120L120 160L200 100L290 150L350 125L400 160V225H0Z' fill='#1d2f27'/></svg>";
const svg = drawKyogijo({ sport: "nba", background: { color: "#1d2f27", image: photo, imageOpacity: 0.7, pattern: "dots" } });A photograph behind a grid
import { drawGrid } from "@johnmorrisdotca/kyogijo-stadiums/layouts";
const photo = "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 225'><defs><linearGradient id='s' x1='0' y1='0' x2='0' y2='1'><stop offset='0' stop-color='#274b7a'/><stop offset='.62' stop-color='#f0b36a'/><stop offset='1' stop-color='#3d5a3b'/></linearGradient></defs><rect width='400' height='225' fill='url(#s)'/><path d='M0 170L60 120L120 160L200 100L290 150L350 125L400 160V225H0Z' fill='#1d2f27'/></svg>";
const svg = drawGrid([{ drawing: { sport: "nhl" }, label: "Rink" }, { drawing: { sport: "nba" }, label: "Court" }, { drawing: { sport: "soccer" }, label: "Pitch" }, { drawing: { sport: "mlb", park: "fenway-park" }, label: "Ballpark" }], { preset: "card", title: "Four surfaces", background: { image: photo, imageOpacity: 0.5, color: "#1d2f27" }, theme: "dark" });