<!--
{
  "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(x:yStart:yEnd:width:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Swift Charts"
    ],
    "preciseIdentifier" : "s:6Charts7BarMarkV1x6yStart4yEnd5widthAcA14PlottableValueVyxG_AIyq_GAkA0C9DimensionVtcAA0G0RzAaNR_r0_lufc"
  },
  "title" : "init(x:yStart:yEnd:width:)"
}
-->

# init(x:yStart:yEnd:width:)

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

```
nonisolated init<X, Y>(x: PlottableValue<X>, yStart: PlottableValue<Y>, yEnd: PlottableValue<Y>, width: MarkDimension = .automatic) where X : Plottable, Y : Plottable
```

## Parameters

`x`

The value plotted with x.

`yStart`

The value plotted with y start.

`yEnd`

The value plotted with y end.

`width`

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

## Discussion

### Discussion

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

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

![Vertical bar chart with x-axis showing task name and y-axis showing start and end time. 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.BarMarkVerticalIntervalBarChart@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)