Overview
The lines chart displays connections between two or more points, making it ideal for visualizing flows, migrations, routes, and relationships in geographic or abstract coordinate systems. Lines can be straight or curved, animated or static, and support various visual effects.When to Use
Use lines charts when you need to:- Visualize migration flows or movements between locations
- Show network connections and routes
- Display trade relationships between regions
- Represent flight paths or shipping routes
- Illustrate data flow in systems or processes
- Create Sankey-like flow diagrams on maps
- Show relationships between abstract points
Basic Configuration
The lines chart is configured through theLinesSeriesOption interface, supporting multiple coordinate systems.
Complete Example
Key Options
Array of coordinate pairs defining the line path. For basic lines, use two points
[[x1,y1], [x2,y2]]. For polylines, use multiple points.Curvature of the line. Value ranges from 0 (straight) to 1 (highly curved). Positive values curve one direction, negative values curve the opposite direction.
Animated visual effect that moves along the line, useful for showing direction and flow.
Whether to show the animated effect along the line.
Duration of one animation cycle in seconds. Ignored if
constantSpeed is set.Constant speed in pixels per second. When set to a value greater than 0, this overrides the
period setting.Symbol type for the moving effect. Options include:
'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', or a custom SVG path.Length of the trail effect, ranging from 0 to 1. A value of 0.2 means the trail covers 20% of the line length.
Whether lines are polylines with multiple segments. When true, the
coords array can contain more than 2 points. Note: polylines do not support curveness, labels, or some animations.The coordinate system to use for the lines:
'geo': Geographic coordinate system (default)'cartesian2d': 2D rectangular coordinate system'polar': Polar coordinate system'calendar': Calendar coordinate system
Symbol at the start and end of lines. Can be a single value or array
[startSymbol, endSymbol].Visual style of the lines.
Enable optimization for large-scale line data. Useful when rendering thousands of lines.
Data Format
Lines chart data follows a specific structure:Advanced Features
Migration Flow with Varying Width
Flight Routes Network
Polyline Route with Waypoints
Network Connections on Cartesian
Bidirectional Flow
Performance Tips
-
Use large mode for datasets with thousands of lines:
-
Disable effects for many lines to improve performance:
-
Use flat array format for very large datasets:
-
Progressive rendering for massive datasets:
Common Use Cases
Migration Map
- Set
curvenessbetween 0.2-0.4 for natural flow - Use
effect.symbol: 'arrow'to show direction - Vary line width based on migration volume
Flight Routes
- Use polylines for multi-stop routes
- Set
effect.constantSpeedfor realistic movement - Apply different colors for different airlines
Network Topology
- Use
coordinateSystem: 'cartesian2d'for abstract networks - Set
curvenessto avoid line overlap - Combine with scatter series for nodes
Source Reference
The lines chart implementation can be found in:- Series model:
src/chart/lines/LinesSeries.ts:147-429 - Type definitions:
src/chart/lines/LinesSeries.ts:75-145 - Default options:
src/chart/lines/LinesSeries.ts:385-428 - Coords format:
src/chart/lines/LinesSeries.ts:75,107,210-223 - Effect options:
src/chart/lines/LinesSeries.ts:126,400-408