<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Charts",
  "identifier" : "/documentation/Charts/RectanglePlot",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Swift Charts"
    ],
    "preciseIdentifier" : "s:6Charts13RectanglePlotV"
  },
  "title" : "RectanglePlot"
}
-->

# RectanglePlot

Chart content that represents a collection of data using rectangles.

```
struct RectanglePlot<Content>
```

## Overview

Use `RectanglePlot` when you want to visualize data in the same way as with [`RectangleMark`](/documentation/Charts/RectangleMark),
but you want to visualize an entire data collection with a single plot.

You can initialize and style the plot with simple values or key paths.
Add modifiers with `KeyPath` before adding modifiers with simple values.

```
Chart {
    RectanglePlot(
        tasks,
        x: .value("Time", \.startTime, \.endTime),
        y: .value("Project", \.project)
    )
    .foregroundStyle(by: .value("Status", \.status))
    .cornerRadius(4)
}
```

## Topics

### Plotting rectangles from a collection

[`init(_:x:y:width:height:)`](/documentation/Charts/RectanglePlot/init(_:x:y:width:height:))

[`init(_:x:yStart:yEnd:width:)`](/documentation/Charts/RectanglePlot/init(_:x:yStart:yEnd:width:)-93op1)

[`init(_:x:yStart:yEnd:width:)`](/documentation/Charts/RectanglePlot/init(_:x:yStart:yEnd:width:)-nnvk)

[`init(_:x:yStart:yEnd:width:)`](/documentation/Charts/RectanglePlot/init(_:x:yStart:yEnd:width:)-12u1b)

[`init(_:xStart:xEnd:y:height:)`](/documentation/Charts/RectanglePlot/init(_:xStart:xEnd:y:height:)-51nra)

[`init(_:xStart:xEnd:y:height:)`](/documentation/Charts/RectanglePlot/init(_:xStart:xEnd:y:height:)-8s17v)

[`init(_:xStart:xEnd:y:height:)`](/documentation/Charts/RectanglePlot/init(_:xStart:xEnd:y:height:)-15ish)

[`init(_:xStart:xEnd:yStart:yEnd:)`](/documentation/Charts/RectanglePlot/init(_:xStart:xEnd:yStart:yEnd:)-46wi0)

[`init(_:xStart:xEnd:yStart:yEnd:)`](/documentation/Charts/RectanglePlot/init(_:xStart:xEnd:yStart:yEnd:)-4g377)

[`init(_:xStart:xEnd:yStart:yEnd:)`](/documentation/Charts/RectanglePlot/init(_:xStart:xEnd:yStart:yEnd:)-6d8yb)

[`init(_:xStart:xEnd:yStart:yEnd:)`](/documentation/Charts/RectanglePlot/init(_:xStart:xEnd:yStart:yEnd:)-6uuk4)

[`init(_:xStart:xEnd:yStart:yEnd:)`](/documentation/Charts/RectanglePlot/init(_:xStart:xEnd:yStart:yEnd:)-741lz)

[`init(_:xStart:xEnd:yStart:yEnd:)`](/documentation/Charts/RectanglePlot/init(_:xStart:xEnd:yStart:yEnd:)-ir9o)

### Supporting types

[`body`](/documentation/Charts/ChartContent/body-swift.property)

The content and behavior of the chart content.

[`VectorizedRectanglePlotContent`](/documentation/Charts/VectorizedRectanglePlotContent)

An opaque vectorized chart content type.



---

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)