Articles in this section
Category / Section

How to set the Z Index to scatter series of WPF Chart (SfChart)?

1 min read

A series is placed on a chart based on the index of the series by default. You can change the position of the appearance without changing series of the index by using the Canvas.ZIndex property of LineSeries in WPF Chart (SfChart).

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);

 

WPF Chart Series with Z Index

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied