Basic Gauge

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.

This web site wraps every sample using a UserControl instance, but LiveCharts controls can be used inside any container.

sample image

View model

namespace ViewModelsSamples.Pies.Gauge1;

public class ViewModel
{
    public double Value { get; set; } = 30;
}

XAML

<UserControl
    x:Class="AvaloniaSample.Pies.Gauge1.View"
    xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia"
    xmlns:vms="using:ViewModelsSamples.Pies.Gauge1"
    x:DataType="vms:ViewModel">

    <UserControl.DataContext>
        <vms:ViewModel/>
    </UserControl.DataContext>

    <lvc:PieChart
        InitialRotation="-90"
        MinValue="0"
        MaxValue="100">
        <lvc:PieChart.Series>

            <lvc:XamlGaugeSeries
                GaugeValue="{Binding Value}"
                DataLabelsSize="50"
                MaxRadialColumnWidth="50"/>

            <!-- The background series is used to style the gauge background. -->
            <lvc:XamlGaugeBackgroundSeries/>

        </lvc:PieChart.Series>
    </lvc:PieChart>
</UserControl>

Articles you might also find useful: