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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set the Z Index to the series?

Platform: Windows Phone |
Control: SfChart |
Published Date: March 4, 2016 |
Last Revised Date: June 27, 2019
Tags: sfchart, chart, zindex

By default, a series is placed on a chart based on the index of the series. You can change the position of the appearance without changing series of the index by using the Canvas.ZIndex property. 

In the following scenario, a Scatter series is positioned in the zeroth index, and the Line series is overlapped by the Scatter series. But, when you define the Canvas.ZIndex property, it changes the position of rendering series in the UI, but not in series index.

XAML

            <chart:ScatterSeries Interior="Red" ItemsSource="{Binding Products}" XBindingPath="Name" YBindingPath="Range" />
           <!--Canvas.ZIndex property is used to move front or back to the series-->
           <chart:LineSeries Interior="Blue" ItemsSource="{Binding Products}" XBindingPath="Name" YBindingPath="Range" Canvas.ZIndex="-1"/>

C#

            ScatterSeries series1 = new ScatterSeries();
            series1.ItemsSource = view.Products;
            series1.XBindingPath = "Name";
            series1.YBindingPath = "Range";
            series1.Interior = Brushes.Red;
            LineSeries series2 = new LineSeries();
            series2.ItemsSource = view.Products;
            series2.XBindingPath = "Name";
            series2.YBindingPath = "Range";
            series2.Interior = Brushes.Blue;
            Canvas.SetZIndex(series2, -1);
            chart.Series.Add(series1);
            chart.Series.Add(series2);

Output

Chart with higher z index value for scatter series and lower z index value for line series in WPF

Figure 1: Z Index Output.

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

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

Up arrow icon

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