chartSvgfunction
The sky chart as a complete SVG element, as a string: the stars, and the layers asked for, laid out for width by height, on the night background. Pure: it reads no clock and fetches nothing.
Import it
import { chartSvg } from "@johnmorrisdotca/hoshi-stars/chart";
Definition
function chartSvg(options: ChartSvgOptions): string
Parameters
| Name | Type | Description |
|---|---|---|
options | ChartSvgOptions | The size, and where and how to look (see |
Returns
string
An <svg> with a viewBox of the size, role="img" and an accessible name; put it in a page as it is.
Examples
import { chartSvg } from "@johnmorrisdotca/hoshi-stars/chart";
const svg = chartSvg({ width: 640, height: 400, constellation: "Ori" });
console.log(svg.startsWith("<svg"), svg.includes('viewBox="0 0 640 400"'));
// true truetrue trueWhat it prints (run when this page was built)