GetBarPaintWidth()

View as Markdown

Definition

Returns the width of the bars in the primary Bars object on the chart, in pixels.

Method Return Value

A double representing the pixel width of bars on the chart.

Syntax

\<chartcontrol\>.GetBarPaintWidth(ChartBars chartBars)

Method Parameters

ParameterDescription
chartBarsA ChartBars object to measure

Examples

1protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
2{
3 // Use BarsArray[0] to pass in a ChartBars object representing the primary Bars object on the chart
4 double barPixelWidth = chartControl.GetBarPaintWidth(chartControl.BarsArray[0]);
5
6 // Print the pixel width of bars painted on the chart
7 Print(String.Format("Bars on the chart are {0} pixels wide", barPixelWidth));
8}

In the image below, GetBarPaintWidth() reveals that the bars are being drawn 27 pixels wide on the chart:

ChartControl_GetBarPaintWidth