How to show the average line in a WPF Chart (SfChart) using Trendlines?
This article explains how to display the average line graph in a WPF Chart (SfChart) using trend lines. Trend lines help visualize data trends by drawing lines within the chart area. The average for bar chart can be viewed by setting TrendLine and its Type to Average. The StrokeThickness, Stroke, and Label properties are used to customize the appearance of trend lines.
XAML
<Syncfusion:BarSeries Palette="Metro" Label="CompanyTurnOverDetails" ItemsSource="{Binding CompanyDetails}" XBindingPath="CompanyName" YBindingPath="CompanyTurnOver"> <Syncfusion:BarSeries.Trendlines> <!--TrendLines drawn will show the average of the graph--> <Syncfusion:Trendline StrokeThickness="2" Stroke="Aqua" Type="Power" Label="Average"></Syncfusion:Trendline> </Syncfusion:BarSeries.Trendlines> </Syncfusion:BarSeries>
Output:
Conclusion
I hope you enjoyed learning about how to show the average line in a WPF Chart (SfChart) using Trendlines.
You can refer to our WPF Chart’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WPF Chart documentation to understand how to present and manipulate data.
For current customers, you can check out our WPF components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our WPF Chart and other WPF components.
If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!