Radial 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.
View model
using LiveChartsCore;
namespace ViewModelsSamples.Polar.RadialArea;
public class ViewModel
{
public int[] Values1 { get; set; } =
[7, 5, 7, 5, 6];
public int[] Values2 { get; set; } =
[2, 7, 5, 9, 7];
public string[] Labels { get; set; } =
["first", "second", "third", "forth", "fifth"];
public double TangentAngle { get; set; } =
LiveCharts.TangentAngle;
}
XAML
<UserControl
x:Class="AvaloniaSample.Polar.RadialArea.View"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia"
xmlns:vms="using:ViewModelsSamples.Polar.RadialArea"
xmlns:c="using:LiveChartsCore"
x:DataType="vms:ViewModel">
<UserControl.DataContext>
<vms:ViewModel/>
</UserControl.DataContext>
<lvc:PolarChart InitialRotation="-45">
<lvc:PolarChart.Series>
<lvc:XamlPolarLineSeries
Values="{Binding Values1}"
LineSmoothness="0"
GeometrySize="0"
Fill="{lvc:SolidColorPaint Color='#900000ff'}"/>
<lvc:XamlPolarLineSeries
Values="{Binding Values2}"
LineSmoothness="1"
GeometrySize="0"
Fill="{lvc:SolidColorPaint Color='#90ff0000'}"/>
</lvc:PolarChart.Series>
<lvc:PolarChart.AngleAxes>
<lvc:XamlPolarAxis
LabelsRotation="{Binding TangentAngle}"
Labels="{Binding Labels}"/>
</lvc:PolarChart.AngleAxes>
</lvc:PolarChart>
</UserControl>