---
title: "init(x:y:domain:function:)"
framework: charts
role: symbol
role_heading: Initializer
path: "charts/areaplot/init(x:y:domain:function:)-39eit"
---

# init(x:y:domain:function:)

Creates a mark that fills the area between zero and the given function.

## Declaration

```swift
nonisolated init<S1, S2>(x: S1, y: S2, domain: ClosedRange<Double>? = nil, function: @escaping @Sendable (Double) -> Double) where S1 : StringProtocol, S2 : StringProtocol
```

## Discussion

Discussion Parameters: x: The localized string key for the x label. y: The localized string key for the y label. domain: The domain of x. If set to nil, the domain of the chart’s x scale will be used. function: The function to graph.. note: For x values where the function is undefined or is infinity, the function is expected to return Double.nan or Double.infinity respectively.

## See Also

### Plotting functions

- [init(x:y:domain:function:)](charts/areaplot/init(x:y:domain:function:)-2fab1.md)
- [init(x:y:domain:function:)](charts/areaplot/init(x:y:domain:function:)-1jmpp.md)
- [init(x:y:domain:function:)](charts/areaplot/init(x:y:domain:function:)-etud.md)
- [init(x:yStart:yEnd:domain:function:)](charts/areaplot/init(x:ystart:yend:domain:function:)-etcn.md)
- [init(x:yStart:yEnd:domain:function:)](charts/areaplot/init(x:ystart:yend:domain:function:)-9gui6.md)
- [init(x:yStart:yEnd:domain:function:)](charts/areaplot/init(x:ystart:yend:domain:function:)-5akqm.md)
- [init(x:yStart:yEnd:domain:function:)](charts/areaplot/init(x:ystart:yend:domain:function:)-23gxe.md)
