ReferenceLine
Draws a line on the chart connecting two points. This component, unlike line, is aware of the cartesian coordinate system, so you specify the dimensions by using data coordinates instead of pixels. ReferenceLine will calculate the pixels based on the provided data coordinates. If you prefer to render using pixels rather than data coordinates, consider using the line SVG element instead.
Parent Components
ReferenceLine consumes context provided by these components:
Props
classNamestringoptional
ifOverflow"discard" | "extendDomain" | "hidden" | "visible"optional
Defines how to draw this component if it falls partly outside the canvas:
discard: the whole component will not be drawn at allhidden: the component will be clipped to the chart plot areavisible: the component will be drawn completelyextendDomain: the domain of the overflown axis will be extended such that the whole component fits into the plot area
DEFAULT:
"discard"label(union of 7 variants)optional
Renders a single label.
false: no labels are renderedstring|number: the content of the labelobject: the props of LabelList componentReactElement: a custom label elementfunction: a render function of custom label
DEFAULT:
falseExamples:
position"end" | "middle" | "start"optional
The position of the reference line when the axis has bandwidth (e.g., a band scale). This determines where within the band the line is drawn.
DEFAULT:
"middle"segmentreadonly [ { x?: number | string; y?: number | string; }, { x?: number | string; y?: number | string; }, ]optional
Tuple of coordinates. If defined, renders a diagonal line segment.
shapeFunction | ReactNodeoptional
strokeWidthnumber | stringoptional
The width of the stroke
DEFAULT:
1xnumber | stringoptional
If defined, renders a vertical line on this position.
This value is using your chart's domain, so you will provide a data value instead of a pixel value. ReferenceLine will internally calculate the correct pixel position.
FORMAT:
<ReferenceLine x="Monday" />xAxisIdnumber | stringoptional
The id of x-axis which is corresponding to the data. Required when there are multiple XAxes.
DEFAULT:
0ynumber | stringoptional
If defined, renders a horizontal line on this position.
This value is using your chart's domain, so you will provide a data value instead of a pixel value. ReferenceLine will internally calculate the correct pixel position.
FORMAT:
<ReferenceLine y="Page D" />yAxisIdnumber | stringoptional
The id of y-axis which is corresponding to the data. Required when there are multiple YAxes.
DEFAULT:
0zIndexnumberoptional
Z-Index of this component and its children. The higher the value, the more on top it will be rendered. Components with higher zIndex will appear in front of components with lower zIndex. If undefined or 0, the content is rendered in the default layer without portals.
DEFAULT:
400Examples: