<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Charts",
  "identifier" : "/documentation/Charts/BarMark/init(xStart:xEnd:yStart:yEnd:)-7541n",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Swift Charts"
    ],
    "preciseIdentifier" : "s:6Charts7BarMarkV6xStart4xEnd01yD001yE0AC14CoreFoundation7CGFloatVSg_AkA14PlottableValueVyxGANtcAA0I0Rzlufc"
  },
  "title" : "init(xStart:xEnd:yStart:yEnd:)"
}
-->

# init(xStart:xEnd:yStart:yEnd:)

Creates a bar mark with fixed x interval that plots values with its y interval.

```
nonisolated init<Y>(xStart: CGFloat? = nil, xEnd: CGFloat? = nil, yStart: PlottableValue<Y>, yEnd: PlottableValue<Y>) where Y : Plottable
```

## Parameters

`xStart`

The x start position. If `xStart` is `nil` then the rectangle will start at the leading edge of the plotting area.

`xEnd`

The x end position. If `xStart` is `nil` then the rectangle will end at the trailing edge of the plotting area.

`yStart`

The value plotted to y start.

`yEnd`

The value plotted to y end.

## Discussion

### Discussion

Use this initializer to show vertical intervals for one category:

```swift
Chart(data) {
   BarMark(
       yStart: .value("Start Time", $0.start),
       yEnd: .value("End Time", $0.end)
   )
}
```

![Vertical bar chart with y-axis showing start and end time. It has 5 bars, Task 1 range 0 to 5, range 10 to 20, range 25 to 40, range 45 to 65, and range 70-95.](images/com.apple.Charts/BarMarkSwift.BarMarkVertical1DIntervalBarChart@2x.png)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)