Skip to content

ChartDraggable.LocationChanged

event · ChartDraggable · cAlgo.API Since 5.2

DesktopCLICloud

Occurs when the draggable's location is changed.

Environment behaviour

CLI — not supported. Never displayed: starts at X=0, Y=0; property changes are kept locally only and LocationChanged never fires.

Cloud — not supported. Never displayed: starts at X=0, Y=0; property changes are kept locally only and LocationChanged never fires.

Definition

event Action<ChartDraggableLocationChangedEventArgs> LocationChanged;
chartDraggable.LocationChanged += handler  # handler(obj: ChartDraggableLocationChangedEventArgs)

Examples

protected override void OnStart()
{
    var draggable = Chart.Draggables.Add();
    draggable.Child = new TextBlock { Text = SymbolName, BackgroundColor = Color.Black };
    draggable.LocationChanged += OnDraggableLocationChanged;
}

private void OnDraggableLocationChanged(ChartDraggableLocationChangedEventArgs args)
{
    Print("Draggable moved to {0}, {1}", args.Draggable.X, args.Draggable.Y);
}
def on_start(self):
    draggable = api.Chart.Draggables.Add()
    textBlock = TextBlock()
    textBlock.Text = api.SymbolName
    draggable.Child = textBlock
    draggable.LocationChanged += self.on_draggable_location_changed

def on_draggable_location_changed(self, args):
    api.Print(f"Draggable moved to {args.Draggable.X}, {args.Draggable.Y}")