---
title: "init(x:yStart:yEnd:domain:function:)"
framework: charts
role: symbol
role_heading: Initializer
path: "charts/areaplot/init(x:ystart:yend:domain:function:)-etcn"
---

# init(x:yStart:yEnd:domain:function:)

Creates a mark that fills the area between two functions (yStart, yEnd) = f(x).

## Declaration

```swift
nonisolated init(x: Text, yStart: Text, yEnd: Text, domain: ClosedRange<Double>? = nil, function: @escaping @Sendable (Double) -> (yStart: Double, yEnd: Double))
```

## Discussion

Discussion Parameters: x: The localized string key for the x label. yStart: The localized string key for the start label. yEnd: The localized string key for the end 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. Returns a tuple of (yStart: yStart, yEnd: yEnd). 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:y:domain:function:)](charts/areaplot/init(x:y:domain:function:)-39eit.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)
