Skip to content

ChartMouseEventArgs

Summary

Provides data for the mouse related routed events.

Signature

1
public class ChartMouseEventArgs

Namespace

cAlgo.API

Properties

Name Description
Chart { get; } Gets the chart.
ChartArea { get; } Gets the chart area.
MouseX { get; } Gets the X-axis value of the mouse event.
MouseY { get; } Gets the Y-axis value of the mouse event.
TimeValue { get; } Gets the time value on the X-axis where the mouse event occurs.
BarIndex { get; } Gets the exact bar index of the mouse event.
YValue { get; } Gets the Y-axis value of the mouse event.
CtrlKey { get; } Defines whether the Ctrl key is pressed during the mouse event.
ShiftKey { get; } Defines whether the Shift key is pressed during the mouse event.
AltKey { get; } Defines whether the Alt key is pressed during the mouse event.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
 using cAlgo.API;
 namespace cAlgo
 {
     // This example shows how to use the Chart ChartMouseEventArgs
     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class ChartMouseEventArgsSample : Indicator
     {
         protected override void Initialize()
         {
             Chart.MouseMove += Chart_MouseMove; ;
         }
         private void Chart_MouseMove(ChartMouseEventArgs obj)
         {
             var text = string.Format("Mouse Location: ({0}, {1})", obj.MouseX, obj.MouseY);
             Chart.DrawStaticText("mouse", text, VerticalAlignment.Top, HorizontalAlignment.Right, Color.Red);
         }
         public override void Calculate(int index)
         {
         }
     }
 }

See Also


Last update: March 23, 2023