Basic Stacked 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.
View Model
namespace ViewModelsSamples.StackedArea.Basic;
public class ViewModel
{
public double[] Values1 { get; set; } = [3, 2, 3, 5, 3, 4, 6];
public double[] Values2 { get; set; } = [6, 5, 6, 3, 8, 5, 2];
public double[] Values3 { get; set; } = [4, 8, 2, 8, 9, 5, 3];
}
XAML
<UserControl
x:Class="WinUISample.StackedArea.Basic.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.StackedArea.Basic"
mc:Ignorable="d">
<UserControl.DataContext>
<vms:ViewModel/>
</UserControl.DataContext>
<lvc:CartesianChart>
<lvc:CartesianChart.Series>
<lvc:SeriesCollection>
<lvc:XamlStackedAreaSeries Values="{Binding Values1}"/>
<lvc:XamlStackedAreaSeries Values="{Binding Values2}"/>
<lvc:XamlStackedAreaSeries Values="{Binding Values3}"/>
</lvc:SeriesCollection>
</lvc:CartesianChart.Series>
</lvc:CartesianChart>
</UserControl>