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); OutputFigure 1: Z Index Output. |
This page will automatically be redirected to the sign-in page in 10 seconds.