Dashed Lines
This sample uses C# 13 preview features such as partial properties, it also uses features from the CommunityToolkit.Mvvm package, you can learn more about it here.
View Model
namespace ViewModelsSamples.Design.StrokeDashArray;
public class ViewModel
{
public int[] Values { get; set; } =
[4, 2, 8, 5, 3];
}
XAML
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="MauiSample.Design.StrokeDashArray.View"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.Maui;assembly=LiveChartsCore.SkiaSharpView.Maui"
xmlns:vms="clr-namespace:ViewModelsSamples.Design.StrokeDashArray;assembly=ViewModelsSamples"
x:DataType="vms:ViewModel">
<ContentPage.BindingContext>
<vms:ViewModel/>
</ContentPage.BindingContext>
<lvc:CartesianChart>
<lvc:CartesianChart.Series>
<lvc:SeriesCollection>
<lvc:XamlLineSeries
Values="{Binding Values}"
LineSmoothness="1"
GeometrySize="22"
Stroke="{lvc:SolidColorPaint
Color='#6495ED',
StrokeCap=Round,
StrokeWidth=10,
PathEffect={lvc:Dashed Array='30, 20'}}"
Fill="{x:Null}"/>
</lvc:SeriesCollection>
</lvc:CartesianChart.Series>
</lvc:CartesianChart>
</ContentPage>