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

Find Corresponding Interpolate Value in SfChart with Spline Type

I've created SfChart as a spline type. I have two root arrays which have double type elements; the first one is X array and the next one is Y array. The element of each X array corresponds to an element of Y array. Like at below. These arrays contain more than ten float or int values.

double [] X = …

double [] Y = …

I want to find an interpolation value belong to spline with any method. It can be linear, non-linear, regression, cubic or more complex; not matter. 
I need the specific points between the X-Y data values which I used. I have known only the Y value of these points, but I can’t find the corresponding X value.
For example, Y=2 then X=? or X=5 then Y=?
I want to find interpolated value or shown on spline as a mouse tooltip. Is there any way to solve this?


1 Reply

MK Muneesh Kumar G Syncfusion Team July 1, 2019 10:14 AM UTC

Hi Utemar, 
Greetings from Syncfusion,  
We have analyzed your requirement and you can achieve this by overriding TooltipTemplate in SplineSeries as per the below code snippet.  
Code snippet 
<chart:SplineSeries XBindingPath="XValue" YBindingPath="YValue" MouseMove="SplineSeries_MouseMove" 
                             ItemsSource="{Binding Data}" ShowTooltip="True"> 
                        <TextBlock > 
                            <Run Text="Q1 : "/> 
                            <Run Text="{Binding Q1}"/> 
Each SplineSegment have two intermediate points Q1 and Q2. You can get these values in series mouse move as per the below code snippet.  
Code snippet 
private void SplineSeries_MouseMove(object sender, MouseEventArgs e) 
            if(e.OriginalSource is Path ) 
                SplineSegment segment = (e.OriginalSource as Path).Tag as SplineSegment; 
                var q1 = segment.Q1; 
                var q2 = segment.Q2; 
We have prepared a sample based on this, please find the sample from the following location.  
Please let us know if you have any other queries.  
Muneesh Kumar G.  

Live Chat Icon For mobile
Up arrow icon