Basic Area

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.Lines.Area;

public class ViewModel
{
    public double[] Values { get; set; } =
        [-2, -1, 3, 5, 3, 4, 6];
}

XAML

<UserControl
    x:Class="WPFSample.Lines.Area.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.Lines.Area;assembly=ViewModelsSamples">

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

    <lvc:CartesianChart
        DrawMarginFrame="{lvc:Frame
            Stroke={lvc:SolidColorPaint Color='#64b4b4b4'},
            Fill={lvc:SolidColorPaint Color='#32dcdcdc'}}">
        <lvc:CartesianChart.Series>
            <lvc:SeriesCollection>
                <lvc:XamlLineSeries
                    Values="{Binding Values}"
                    Fill="{lvc:SolidColorPaint Color='#6495ED'}"
                    Stroke="{x:Null}"
                    GeometryFill="{x:Null}"
                    GeometryStroke="{x:Null}"/>
            </lvc:SeriesCollection>
        </lvc:CartesianChart.Series>
    </lvc:CartesianChart>

</UserControl>

Articles you might also find useful: