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

# init(x:y:)

Creates a point mark that plots a value on x with fixed y position.

## Declaration

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

## Parameters

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

## Discussion

Discussion Use this initializer to plot a property with x: Chart(data) {     PointMark(         x: .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:)-9dswq.md)
- [init(x:y:z:)](charts/pointmark/init(x:y:z:).md)
