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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Find Corresponding Interpolate Value in SfChart with Spline Type

Thread ID:

Created:

Updated:

Platform:

Replies:

145564 Jun 28,2019 06:36 AM UTC Jul 1,2019 10:14 AM UTC WPF 1
loading
Tags: SfChart
Xamarin Hunter
Asked On June 28, 2019 06:36 AM UTC

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?

 


Muneesh Kumar G [Syncfusion]
Replied On 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"> 
                <chart:SplineSeries.TooltipTemplate> 
                    <DataTemplate> 
                        <TextBlock > 
                            <Run Text="Q1 : "/> 
                            <Run Text="{Binding Q1}"/> 
                        </TextBlock> 
                    </DataTemplate> 
                </chart:SplineSeries.TooltipTemplate> 
            </chart:SplineSeries> 
 
 
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.  
   
Regards,   
Muneesh Kumar G.  
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon