GetXByBarIndex()

View as Markdown

Definition

Returns the chart-canvas x-coordinate of the bar at a specified index of a specified ChartBars object on the chart.

Since the index is based upon bars that move across the chart canvas as new bars are painted, the value returned by GetXByBarIndex() can be expected to change as new bars are painted on the chart, or as the chart is scrolled backward or forward on the x-axis.

Method Return Value

An int representing a chart-canvas x-coordinate.

Syntax

\<chartcontrol\>.GetXByBarIndex(ChartBars chartBars, int barIndex)

Method Parameters

ParameterDescription
chartBarsThe ChartBars object to check.
barIndexThe slot index used to determine an x-coordinate.

Examples

1protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
2{
3 double xCoordinate = chartControl.GetXByBarIndex(ChartBars, 100);
4
5 // Print the x-coordinate value
6 Print(xCoordinate);
7}