GetBarPaintWidth()

View as Markdown

Definition

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

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 override this method using the following syntax:

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

Method Parameters

ParameterDescription
barWidthAn int value representing the current width of the bar to calculate

Examples

Returning the default barWidth

1public override int GetBarPaintWidth(int barWidth)
2{
3 return barWidth
4}

Calculating and returning a new barWidth from the original barWidth

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