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 · Map, locator and quiz elements

readMapDatafunction

Parse finite choropleth figures; invalid JSON and nested or non-numeric values are rejected.

Import it

import { readMapData } from "@johnmorrisdotca/chizu/element";

Also exported from: @johnmorrisdotca/chizu/element/define

Definition

function readMapData(text: string | null): Record<string, number> | null

Parameters

NameTypeDescription
textstring | null

The JSON text to read; null means no data.

Returns

Record<string, number> | null

Finite values keyed by place code, or null when no data was supplied.

Examples

import { readMapData } from "@johnmorrisdotca/chizu/element";
console.log(JSON.stringify(readMapData('{"JP":10}')), readMapData('{"JP":"bad"}'));
// {"JP":10} null
{"JP":10} null

What it prints (run when this page was built)

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