270 Degrees 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 ContentPage instance, but LiveCharts controls can be used inside any container.

sample image

View model

namespace ViewModelsSamples.Pies.Gauge2;

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

XAML

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="MauiSample.Pies.Gauge2.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.Pies.Gauge2;assembly=ViewModelsSamples"
    x:DataType="vms:ViewModel">

    <ContentPage.BindingContext>
        <vms:ViewModel/>
    </ContentPage.BindingContext>

    <lvc:PieChart
        InitialRotation="-225"
        MaxAngle="270"
        MinValue="0"
        MaxValue="100">

        <lvc:PieChart.Series>
            <lvc:SeriesCollection>
                <lvc:XamlGaugeSeries
                    GaugeValue="{Binding Value}"
                    Fill="{lvc:SolidColorPaint Color='#9ACD32'}"
                    ShowDataLabels="True"
                    DataLabelsSize="50"
                    DataLabelsPosition="ChartCenter"
                    InnerRadius="75"/>

                <!-- The background series is used to style the gauge background. -->
                <lvc:XamlGaugeBackgroundSeries
                    InnerRadius="75"
                    Fill="{lvc:SolidColorPaint Color='#5A64B5F6'}"/>
            </lvc:SeriesCollection>
        </lvc:PieChart.Series>

    </lvc:PieChart>
</ContentPage>

Articles you might also find useful: