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

# GetPixelsForDistance()

## Definition

Returns the number of device pixels between the value passed to the method representing a series point value on the chart scale.

## Method Return Value

A float representing the number of pixels between a value.

## Syntax

`\<chartscale\>.GetPixelsForDistance(double distance)`

## Method Parameters

| Parameter | Description                                                           |
| --------- | --------------------------------------------------------------------- |
| distance  | A **double** value representing the distance in points to be measured |

## Examples

```csharp

protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
{
   // the number of pixels between the point value passed as a distance to the method
   float pixelForDistance = chartScale.GetPixelsForDistance(0.25);

   Print("pixelForDistance: " + pixelForDistance); //20 pixels per every 1 tick on the chart scale

}
```

In the image below, we pass a value of 1 for the distance, which tells us there are 76 pixels for every 1 point on the ES 06-15 chart scale.

![GetPixelsForDistance](https://fdr-prod-docs-files-public.s3.us-east-1.amazonaws.com/ninjatrader-public.docs.buildwithfern.com/5237364f92257c94b54452c667601cec28fc664a9fb135e82aed0ff874054b2b/docs/assets/developer/desktop-sdk/references/getpixelsfordistance-getpixelsfordistance.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=20260729T062328Z&X-Amz-Expires=604800&X-Amz-Signature=fee45dfe386a1f5f66edc9a9aae84ee47abbfb96b3c4ae8a30a456f91829129a&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject)