Skip to the content

Chizu地図

Draw SVG maps, frame regions, place numbered callouts and build geography quizzes with English and Japanese names.

Chizu is the Japanese word 地図 for map. About the name

Contents

Reference · Framing, geometry and quiz tools

focusBoxfunction

The window that frames these regions, or the whole map when none are given.

Import it

import { focusBox } from "@johnmorrisdotca/chizu";

Definition

function focusBox(map: Frameable, codes: ReadonlyArray<string | number>): MapBox

Parameters

NameTypeDescription
mapFrameable

The native map or map fields required by this signature; coordinates and region codes belong to its canvas.

codesreadonly (string | number)[]

Native region codes from this map, in the requested order.

Returns

MapBox

The window that frames these regions, or the whole map when none are given.

Examples

import WORLD from "@johnmorrisdotca/chizu/world";
import { boxToViewBox, focusBox } from "@johnmorrisdotca/chizu";

console.log(boxToViewBox(focusBox(WORLD, ["DE", "PL"])).split(" ").map((n) => Math.round(Number(n))).join(" "));
// 1 50 220 220
1 50 220 220

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chizu 1.5.0.