ChartSvgOptionstype
What to draw. Only width and height are needed; everything else starts where the demo starts.
Import it
import type { ChartSvgOptions } from "@johnmorrisdotca/hoshi-stars/chart";
Definition
interface ChartSvgOptions {
width: number;
height: number;
projection?: Projection | undefined;
ra?: number | undefined;
dec?: number | undefined;
zoom?: number | undefined;
magnitude?: number | undefined;
layers?: readonly ChartLayer[] | undefined;
lang?: Language | undefined;
culture?: Culture | undefined;
constellation?: string | undefined;
picked?: string | undefined;
markers?: readonly SkyMarker[] | undefined;
timeRange?: MarkerRange | undefined;
tracks?: boolean | readonly string[] | undefined;
bodies?: readonly SkyBody[] | undefined;
showUncertainty?: boolean | undefined;
label?: string | undefined;
measure?: ((text: string, font: string) => number) | undefined;
}
Members
| Name | Type | Description |
|---|---|---|
width | number | The size in CSS pixels; the SVG's |
height | number | |
projection (optional) | "stereographic" | "orthographic" | "gnomonic" | "equidistant" | "equirectangular" | "mollweide" | "hammer" | undefined | The projection: |
ra (optional) | number | undefined | The point in the middle, in degrees: right ascension 0 to 360 and declination -90 to 90 (Orion's, 84 and 0, by default). |
dec (optional) | number | undefined | |
zoom (optional) | number | undefined | How far in: 1 is the projection's own fit; left out, the zoom the projection opens at for this size. |
magnitude (optional) | number | undefined | The faintest star at that zoom (5); zooming in shows fainter ones, as a telescope does. |
layers (optional) | readonly ("names" | "milky" | "lines" | "boundaries" | "deep" | "holes" | "ecliptic" | "grid")[] | undefined | What to draw over the stars ( |
lang (optional) | Language | undefined | The language of the names: |
culture (optional) | Culture | undefined | The sky culture whose figures and names are drawn: the Western sky when left out. Pass |
constellation (optional) | string | undefined | A figure to show brighter, with its boundary when it is a constellation: a constellation's abbreviation ( |
picked (optional) | string | undefined | The star (its HR number, |
markers (optional) | readonly SkyMarker[] | undefined | Your own points, each with a place and, if you like, a date, a name, a colour, a size and a group ( |
timeRange (optional) | MarkerRange | undefined | Show only the markers dated inside it ( |
tracks (optional) | boolean | readonly string[] | undefined | Join a group of markers with a line in date order: |
bodies (optional) | readonly SkyBody[] | undefined | Planets, the Moon and other bodies you have worked out ( |
showUncertainty (optional) | boolean | undefined | Draw the stars of grade C (a rough or missing distance, |
label (optional) | string | undefined | The SVG's accessible name: "Star chart" (星図 in Japanese) when left out. |
measure (optional) | ((text: string, font: string) => number) | undefined | The width of a text in pixels for a CSS |
Examples
import { chartSvg, type ChartSvgOptions } from "@johnmorrisdotca/hoshi-stars/chart";
const options: ChartSvgOptions = { width: 480, height: 320, projection: "orthographic", ra: 10.7, dec: 41.3, zoom: 6, lang: "ja" };
console.log(chartSvg(options).includes('aria-label="星図"'));
// truetrueWhat it prints (run when this page was built)