Category / Section
How to remove the blended color effect in multiple line series of SfChart?
1 min read
You can remove the blended color effect in multiple line series by extending LineSeries and setting RenderOptions.EdgeMode to Aliased for rendered visual in the CreateSegments method.
XAML:
<chart:SfChart.Series> <local:LineSeriesExt XBindingPath="SportName" YBindingPath="Interest" Label="Series 1" ItemsSource="{Binding Data}" Interior="Blue"/> <local:LineSeriesExt XBindingPath="SportName" YBindingPath="Interest" Label="Series 2" ItemsSource="{Binding Data}" Interior="Yellow"/> </chart:SfChart.Series>
C#:
public class LineSeriesExt : LineSeries { public override void CreateSegments() { base.CreateSegments(); foreach (Syncfusion.UI.Xaml.Charts. LineSegment segment in Segments) { RenderOptions.SetEdgeMode((segment.GetRenderedVisual() as Line), EdgeMode.Aliased); } } }
Note:
To avoid this workaround, you can use FastLineBitmapSeries, because it removes the blended color effect by default.
With blended effect:
Without blended effect: