The Mark Line component draws reference lines in charts to highlight specific values, thresholds, or trends. It supports both horizontal/vertical lines and arbitrary directional lines between two points.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/apache/echarts/llms.txt
Use this file to discover all available pages before exploring further.
Purpose
Mark Line helps visualize thresholds, averages, or relationships between data points. From~/workspace/source/src/component/marker/MarkLineModel.ts, it supports statistical lines (min, max, average) and custom positioned lines with rich styling.
Basic Usage
Simple Statistical Lines
Fixed Value Lines
Configuration Options
Array of mark line data items. Can be 1D (single axis lines) or 2D (point-to-point lines).
Symbol at both ends of the line. Can be:
- Single string: same symbol for both ends
- Array of two strings:
[startSymbol, endSymbol] 'none'to hide symbols
Size of symbols at both ends. Can be a single number or
[startSize, endSize].Rotation angle of symbols in degrees.
Offset of the symbol positions. Can be:
- Single value: applies to both symbols
- Array:
[startOffset, endOffset]
Decimal precision for automatically calculated values.
Style of the mark line.
Label configuration for mark lines.
Emphasis (hover) state configuration.
Easing function for line animation.
Data Item Configuration
1D Mark Lines (Single Axis)
Statistical type for automatic positioning:
'min': Line at minimum value'max': Line at maximum value'average': Line at average value'median': Line at median value
When using
type, specifies which dimension to calculate statistics on.Dimension name for statistical calculation.
X-axis value for a vertical line.
Y-axis value for a horizontal line.
Name of the mark line, displayed in labels.
2D Mark Lines (Two Points)
For lines between two arbitrary points, use an array of two objects:Coordinates
[x, y] in the data coordinate system.Absolute x position in pixels or percentage.
Absolute y position in pixels or percentage.
X coordinate on the x-axis.
Y coordinate on the y-axis.
Symbol for this endpoint.
Size of symbol at this endpoint.
Examples
Statistical Mark Lines
Threshold Lines
Custom Two-Point Lines
Styled Mark Lines
Multiple Series with Different Mark Lines
Vertical Milestone Lines
Implementation Details
From~/workspace/source/src/component/marker/MarkLineModel.ts:102-150, the Mark Line component:
- Z-index: Defaults to 5, same as mark points
- Default Symbols: Circle at start, arrow at end
- Default Line Style: Dashed lines
- Animation: Uses linear easing by default
- Emphasis: Increases line width to 3 on hover
- Parent Component: Extends MarkerModel from
~/workspace/source/src/component/marker/MarkerModel.ts - Statistical Support: Calculates min, max, average, and median across any dimension
- Precision: Formats numeric values to 2 decimal places by default
- Label Position: Defaults to ‘end’ with 5px distance