Line Smoothness
This sample uses C# 12 features, it also uses features from the CommunityToolkit.Mvvm package, you can learn more about it here.
This web site wraps every sample using a UserControl
instance, but LiveCharts controls can be used inside any container.

View model
using LiveChartsCore;
using LiveChartsCore.SkiaSharpView;
namespace ViewModelsSamples.Lines.Straight;
public class ViewModel
{
public ISeries[] Series { get; set; } = [
new LineSeries<double>
{
Values = [5, 0, 5, 0, 5, 0],
Fill = null,
GeometrySize = 0,
// use the line smoothness property to control the curve
// it goes from 0 to 1
// where 0 is a straight line and 1 the most curved
LineSmoothness = 0 // mark
},
new LineSeries<double>
{
Values = [7, 2, 7, 2, 7, 2],
Fill = null,
GeometrySize = 0,
LineSmoothness = 1 // mark
}
];
}
XAML
<UserControl x:Class="WinUISample.Lines.Straight.View"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:lvc="using:LiveChartsCore.SkiaSharpView.WinUI"
xmlns:vms="using:ViewModelsSamples.Lines.Straight"
mc:Ignorable="d">
<UserControl.DataContext>
<vms:ViewModel/>
</UserControl.DataContext>
<lvc:CartesianChart Series="{Binding Series}"/>
</UserControl>