One Logo Pool Ball
Charts · IOS API REFERENCE

AreaPlot

struct · iOS 18.0+ · SDK 27.1

struct AreaPlot<Content>

Chart content that represents a function or a collection of data using the area of one or more regions. Use `AreaPlot` when you want to visualize data in the same way as with ``AreaMark``, but you want to plot a function or visualize an entire data collection with a single plot. ### Plotting areas from a collection You can initialize and style the plot with simple values or key paths. Add modifiers with `KeyPath` before adding modifiers with simple values. ``` Chart { AreaPlot( portfolioElements, x: .value("Date", \.date), y: .value("Asset value", \.assetValue), series: .value("Asset", \.asset), stacking: .standard ) .foregroundStyle(by: .value("Asset", \.asset)) } ``` ### Plotting functions In addition to providing data points, you can provide a function to an `AreaPlot` to plot a function. For example, you can plot the area between y = x and y = x^2 - 1 with: ``` Chart { AreaPlot(x: "x", yStart: "x", yEnd: "x^2 - 1") { x in (yStart: x, yEnd: x * x - 1) } } .chartXScale(domain: -2 ... 2) .chartYScale(domain: -4 ... 4) ``` You can also provide a single function to an `AreaPlot`. In this case it will plot the area between zero and the given function. ``` Chart { AreaPlot(x: "x", y: "x^2 - 1") { x in x * x - 1 } } .chartXScale(domain: -2 ... 2) .chartYScale(domain: -4 ... 4) ```

Members (0)

This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.

Skipped declarations

15 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

AreaPlot.body

This protocol needs associated types that cannot yet cross the bridge.

AreaPlot.init(_:x:y:stacking:)

This declaration needs Swift generic type arguments. (no canonical witness for Data)

AreaPlot.init(_:xStart:xEnd:y:)

This declaration needs Swift generic type arguments. (no canonical witness for Data)

AreaPlot.init(_:x:yStart:yEnd:)

This declaration needs Swift generic type arguments. (no canonical witness for Data)

AreaPlot.init(_:x:y:series:stacking:)

This declaration needs Swift generic type arguments. (no canonical witness for Data)

AreaPlot.init(_:xStart:xEnd:y:series:)

This declaration needs Swift generic type arguments. (no canonical witness for Data)

AreaPlot.init(_:x:yStart:yEnd:series:)

This declaration needs Swift generic type arguments. (no canonical witness for Data)

AreaPlot.init(x:yStart:yEnd:domain:function:)

callback cannot propagate synchronous failure

AreaPlot.init(x:yStart:yEnd:domain:function:)

callback cannot propagate synchronous failure

AreaPlot.init(x:yStart:yEnd:domain:function:)

callback cannot propagate synchronous failure

AreaPlot.init(x:yStart:yEnd:domain:function:)

callback cannot propagate synchronous failure

AreaPlot.init(x:y:domain:function:)

callback cannot propagate synchronous failure

AreaPlot.init(x:y:domain:function:)

callback cannot propagate synchronous failure

AreaPlot.init(x:y:domain:function:)

callback cannot propagate synchronous failure

AreaPlot.init(x:y:domain:function:)

callback cannot propagate synchronous failure

All Charts types →