---
title: "value(atX:as:)"
framework: charts
role: symbol
role_heading: Instance Method
path: "charts/chartproxy/value(atx:as:)"
---

# value(atX:as:)

Returns the data value at the given x position, or nil if the position does not correspond to a valid X value.

## Declaration

```swift
func value<P>(atX position: CGFloat, as: P.Type = P.self) -> P? where P : Plottable
```

## Parameters

- `position`: The position at which to obtain the x data value. It should be relative to the plot.

## Return Value

Return Value The data value at the given position.
