Skip to content

ReferenceLine

Basic Example

The <ReferenceLine/> component is used to a draw line usually used to highlight specific points like mean.

You could either make use of the x (index of data) property to draw a vertical line or the y property to draw a horizontal line at the given value.

jsx
const data = [1, 5, 3, 8, 4, 7, 2, 8, 3, 4];

<SparklinesLine data={data}>
  <ReferenceLine x={5} stroke={"green"} />
</SparklinesLine>

<SparklinesLine data={data}>
  <ReferenceLine y={4} stroke={"red"} />
</SparklinesLine>

Released under the MIT License.