---
title: "init(x:y:stacking:)"
framework: charts
role: symbol
role_heading: Initializer
path: "charts/areamark/init(x:y:stacking:)"
---

# init(x:y:stacking:)

Creates an area mark using the specified horizontal and vertical positions.

## Declaration

```swift
nonisolated init<X, Y>(x: PlottableValue<X>, y: PlottableValue<Y>, stacking: MarkStackingMethod = .standard) where X : Plottable, Y : Plottable
```

## Parameters

- `x`: The horizontal position for the mark.
- `y`: The vertical position for the mark.
- `stacking`: The way in which the chart stacks area regions. The default is doc://com.apple.Charts/documentation/Charts/MarkStackingMethod/standard.

## Discussion

Discussion You can use this initializer to create a basic area chart: Chart(cheeseburgerCost) { cost in     AreaMark(         x: .value("Date", cost.date),         y: .value("Price", cost.price)     ) } The resulting chart automatically scales and labels the axes based on the data, and fills the area under the data points with a default color:

## See Also

### Creating an area mark

- [init(x:y:series:stacking:)](charts/areamark/init(x:y:series:stacking:).md)
