ChizuElementOptions型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Options that require host code rather than an HTML attribute. The existing mounted-map options stay available.
インポート
import type { ChizuElementOptions } from "@johnmorrisdotca/chizu/element";
ほかのエクスポート元: @johnmorrisdotca/chizu/element/define
定義
type ChizuElementOptions = Partial<ChizuMountOptions> & {
data?: Readonly<Record<string, number>>;
capital?: boolean;
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
map (省略可) | MapData | undefined | The map to show: |
language (省略可) | ChizuLanguage | undefined | The language of the names and of the buttons. Default: the page's |
zoom (省略可) | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | undefined | The zoom step to start at (1 to 10). Default 1. |
tones (省略可) | Readonly<Record<string, string>> | undefined | Tones by code ( |
colors (省略可) | Readonly<Record<string, string>> | undefined | A colour for each region by code ( |
callouts (省略可) | readonly string[] | Omit<CalloutRequest, "box"> | undefined | Numbered callouts ( |
labels (省略可) | boolean | readonly string[] | undefined | Print names on the land. |
selected (省略可) | string | null | undefined | The chosen region's code, or null. |
fit (省略可) | boolean | undefined | Zoom in on a region when it is chosen. Default true. |
selectable (省略可) | boolean | undefined | Whether pressing a region chooses it. Off, a press does nothing and the map is only looked at (a quiz that asks the question itself). Default true. |
controls (省略可) | boolean | undefined | Show the zoom buttons and the zoom level. Default true. |
onSelect (省略可) | ((code: string | null) => void) | undefined | A region was pressed (or its number): its code. Pressing the chosen one again passes null. |
detail (省略可) | MapData | (() => Promise<MapData>) | undefined | A finer drawing of the same map, drawn from |
detailFrom (省略可) | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | undefined | The zoom step the finer drawing starts at. Default 4. |
onView (省略可) | ((view: ChizuView) => void) | undefined | The view changed: after a zoom, and when a drag ends. |
features (省略可) | readonly ChizuFeatureChoice[] | undefined | Which named features to draw ( |
featureLayer (省略可) | ChizuFeatureLayer | ((mapId: string) => Promise<ChizuFeatureLayer | null>) | null | undefined | The map's named features: a layer ( |
featureLabels (省略可) | boolean | undefined | Print the features' names. Default true. |
data (省略可) | Readonly<Record<string, number>> | undefined | Finite figures keyed by a region's code or ISO code, drawn in five shades. |
capital (省略可) | boolean | undefined | Add capital markers; false hides them even when all features are chosen. Defaults to true for map/locator embeds; quiz feature choices stay unchanged. |
例
import { ChizuMapElement, type ChizuElementOptions } from "@johnmorrisdotca/chizu/element";
const options: ChizuElementOptions = { controls: false, data: { JP: 10 }, colors: { JP: "#2f6b4f" }, capital: false };
const map = new ChizuMapElement();
map.options = options;
document.body.append(map);この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。