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="WinUISample.Lines.Area.View"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:lvc="using:LiveChartsCore.SkiaSharpView.WinUI"
    xmlns:vms="using:ViewModelsSamples.Lines.Area"
    mc:Ignorable="d">
    
    <UserControl.DataContext>
        <vms:ViewModel/>
    </UserControl.DataContext>

    <lvc:CartesianChart
        >

        <!--
        Nested extensions are not working in Uno

        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: