<!--
{
  "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/RulePlot",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Swift Charts"
    ],
    "preciseIdentifier" : "s:6Charts8RulePlotV"
  },
  "title" : "RulePlot"
}
-->

# RulePlot

Chart content that represents a collection of data using a single horizontal or vertical rule.

```
struct RulePlot<Content>
```

## Overview

Use `RulePlot` when you want to visualize data in the same way as with [`RuleMark`](/documentation/Charts/RuleMark),
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 {
    RulePlot(
        tasks,
        xStart: .value("Start time", \.startTime),
        xEnd: .value("End time", \.endTime),
        y: .value("Project", \.project)
    )
    .foregroundStyle(by: .value("Status", \.status))
    .opacity(\.opacity)
    .lineStyle(StrokeStyle(lineWidth: 8, lineCap: .round))
}
```

## Topics

### Plotting rules from a collection

[`init(_:x:yStart:yEnd:)`](/documentation/Charts/RulePlot/init(_:x:yStart:yEnd:)-13wts)

[`init(_:x:yStart:yEnd:)`](/documentation/Charts/RulePlot/init(_:x:yStart:yEnd:)-3fig9)

[`init(_:x:yStart:yEnd:)`](/documentation/Charts/RulePlot/init(_:x:yStart:yEnd:)-6ts7e)

[`init(_:x:yStart:yEnd:)`](/documentation/Charts/RulePlot/init(_:x:yStart:yEnd:)-8b2lx)

[`init(_:x:yStart:yEnd:)`](/documentation/Charts/RulePlot/init(_:x:yStart:yEnd:)-zxo0)

[`init(_:xStart:xEnd:y:)`](/documentation/Charts/RulePlot/init(_:xStart:xEnd:y:)-3dsvn)

[`init(_:xStart:xEnd:y:)`](/documentation/Charts/RulePlot/init(_:xStart:xEnd:y:)-4yxo8)

[`init(_:xStart:xEnd:y:)`](/documentation/Charts/RulePlot/init(_:xStart:xEnd:y:)-54gxx)

[`init(_:xStart:xEnd:y:)`](/documentation/Charts/RulePlot/init(_:xStart:xEnd:y:)-8ehr7)

[`init(_:xStart:xEnd:y:)`](/documentation/Charts/RulePlot/init(_:xStart:xEnd:y:)-hx5a)

### Supporting types

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

The content and behavior of the chart content.

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

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)