Skip to main content
Renders a closed polygon shape from a set of coordinate points. The Polygon component connects a series of points to create a closed shape. It can handle discontinuous data and optionally render an area between two sets of points (like a range area).

Props

Data

ReadonlyArray<{x: number, y: number}>
The coordinates of all the vertexes of the polygon, as an array of objects with x and y coordinates.
ReadonlyArray<{x: number, y: number}>
Optional baseline points for creating a range polygon.When provided, the polygon is rendered as an area between the points and baseLinePoints.
boolean
Whether to connect segments across null points.When false, gaps appear in the polygon where data points are null. When true, the polygon connects across null values.

Appearance

string
CSS class name to apply to the polygon element.

SVG properties

This component accepts all standard SVG polygon element properties including:
  • fill - Fill color
  • stroke - Stroke color
  • strokeWidth - Stroke width
  • opacity - Opacity value
  • style - Inline styles

Events

(e: React.MouseEvent<SVGPolygonElement, MouseEvent>) => void
Event handler for click events on the polygon.
(e: React.MouseEvent<SVGPolygonElement, MouseEvent>) => void
Event handler for mousedown events on the polygon.
(e: React.MouseEvent<SVGPolygonElement, MouseEvent>) => void
Event handler for mouseup events on the polygon.
(e: React.MouseEvent<SVGPolygonElement, MouseEvent>) => void
Event handler for mousemove events on the polygon.
(e: React.MouseEvent<SVGPolygonElement, MouseEvent>) => void
Event handler for mouseover events on the polygon.
(e: React.MouseEvent<SVGPolygonElement, MouseEvent>) => void
Event handler for mouseout events on the polygon.
(e: React.MouseEvent<SVGPolygonElement, MouseEvent>) => void
Event handler for mouseenter events on the polygon.
(e: React.MouseEvent<SVGPolygonElement, MouseEvent>) => void
Event handler for mouseleave events on the polygon.

Examples

Basic polygon

Range polygon with baseline