<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/chartZAxis(content:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewP6ChartsE10chartZAxis7contentQrqd__yXE_tAD11AxisContentRd__lF"
  },
  "title" : "chartZAxis(content:)"
}
-->

# chartZAxis(content:)

Configures the z-axis for 3D charts in the view.

```
nonisolated func chartZAxis<Content>(@AxisContentBuilder content: () -> Content) -> some View where Content : AxisContent
```

## Parameters

`content`

The axis content.

## Discussion

Use this modifier to customize the z-axis of a chart. Provide an `AxisMarks` builder
that composes `AxisGridLine`, `AxisTick`, and `AxisValueLabel`
structures to form the axis. Omit components from the builder to omit them from the
resulting axis. For example, the following code adds grid lines to the z-axis:

```
.chartZAxis {
    AxisMarks {
        AxisGridLine()
    }
}
```

Use arguments such as `position:` or `values:` to control the placement of the axis
values it displays.

> Note: To add an axis label, use one of the label modifiers, like
> <doc://com.apple.documentation/documentation/SwiftUI/View/chartZAxisLabel(position:alignment:spacing:content:)>.

---

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)