polygonPath

Chart
stable

Convert an array of [x, y] chart coordinates into a closed SVG path string (M…L…Z). Returns an empty string when the array is empty.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

points
required
Array<TPathPoint>
Array of [x, y] coordinate pairs in chart (pixel) space. Must contain at least one entry; an empty array yields an empty string.

API

Return value

The value returned by this util.

A closed SVG path `d` string (M…L…Z) suitable for a `<polygon>` fill, or an empty string when points is empty.

Usage

Examples

Ready-to-paste usage snippets.

Build a closed triangle path

typescript