<!--
{
  "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:y:height:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Swift Charts"
    ],
    "preciseIdentifier" : "s:6Charts7BarMarkV6xStart4xEnd1y6heightAcA14PlottableValueVyxG_AjIyq_GAA0C9DimensionVtcAA0G0RzAaNR_r0_lufc"
  },
  "title" : "init(xStart:xEnd:y:height:)"
}
-->

# init(xStart:xEnd:y:height:)

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

```
nonisolated init<X, Y>(xStart: PlottableValue<X>, xEnd: PlottableValue<X>, y: PlottableValue<Y>, height: MarkDimension = .automatic) where X : Plottable, Y : Plottable
```

## Parameters

`xStart`

The value plotted with x start.

`xEnd`

The value plotted with x end.

`y`

The value plotted with y.

`height`

The bar height.  If `height` is `nil`, the default bar size will be applied.

## Discussion

### Discussion

Use this initializer to show horizontal intervals for one or more categories:

```swift
Chart(data) {
   BarMark(
       xStart: .value("Start Time", $0.start),
       xEnd: .value("End Time", $0.end),
       y: .value("Job", $0.job)
   )
}
```

![Horizontal bar chart with x-axis showing start and end time and y-axis showing task name. It has 5 bars, Task 1 range 0 to 15, range 20 to 35, and range 40 to 55, and Task 2 range 5 to 25 and range 30 to 60 task](images/com.apple.Charts/BarMarkSwift.BarMarkHorizontalIntervalBarChart@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)