polar component defines a polar coordinate system for creating circular visualizations. It uses radius and angle as its two dimensions, perfect for displaying cyclical or radial data patterns.
When to Use
Use the polar coordinate system when you need to:- Display data with cyclical patterns (time of day, seasons, directions)
- Create radar charts, rose diagrams, or polar bar charts
- Visualize angular relationships and radial distances
- Show data where angle and magnitude are meaningful dimensions
Basic Configuration
Polar Bar Chart (Rose Diagram)
Create a rose diagram by using bars in polar coordinates:Polar Line Chart
Display data as a line wrapping around the polar center:Properties
Center position of the polar coordinate system. The first element is the horizontal position, the second is vertical. Can be absolute pixels or percentage strings.Source:
PolarModel.ts:63Radius of the polar coordinate system. Can be:
- A number (pixels)
- A percentage string (relative to container size)
- An array of two values for inner and outer radius (to create a ring)
PolarModel.ts:65z-index of the component.Source:
PolarModel.ts:61Implementation Details
The Polar class implements bothCoordinateSystem and CoordinateSystemMaster interfaces. Key implementation details from Polar.ts:
Dimensions and Axes
Polar coordinates use two dimensions:['radius', 'angle'] (source: Polar.ts:29, 38). The coordinate system contains:
- A radius axis (RadiusAxis) - controls radial distance from center (source:
Polar.ts:52) - An angle axis (AngleAxis) - controls angular position (source:
Polar.ts:54)
Coordinate Conversion
The polar system provides several coordinate conversion methods:dataToPoint(data, clamp)- Convert data values to canvas (x, y) point (source:Polar.ts:141-146)pointToData(point, clamp)- Convert canvas point to data values (source:Polar.ts:151-157)pointToCoord(point)- Convert (x, y) to (radius, angle) coordinates (source:Polar.ts:162-188)coordToPoint(coord)- Convert (radius, angle) to (x, y) point (source:Polar.ts:193-202)
Center Point
The polar center is defined bycx and cy properties (source: Polar.ts:45, 50), which represent the x and y coordinates of the polar center in the canvas.
Base Axis
The base axis (used for stacking) is determined by (source:Polar.ts:122-126):
- First ordinal scale axis, or
- First time scale axis, or
- The angle axis
Related Components
- angleAxis - The angular axis in polar coordinates
- radiusAxis - The radial axis in polar coordinates
- Radar Chart - Specialized polar visualization for multivariate data