<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Charts",
  "identifier" : "/documentation/Charts/AreaMark/init(x:y:stacking:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Swift Charts"
    ],
    "preciseIdentifier" : "s:6Charts8AreaMarkV1x1y8stackingAcA14PlottableValueVyxG_AHyq_GAA0C14StackingMethodVtcAA0E0RzAaMR_r0_lufc"
  },
  "title" : "init(x:y:stacking:)"
}
-->

# init(x:y:stacking:)

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

```
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 [`standard`](/documentation/Charts/MarkStackingMethod/standard).

## 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:

![A chart that shows the years 1960 to 2020 on the x-axis and a number in the range of 0 to 1.5 on the y-axis. An irregular, monotonically increasing, piecewise linear curve starts near the lower left and continues toward the upper right. The area under the curve is filled in with a blue color.](images/com.apple.Charts/AreaMark-1-macOS@2x.png)

---

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)