GetBarPaintWidth()

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Chart Style >

GetBarPaintWidth()

Previous page Return to chapter overview Next page

Definition

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

 

Note:  This is an abstract 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 over ride this method using the following syntax:

 

public override int GetBarPaintWidth(int barWidth)
{
 
}

 

Method Parameters

barWidth

An int value representing the current width of the bar to calculate

 

 

Examples

ns Returning the default barWidth

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

 

 

 

ns Calculating and returning a new barWidth from the original barWidth

public override int GetBarPaintWidth(int barWidth)
{

  // calculate a new bar width
  return 1 + 2 * (barWidth - 1) + 2 * (int) Math.Round(Stroke.Width);
}