Skip to content

ChartArea.ScrollChanged

event · ChartArea · cAlgo.API

DesktopCLICloud

Occurs when the X-axis position value or the Y-axis position value changes while scrolling.

Environment behaviour

CLI — works differently. Only the cBot's own scrolling can raise it; no user can scroll a chart in the CLI.

Cloud — not supported. Never raised: the cloud host does not report viewport changes.

Definition

event Action<ChartScrollEventArgs> ScrollChanged;
chartArea.ScrollChanged += handler  # handler(obj: ChartScrollEventArgs)

Examples

protected override void OnStart()
{
    Chart.ScrollChanged += OnChartScrollChanged;
}

private void OnChartScrollChanged(ChartScrollEventArgs args)
{
    Print("Scrolled by {0} bars | Top Y delta: {1}", args.BarsDelta, args.TopYDelta);
}
def on_start(self):
    api.Chart.ScrollChanged += self.on_chart_scroll_changed

def on_chart_scroll_changed(self, args):
    api.Print(f"Scrolled by {args.BarsDelta} bars | Top Y delta: {args.TopYDelta}")