<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Charts",
  "identifier" : "/documentation/Charts/RuleMark/init(x:y:z:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Swift Charts",
      "Charts"
    ],
    "preciseIdentifier" : "s:6Charts8RuleMarkV1x1y1zAcA14PlottableValueVyxG_AHyq_GAHyq0_GtcAA0D0RzAaLR_AaLR0_r1_lufc"
  },
  "title" : "init(x:y:z:)"
}
-->

# init(x:y:z:)

Creates a horizontal or vertical rule mark for a  3D chart.

```
nonisolated init(x: PlottableValue<some Plottable>, y: PlottableValue<some Plottable>, z: PlottableValue<some Plottable>)
```

## Parameters

`x`

The x value.

`y`

The y value.

`z`

The z value.

## Discussion> Important: A 3D RuleMark requires exactly two numeric points and one numeric range.

Use this initializer to create rules at positions along two axes, and a range along a third axis:

```swift
Chart3D {
    // A red rule from from -0.5 to 0.5 on the x-axis, positioned at y = 0, z = 0
    RuleMark(
        x: .value("x", -0.5..<0.5),
        y: .value("y", 0),
        z: .value("z", 0)
    )
    .foregroundStyle(.red)

    // A green rule from -0.5 to 0.5 on the y-axis, positioned at x = 0, z = 0
    RuleMark(
        x: .value("x", 0),
        y: .value("y", -0.5..<0.5),
        z: .value("z", 0)
    )
    .foregroundStyle(.green)

    // A blue rule from from -0.5 to 0.5 on the z-axis, positioned at x = 0, y = 0
    RuleMark(
        x: .value("x", 0),
        y: .value("y", 0),
        z: .value("z", -0.5..<0.5)
    )
    .foregroundStyle(.blue)
}
```

---

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)