> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ninjatrader.com/_mcp/server.

# GetYByValueWpf()

## Definition

Returns a WPF coordinate on the chart determined by a series value represented on the chart scale.

## Method Return Value

An double value representing a WPF coordinate on the chart scale.

## Syntax

`\<chartscale\>.GetYByValueWpf(double val)`

## Method Parameters

| Parameter | Description                                                            |
| --------- | ---------------------------------------------------------------------- |
| **val**   | A **double** value which usually represents a price or indicator value |

## Examples

```csharp
protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
{
   // gets the wpf coordinate of the price value passed to the method
   int     valueByYWpf = chartScale.GetYByValueWpf(Bars.GetClose(Bars.Count - 1));

   Print("valueByYWpf: " + valueByYWpf); // 207
}
```

In the image below, we pass the last bar close as the value (example logic avoids using a bars ago index, see also [**OnRender()**](/developer/desktop-sdk/references/common/charts/rendering/onrender) note #5), which in return tells us the last price displayed on the chart is at a WPF location of 207.30998 pixels.

![GetYByValueWpf](https://fdr-prod-docs-files-public.s3.us-east-1.amazonaws.com/ninjatrader-public.docs.buildwithfern.com/c0f3f9da8c9ded58a415fceac885da6ffbc41940046c3264cc8c26536b8dd24b/docs/assets/developer/desktop-sdk/references/getybyvaluewpf-getybyvaluewpf.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA6KXJSKKNFOCF7G4B%2F20260729%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20260729T071031Z&X-Amz-Expires=604800&X-Amz-Signature=9e1de82c01f9b46b82127d509b9c75a956c99db5dd08a2c6a8dcca865a7f67eb&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject)