Line and StepLine Chart in WPF Charts (SfChart)
15 Jan 2021 / 2 minutes to read
Line Chart
Line series join points on a plot by straight lines, showing data trends at equal intervals. The following code example explains how to create a simple LineSeries
using given data
<chart:LineSeries XBindingPath="Year
ItemsSource="{Binding List}" YBindingPath="India"
Interior="#4A4A4A"/>
<chart:LineSeries XBindingPath="Year"
ItemsSource="{Binding List}" YBindingPath="America"
Interior="#4A4A4A"/>
LineSeries series1 = new LineSeries()
{
ItemsSource = new ViewModel().List,
XBindingPath = "Year",
YBindingPath = "India",
Interior = new SolidColorBrush(Color.FromRgb(0x4A, 0x4A, 0x4A))
};
LineSeries series2 = new LineSeries()
{
ItemsSource = new ViewModel().List,
XBindingPath = "Year",
YBindingPath = "America",
Interior = new SolidColorBrush(Color.FromRgb(0x4A, 0x4A, 0x4A))
};
chart.Series.Add(series1);
chart.Series.Add(series2);
Step Line Chart
StepLineSeries
plots horizontal and vertical lines to connect data points resulting in a step line progression. The following code illustrates how to initialize the StepLineSeries
in chart.
<chart:StepLineSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue">
</chart:StepLineSeries>
StepLineSeries stepLine = new StepLineSeries();
stepLine.ItemsSource = new ViewModel().Data;
stepLine.XBindingPath = "XValue";
stepLine.YBindingPath = "YValue";
SteplineChart.Series.Add(stepLine);
See also
How to remove the blended color effect in multiple line series of Chart
Comparison between line series and fast line series
Was this page helpful?
Yes
No
Thank you for your feedback!
Thank you for your feedback and comments. We will rectify this as soon as possible!
An unknown error has occurred. Please try again.
Help us improve this page