We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

InteractiveCursor, how to convert Mouse position => OffsetX


I have a Chart diplaying financial indictors  (Xaxis is DateTime)

I want to dynamicaly add some InteractiveCursor (Only VerticalCurso)  in the Chart using the mouse a the exact place where I click (for instance with right click).

I tried the code below but there is a gap between mouse and  the InteractiveCursor X position

That seems to be the margine between the area and beginning of the axis/series.

I used a constant value '-44' to fix that gap, but it is a crapy solution.

How can I set correctly the OffsetX from the Mouse position ?


Code Snippet [C#]:

private void ChartAreaMouseRightButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
 var point = e.GetPosition(sender as ChartArea);
 currentCursor = new InteractiveCursor
  OffsetX = point.X - 44,
  IsBindWithSegment = false,
  BindWithMouseMoveOnSegment = false,                                                                         
  HorizontalCursorVisibility = Visibility.Hidden,
  VerticalLabelVisibility = Visibility.Hidden,




2 Replies

KV Karthikeyan V Syncfusion Team January 21, 2014 12:47 PM UTC

Hi Rodolphe,

Thanks for using the Syncfusion products.

We have analysed the reported requirement. You can achieve your requirement by applying the below code snippet.

Code snippet [C#]:

        private void ChartArea_MouseRightButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)


            var point = e.GetPosition(sender as ChartArea);


            InteractiveCursor currentCursor = new InteractiveCursor


                OffsetX = point.X - this.Chart1.Areas[0].AxesThickness.Left - ((sender as ChartArea).ElementMargin.Left *4),

                IsBindWithSegment = false,

                IsBindWithMouseMove = false,

                BindWithMouseMoveOnSegment = false,

                HorizontalCursorVisibility = Visibility.Hidden,

                VerticalLabelVisibility = Visibility.Hidden





Please let us know if you require further assistance on this.


Karthikeyan V.

RB Rodolphe Billottet January 22, 2014 01:08 AM UTC

Hi Karthikeyan,


Thanks for the solution. That works fine.


Best Regards,


Live Chat Icon For mobile
Up arrow icon