Reference · Facts, line drawings and positions
lineupLabelsfunction
The labels and rings for a picture: the biggest bodies first, each with as much as fits, a label dropped when it would cover one already placed, and a ring round a body too small to see. A body outside the picture has none.
Import it
import { lineupLabels } from "@johnmorrisdotca/wakusei-planets";
Definition
function lineupLabels(dots: readonly LineupDot[], width: number, height: number, lang: LineupLang, options?: { font?: number; keep?: string; }): { labels: LineupLabel[]; rings: { id: string; cx: number; cy: number; r: number; }[]; }
Parameters
| Name | Type | Description |
|---|---|---|
dots | readonly LineupDot[] | The bodies on the picture ( |
width | number | The picture's width in pixels. |
height | number | The picture's height in pixels. |
lang | LineupLang |
|
options (optional) | { font?: number; keep?: string; } |
|
Returns
{ labels: LineupLabel[]; rings: { id: string; cx: number; cy: number; r: number; }[]; }
The labels and the rings (rings: a centre and a radius for each body under 6 pixels across).
Examples
import { lineupBodies, lineupLabels, lineupProject, lineupView, placeLineup } from "@johnmorrisdotca/wakusei-planets";
const places = placeLineup(lineupBodies({ planets: true }), "row");
const plan = lineupLabels(lineupProject(places, lineupView(places, 0.05), 800, 450), 800, 450, "en");
console.log(plan.labels.length, plan.rings.length);2 0What it prints (run when this page was built)