Layered Bars

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.

sample image sample image

View Model

using LiveChartsCore;
using LiveChartsCore.SkiaSharpView;

namespace ViewModelsSamples.Bars.Layered;

public class ViewModel
{
    public int[] Values1 { get; set; } =
        [6, 3, 5, 7, 3, 4, 6, 3];

    public int[] Values2 { get; set; } =
        [2, 4, 8, 9, 5, 2, 4, 7];
}

XAML

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

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

    <!--
    When the bar position is ignored, all bars are drawn in the same position.
    -->

    <lvc:CartesianChart>
        <lvc:CartesianChart.Series>
            <lvc:SeriesCollection>
                <lvc:XamlColumnSeries
                    Values="{Binding Values1}"
                    MaxBarWidth="999999"
                    IgnoresBarPosition="True"/>
                <lvc:XamlColumnSeries
                    Values="{Binding Values2}"
                    MaxBarWidth="30"
                    IgnoresBarPosition="True"/>
            </lvc:SeriesCollection>
        </lvc:CartesianChart.Series>
    </lvc:CartesianChart>

</UserControl>

Articles you might also find useful: