---
title: "init(xStart:xEnd:yStart:yEnd:)"
framework: charts
role: symbol
role_heading: Initializer
path: "charts/rectanglemark/init(xstart:xend:ystart:yend:)-5682c"
---

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

Creates a rectangle mark with fixed x and y intervals.

## Declaration

```swift
nonisolated init(xStart: CGFloat? = nil, xEnd: CGFloat? = nil, yStart: CGFloat? = nil, yEnd: CGFloat? = nil)
```

## Discussion

Discussion 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 xEnd is nil then the rectangle will end at the trailing edge of the plotting area. yStart: The y start position. If yStart is nil then the rectangle will start at the leading edge of the plotting area. yEnd: The y end position. If yEnd is nil then the rectangle will end at the trailing edge of the plotting area. Discussion Use this initializer to create one rectangle with any optional x start, x end, y start, and y end position. If no parameters are specified the rectangle will fill the plotting area of the chart. The example below uses a number scale starting at (0,0) and ending at (6,6). The rectangle has the coordinates: (2,2), (2,4), (4,4), (4,2). Chart(data) {     RectangleMark()         .opacity(0.2)

PointMark(         x: .value("X", $0.x),         y: .value("Y", $0.y)     ) }

## See Also

### Creating a rectangle mark

- [init(x:yStart:yEnd:width:)](charts/rectanglemark/init(x:ystart:yend:width:)-vh2x.md)
- [init(x:yStart:yEnd:width:)](charts/rectanglemark/init(x:ystart:yend:width:)-xhqp.md)
- [init(xStart:xEnd:y:height:)](charts/rectanglemark/init(xstart:xend:y:height:)-27222.md)
- [init(xStart:xEnd:y:height:)](charts/rectanglemark/init(xstart:xend:y:height:)-4x46i.md)
- [init(xStart:xEnd:yStart:yEnd:)](charts/rectanglemark/init(xstart:xend:ystart:yend:)-1qbzg.md)
- [init(xStart:xEnd:yStart:yEnd:)](charts/rectanglemark/init(xstart:xend:ystart:yend:)-5cbgh.md)
- [init(xStart:xEnd:yStart:yEnd:)](charts/rectanglemark/init(xstart:xend:ystart:yend:)-6jeka.md)
- [init(x:y:width:height:)](charts/rectanglemark/init(x:y:width:height:).md)
- [init(x:y:z:)](charts/rectanglemark/init(x:y:z:).md)
