Skip to content

ChartArea.XToBarIndex

method · ChartArea · cAlgo.API

DesktopCLICloud

Converts X coordinate to bar index.

Environment behaviour

CLI — not supported. Always returns 0; no conversion is done.

Cloud — not supported. Always returns 0; no conversion is done.

Definition

double XToBarIndex(double x)
chartArea.XToBarIndex(x: float) -> float

Parameters

Name C# type Python type Description
x double float X coordinate

Returns double — Bar Index

Examples

var barIndex = Chart.XToBarIndex(Chart.Width / 2);
Print("Bar index at the chart center: {0}", barIndex);
barIndex = api.Chart.XToBarIndex(api.Chart.Width / 2)
api.Print(f"Bar index at the chart center: {barIndex}")