<!--
{
  "documentType" : "article",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View-Chart-View",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Chart view modifiers"
}
-->

# Chart view modifiers

Configure charts that you declare with Swift Charts.

## Overview

Use these modifiers to configure a
<doc://com.apple.documentation/documentation/Charts/Chart> view
that you add to your SwiftUI app.

## Topics

### Styles

[`chartBackground(alignment:content:)`](/documentation/SwiftUI/View/chartBackground(alignment:content:))

Adds a background to a view that contains a chart.

[`chartForegroundStyleScale(_:)`](/documentation/SwiftUI/View/chartForegroundStyleScale(_:))

Configures the foreground style scale for charts.

[`chartForegroundStyleScale(domain:range:type:)`](/documentation/SwiftUI/View/chartForegroundStyleScale(domain:range:type:))

Configures the foreground style scale for charts.

[`chartForegroundStyleScale(domain:type:)`](/documentation/SwiftUI/View/chartForegroundStyleScale(domain:type:))

Configures the foreground style scale for charts.

[`chartForegroundStyleScale(domain:mapping:)`](/documentation/SwiftUI/View/chartForegroundStyleScale(domain:mapping:))

Configures the foreground style scale for charts.

[`chartForegroundStyleScale(mapping:)`](/documentation/SwiftUI/View/chartForegroundStyleScale(mapping:))

Configures the foreground style scale for charts.

[`chartForegroundStyleScale(range:type:)`](/documentation/SwiftUI/View/chartForegroundStyleScale(range:type:))

Configures the foreground style scale for charts.

[`chartForegroundStyleScale(type:)`](/documentation/SwiftUI/View/chartForegroundStyleScale(type:))

Configures the foreground style scale for charts.

[`chartPlotStyle(content:)`](/documentation/SwiftUI/View/chartPlotStyle(content:))

Configures the plot area of charts.

### 3D configuration

[`chart3DCameraProjection(_:)`](/documentation/SwiftUI/View/chart3DCameraProjection(_:))

[`chart3DPose(_:)`](/documentation/SwiftUI/View/chart3DPose(_:))

Associates a binding to be updated when the 3D chart’s pose is changed by an interaction.

[`chart3DRenderingStyle(_:)`](/documentation/SwiftUI/View/chart3DRenderingStyle(_:))

### Legends

[`chartLegend(_:)`](/documentation/SwiftUI/View/chartLegend(_:))

Configures the legend for charts.

[`chartLegend(position:alignment:spacing:)`](/documentation/SwiftUI/View/chartLegend(position:alignment:spacing:))

Configures the legend for charts.

[`chartLegend(position:alignment:spacing:content:)`](/documentation/SwiftUI/View/chartLegend(position:alignment:spacing:content:))

Configures the legend for charts.

### Overlays

[`chartOverlay(alignment:content:)`](/documentation/SwiftUI/View/chartOverlay(alignment:content:))

Adds an overlay to a view that contains a chart.

### Axes

[`chartXAxis(_:)`](/documentation/SwiftUI/View/chartXAxis(_:))

Sets the visibility of the x axis.

[`chartXAxis(content:)`](/documentation/SwiftUI/View/chartXAxis(content:))

Configures the x-axis for charts in the view.

[`chartXAxisStyle(content:)`](/documentation/SwiftUI/View/chartXAxisStyle(content:))

Configures the x axis content of charts.

[`chartYAxis(_:)`](/documentation/SwiftUI/View/chartYAxis(_:))

Sets the visibility of the y axis.

[`chartYAxis(content:)`](/documentation/SwiftUI/View/chartYAxis(content:))

Configures the y-axis for charts in the view.

[`chartYAxisStyle(content:)`](/documentation/SwiftUI/View/chartYAxisStyle(content:))

Configures the y axis content of charts.

[`chartZAxis(_:)`](/documentation/SwiftUI/View/chartZAxis(_:))

Sets the visibility of the z axis.

[`chartZAxis(content:)`](/documentation/SwiftUI/View/chartZAxis(content:))

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

### Axis Labels

[`chartXAxisLabel(_:position:alignment:spacing:)`](/documentation/SwiftUI/View/chartXAxisLabel(_:position:alignment:spacing:))

Adds x axis label for charts in the view.

[`chartXAxisLabel(position:alignment:spacing:content:)`](/documentation/SwiftUI/View/chartXAxisLabel(position:alignment:spacing:content:))

Adds x axis label for charts in the view.

[`chartYAxisLabel(_:position:alignment:spacing:)`](/documentation/SwiftUI/View/chartYAxisLabel(_:position:alignment:spacing:))

Adds y axis label for charts in the view.

[`chartYAxisLabel(position:alignment:spacing:content:)`](/documentation/SwiftUI/View/chartYAxisLabel(position:alignment:spacing:content:))

Adds y axis label for charts in the view.

[`chartZAxisLabel(_:position:alignment:spacing:)`](/documentation/SwiftUI/View/chartZAxisLabel(_:position:alignment:spacing:))

Adds z axis label for charts in the view. It effects 3D charts only.

### Axis scales

[`chartXScale(domain:range:type:)`](/documentation/SwiftUI/View/chartXScale(domain:range:type:))

Configures the x scale for charts.

[`chartXScale(domain:type:)`](/documentation/SwiftUI/View/chartXScale(domain:type:))

Configures the x scale for charts.

[`chartXScale(range:type:)`](/documentation/SwiftUI/View/chartXScale(range:type:))

Configures the x scale for charts.

[`chartXScale(type:)`](/documentation/SwiftUI/View/chartXScale(type:))

Configures the x scale for charts.

[`chartYScale(domain:range:type:)`](/documentation/SwiftUI/View/chartYScale(domain:range:type:))

Configures the y scale for charts.

[`chartYScale(domain:type:)`](/documentation/SwiftUI/View/chartYScale(domain:type:))

Configures the y scale for charts.

[`chartYScale(range:type:)`](/documentation/SwiftUI/View/chartYScale(range:type:))

Configures the y scale for charts.

[`chartYScale(type:)`](/documentation/SwiftUI/View/chartYScale(type:))

Configures the y scale for charts.

[`chartZScale(domain:range:type:)`](/documentation/SwiftUI/View/chartZScale(domain:range:type:))

Configures the z scale for 3D charts.

[`chartZScale(domain:type:)`](/documentation/SwiftUI/View/chartZScale(domain:type:))

Configures the z scale for 3D charts.

[`chartZScale(range:type:)`](/documentation/SwiftUI/View/chartZScale(range:type:))

Configures the z scale for 3D charts.

### Symbol scales

[`chartSymbolScale(_:)`](/documentation/SwiftUI/View/chartSymbolScale(_:))

Configures the symbol scale for charts.

[`chartSymbolScale(domain:)`](/documentation/SwiftUI/View/chartSymbolScale(domain:))

Configures the symbol style scale for charts.

[`chartSymbolScale(domain:range:)`](/documentation/SwiftUI/View/chartSymbolScale(domain:range:))

Configures the symbol style scale for charts.

[`chartSymbolScale(domain:mapping:)`](/documentation/SwiftUI/View/chartSymbolScale(domain:mapping:))

Configures the symbol scale for charts.

[`chartSymbolScale(mapping:)`](/documentation/SwiftUI/View/chartSymbolScale(mapping:))

Configures the symbol scale for charts.

[`chartSymbolScale(range:)`](/documentation/SwiftUI/View/chartSymbolScale(range:))

Configures the symbol style scale for charts.

### Symbol size scales

[`chartSymbolSizeScale(_:)`](/documentation/SwiftUI/View/chartSymbolSizeScale(_:))

Configures the symbol size scale for charts.

[`chartSymbolSizeScale(domain:range:type:)`](/documentation/SwiftUI/View/chartSymbolSizeScale(domain:range:type:))

Configures the symbol size scale for charts.

[`chartSymbolSizeScale(domain:type:)`](/documentation/SwiftUI/View/chartSymbolSizeScale(domain:type:))

Configures the symbol size scale for charts.

[`chartSymbolSizeScale(domain:mapping:)`](/documentation/SwiftUI/View/chartSymbolSizeScale(domain:mapping:))

Configures the symbol size scale for charts.

[`chartSymbolSizeScale(mapping:)`](/documentation/SwiftUI/View/chartSymbolSizeScale(mapping:))

Configures the symbol size scale for charts.

[`chartSymbolSizeScale(range:type:)`](/documentation/SwiftUI/View/chartSymbolSizeScale(range:type:))

Configures the symbol size scale for charts.

[`chartSymbolSizeScale(type:)`](/documentation/SwiftUI/View/chartSymbolSizeScale(type:))

Configures the symbol size scale for charts.

### Line style scales

[`chartLineStyleScale(_:)`](/documentation/SwiftUI/View/chartLineStyleScale(_:))

Configures the line style scale for charts.

[`chartLineStyleScale(domain:)`](/documentation/SwiftUI/View/chartLineStyleScale(domain:))

Configures the line style scale for charts.

[`chartLineStyleScale(domain:range:)`](/documentation/SwiftUI/View/chartLineStyleScale(domain:range:))

Configures the line style scale for charts.

[`chartLineStyleScale(range:)`](/documentation/SwiftUI/View/chartLineStyleScale(range:))

Configures the line style scale for charts.

[`chartLineStyleScale(domain:mapping:)`](/documentation/SwiftUI/View/chartLineStyleScale(domain:mapping:))

Configures the line style scale for charts.

[`chartLineStyleScale(mapping:)`](/documentation/SwiftUI/View/chartLineStyleScale(mapping:))

Configures the line style scale for charts.

### Scrolling

[`chartScrollPosition(initialX:)`](/documentation/SwiftUI/View/chartScrollPosition(initialX:))

Sets the initial scroll position along the x-axis.
Once the user scrolls the scroll view, the value provided to this
modifier will have no effect.

[`chartScrollPosition(initialY:)`](/documentation/SwiftUI/View/chartScrollPosition(initialY:))

Sets the initial scroll position along the y-axis.
Once the user scrolls the scroll view, the value provided to this
modifier will have no effect.

[`chartScrollPosition(x:)`](/documentation/SwiftUI/View/chartScrollPosition(x:))

Associates a binding to be updated when the chart scrolls along the x-axis.

[`chartScrollPosition(y:)`](/documentation/SwiftUI/View/chartScrollPosition(y:))

Associates a binding to be updated when the chart scrolls along the y-axis.

[`chartScrollTargetBehavior(_:)`](/documentation/SwiftUI/View/chartScrollTargetBehavior(_:))

Sets the scroll behavior of the scrollable chart.

[`chartScrollableAxes(_:)`](/documentation/SwiftUI/View/chartScrollableAxes(_:))

Configures the scrollable behavior of charts in this view.

### Selection

[`chartXSelection(range:)`](/documentation/SwiftUI/View/chartXSelection(range:))

[`chartXSelection(value:)`](/documentation/SwiftUI/View/chartXSelection(value:))

[`chartYSelection(range:)`](/documentation/SwiftUI/View/chartYSelection(range:))

[`chartYSelection(value:)`](/documentation/SwiftUI/View/chartYSelection(value:))

[`chartZSelection(range:)`](/documentation/SwiftUI/View/chartZSelection(range:))

[`chartZSelection(value:)`](/documentation/SwiftUI/View/chartZSelection(value:))

[`chartAngleSelection(value:)`](/documentation/SwiftUI/View/chartAngleSelection(value:))

### Visible domain

[`chartXVisibleDomain(length:)`](/documentation/SwiftUI/View/chartXVisibleDomain(length:))

Sets the length of the visible domain in the X dimension.

[`chartYVisibleDomain(length:)`](/documentation/SwiftUI/View/chartYVisibleDomain(length:))

Sets the length of the visible domain in the Y dimension.

### Interaction

[`chartGesture(_:)`](/documentation/SwiftUI/View/chartGesture(_:))



---

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)