get coordinates at intersection of trackball and line

Use case: I would like to draw a custom shape at the intersection of the trackball and lines

My chart has two lines and I am trying to get a coordinate for each line where the lines intersect the trackball.

Simply, rather than using the `InteractiveTooltip` I would like to draw a custom Tooltip/shape.

Currently I am utilizing `TrackballArgs` and `chartPointInfo.xPosition` & `chartPointInfo.yPosition`. However, this only gives me the coordinate for one of the line. 

It's important I get the coordinates for both lines. 

Is this possible? if so, how can I do it? 


4 Replies 1 reply marked as answer

SK Sriram Kiran Senthilkumar Syncfusion Team July 20, 2020 11:38 AM UTC

Hi Nate, 
  
We have analyzed your scenario and as of now, the onTrackballPositionChanging event available in our chart widget is firing several times when user interaction is done and due to this, we are not able to properly get the correct coordinate intersection points from the chart. We will consider this as a bug, and we will include the fix for the reported issue in our upcoming weekly patch release which is expected to be rolled out by the middle of next week. We will update you once the release is rolled out and we appreciate your patience until then. 
  
Regards, 
Sriram Kiran. 



SK Sriram Kiran Senthilkumar Syncfusion Team July 29, 2020 11:42 AM UTC

Hi Nate, 
 
Thanks for your patience. The reported issue regarding the onTrackballPositionChanging event firing several times when doing user interaction is fixed now and rolled out in our weekly patch release. In this fix, we have also added a new field/variable in the chartPointInfo argument called the seriesIndex with which you can be able to achieve your requirement regarding getting the coordinate points of intersection of both line series in the chart. To achieve this, kindly upgrade the chart widget package to the latest version below. 
 
We have also created a simple sample in which we have used the seriesIndex variable of the chartPointInfo argument to get the coordinate points of intersection when trackball user interaction is done in the chart. Please refer the code snippet below for reference. 
  SfCartesianChart( 
            onTrackballPositionChanging: (TrackballArgs args) { 
                  if (args.chartPointInfo.seriesIndex == 0) { // Printing Coordinate intersect point of first line 
                    print('x:' + args.chartPointInfo.xPosition.toString()); 
                    print('y:' + args.chartPointInfo.yPosition.toString()); 
                  } 
                  if (args.chartPointInfo.seriesIndex == 1) { // Printing Coordinate intersect point of second line 
                    print('x:' + args.chartPointInfo.xPosition.toString()); 
                    print('y:' + args.chartPointInfo.yPosition.toString()); 
                  } 
            }, 
) 
  
The sample for reference can be found below, 
  
Please check the attached sample and revert us if you require further assistance. 
 
Regards, 
Sriram Kiran. 


Marked as answer

ND Nate D July 29, 2020 06:02 PM UTC

Hi Sriram, 

Thank you so very much. It is working as expected now! 
I appreciate your prompt response and sample code.


AR Arun Raji Syncfusion Team July 30, 2020 05:52 AM UTC

Hi Nate,

Thanks for your update. Feel free to revert us, if you need any other assistance on this.

Thanks,
Arun

Loader.
Up arrow icon