polarToCartesian

Chart
stable

Convert a polar coordinate (centre, radius, angle in radians) into a Cartesian `[x, y]` point. Uses the mathematical convention — zero at 3 o'clock, counter-clockwise — shifted to noon/clockwise for visual consistency with radar and pie charts.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

cx
requis
number
X coordinate of the circle centre in SVG user units.
cy
requis
number
Y coordinate of the circle centre in SVG user units.
radius
requis
number
Distance from the centre to the point.
angle
requis
number
Angle in radians using the mathematical convention (0 = 3 o'clock, counter-clockwise). Internally shifted by `-π/2` so that 0 = noon, clockwise, matching `arcPath`.

API

Valeur de retour

La valeur retournée par cet util.

A `[x, y]` tuple in SVG user units representing the Cartesian equivalent of the given polar coordinate.

Usage

Exemples

Extraits de code prêts à coller.

Position a label at the top of a circle

typescript