---
title: "init(xStart:xEnd:y:)"
framework: charts
role: symbol
role_heading: Initializer
path: "charts/rulemark/init(xstart:xend:y:)-6jsoi"
---

# init(xStart:xEnd:y:)

Creates a horizontal rule mark that plots values on its x interval.

## Declaration

```swift
nonisolated init<X>(xStart: PlottableValue<X>, xEnd: PlottableValue<X>, y: CGFloat? = nil) where X : Plottable
```

## Parameters

- `xStart`: The value plotted with x start.
- `xEnd`: The value plotted with x end.
- `y`: The y position. If y is nil, the rule will be centered vertically by default.

## Discussion

Discussion Use this initializer to create a horizontal rule at x positions from xStart to xEnd for a single y position: Chart(data) {     RuleMark(         xStart: .value("Start Date", $0.startDate),         xEnd: .value("End Date", $0.endDate)     ) }

See the second code example in RuleMark for the setup of the structure that contains the startDate, endDate, and source properties.
