Multiple Values 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

using System;
using LiveChartsCore.Kernel;

namespace ViewModelsSamples.Pies.Gauge3;

public class ViewModel
{
    public double Vanesa { get; set; } = 30;
    public double Charles { get; set; } = 50;
    public double Ana { get; set; } = 70;
    public Func<ChartPoint, string> LabelFormatter { get; set; } =
        point => $"{point.Coordinate.PrimaryValue} {point.Context.Series.Name}";
}

XAML

<UserControl
    x:Class="WPFSample.Pies.Gauge3.View"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
    xmlns:vms="clr-namespace:ViewModelsSamples.Pies.Gauge3;assembly=ViewModelsSamples"
    MaxHeight="400"
    MaxWidth="400">

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

    <lvc:PieChart
        InitialRotation="45"
        MaxAngle="270"
        MinValue="0"
        MaxValue="100">
        <lvc:PieChart.Series>
            <lvc:SeriesCollection>

                <lvc:XamlGaugeSeries
                    GaugeValue="{Binding Vanesa}"
                    SeriesName="Vanesa"
                    DataLabelsFormatter="{Binding LabelFormatter}"
                    DataLabelsPosition="Start"
                    InnerRadius="20"
                    RelativeOuterRadius="8"
                    RelativeInnerRadius="8"/>

                <lvc:XamlGaugeSeries
                    GaugeValue="{Binding Charles}"
                    SeriesName="Charles"
                    DataLabelsFormatter="{Binding LabelFormatter}"
                    DataLabelsPosition="Start"
                    InnerRadius="20"
                    RelativeOuterRadius="8"
                    RelativeInnerRadius="8"/>

                <lvc:XamlGaugeSeries
                    GaugeValue="{Binding Ana}"
                    SeriesName="Ana"
                    DataLabelsFormatter="{Binding LabelFormatter}"
                    DataLabelsPosition="Start"
                    InnerRadius="20"
                    RelativeOuterRadius="8"
                    RelativeInnerRadius="8"/>

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

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

Articles you might also find useful: