---
title: "init(x:y:)"
framework: charts
role: symbol
role_heading: Initializer
path: "charts/pointmark/init(x:y:)-9dswq"
---

# init(x:y:)

Creates a point mark with fixed x position and plots values with y.

## Declaration

```swift
nonisolated init<Y>(x: CGFloat? = nil, y: PlottableValue<Y>) where Y : Plottable
```

## Parameters

- `x`: The x position. If x is nil, the bar will be centered horizontally by default.
- `y`: The value plotted with y.

## Discussion

Discussion Use this initializer to plot a property to y: Chart(data) {     PointMark(         y: .value("Weight", $0.weight)     ) }

For more background, see the first example used in PointMark which shows the structure that contains the weight property.

## See Also

### Creating a point mark

- [init(x:y:)](charts/pointmark/init(x:y:)-44ke9.md)
- [init(x:y:)](charts/pointmark/init(x:y:)-9hppd.md)
- [init(x:y:z:)](charts/pointmark/init(x:y:z:).md)
