BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Hi,
This thread is link to the following one but it is a different question
InteractiveCursor, how to convert Mouse position => OffsetX
So same use case; I have a Chart diplaying financial indictors (Xaxis is DateTime)
I want let user to move 2 vertival InteractiveCursor in order to define a Sub DateTime range.
Simple question : how can I have the related DateTime of each InteractiveCursor.
It must be simple because there is a label displaying that value when the InteractiveCursor is moved by the mouse.
I have attched a sample
Regards,
Rodolphe
Hi,
I tried to InteractiveCursor.DataPoint.X instead of InteractiveCursor.OffsetX .
There is way to find the related point; I'm doing a dichotomic search among InteractiveCursor.Selectedseries.Data.
This method is working as far as the InteractiveCursor.DataPoint is set. But actually it is not always the case, sometime it is null if the position of the InteractiveCursor is between 2 distant points.
So it is again a convertion question :
How to convert OffsetX <=> Data.X ??
Additional question: is there any event raised when the cursor is moving ?
Regards,
Rodolphe
Hi Rodolphe,
Thanks for using the Syncfusion products.
We have analyzed the reported requirement. You can achieve your requirement by help of PointToValue and ValueToPoint method in ChartArea.
Code snippet [C#]:
private void ChartArea_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
ChartArea area = sender as ChartArea;
var point = e.GetPosition(area);
var range = area.PointToValue(area.PrimaryAxis, point);
var date = DateTime.FromOADate(range);
}
We do not have interactive cursor moving event in ChartArea. But you can able to achieve with mouse move event in chartarea.
Code snippet [C#]:
private void ChartArea_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
{
ChartArea area = sender as ChartArea;
if((e.MouseDevice).LeftButton == System.Windows.Input.MouseButtonState.Pressed)
{
foreach (var item in area.InteractiveCursors)
{
if(item.IsMouseOver)
{
// Do something here of your requirement.
}
}
}
}
Please let us know if you require further assistance on this.
Regards,
Karthikeyan V.