> 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.

# ConvertToVerticalPixels

## Definition

Converts a y-axis pixel coordinate from application pixels to device pixels.

For more information concerning the differences between application pixels and device pixels, please see the [Working with Pixel Coordinates](/developer/desktop-sdk/guides/educational-resources/working-with-pixel-coordinates).

## Method Return Value

An int representing a y-coordinate value in terms of device pixels.

## Syntax

`ChartingExtensions.ConvertToVerticalPixels(this double x, PresentationSource target)`

`double.ConvertToVerticalPixels(PresentationSource target)`

## Parameters

| Parameter                                                        | Description                                                                                                                                                                                                                                                                                                              |
| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| x                                                                | target                                                                                                                                                                                                                                                                                                                   |
| The vertical double coordinates in application pixels to convert | The [PresenationSource](https://msdn.microsoft.com/en-us/library/system.windows.presentationsource\(v=vs.110\).aspx) representing the display surface used for the conversion. Note: For Charts, see [ChartControl.PresentationSource](/developer/desktop-sdk/references/common/charts/chartcontrol/presentationsource). |

## Examples

```csharp
int devicePixelY;

protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
{
    // Obtain the device-pixel coordinate corresponding to an application-pixel Y value of 500
    devicePixelY = ChartingExtensions.ConvertToVerticalPixels(500, ChartControl.PresentationSource);
}
```