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

Placing trendline under it series

Hello, Syncfusion team!
Got one question for you. How to place trendline under it lineseries?
By default it lies over it basic line and overlays it if they match. It spoils ability of segment drag and drop lineseries in points where trendline and lineseries match.

Best regards, Ivan.

1 Reply

MK Muneesh Kumar G Syncfusion Team December 31, 2018 07:39 AM UTC

Hi Ivan, 
Greetings from Syncfusion, we have analyzed your requirement and you can achieve this by extending LineSeries, overriding CreateSegments method then setting ZIndex for line segment visual as per the below code snippet.  
Code snippet 
public class CustomLineSeries :LineSeries 
        public override void CreateSegments() 
            foreach (var segment in Segments) 
                Canvas.SetZIndex(segment.GetRenderedVisual(), 100); 
           <local:CustomLineSeries XBindingPath="XValue" StrokeThickness="5" 
                              YBindingPath="YValue" ItemsSource="{Binding Data}"> 
                    <chart:Trendline /> 
We have prepared a sample based on this, please find the sample from the following location.  
Hope this helps.  
Muneesh Kumar G. 

Live Chat Icon For mobile
Up arrow icon