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

# GetBarPaintWidth()

## Definition

Returns the painted width of the chart bar. The **GetBarPaintWidth()** method will return a minimum value of 1.

This is an [abstract](https://msdn.microsoft.com/en-us/library/sf985hc5.aspx) method which is required to compile a ChartStyle object. If you do not plan on recalculating a barWidth, simply return the default barWidth parameter which is passed in this method. Please see the Examples section of this page for more information.

## Method Return Value

An **int** value

## Syntax

You must override this method using the following syntax:

`public override int GetBarPaintWidth(int barWidth) \{ \}`

## Method Parameters

| Parameter    | Description                                                             |
| ------------ | ----------------------------------------------------------------------- |
| **barWidth** | An **int** value representing the current width of the bar to calculate |

## Examples

### Returning the default barWidth

```csharp

public override int GetBarPaintWidth(int barWidth)
{
    return barWidth
}

```

### Calculating and returning a new barWidth from the original barWidth

```csharp
public override int GetBarPaintWidth(int barWidth)
{
    // calculate a new bar width 
    return 1 + 2 * (barWidth - 1) + 2 * (int) Math.Round(Stroke.Width);
}
```