Polar Coordinates

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

using System;
using LiveChartsCore.Defaults;

namespace ViewModelsSamples.Polar.Coordinates;

public class ViewModel
{
    public ObservablePolarPoint[] Values { get;set; } = [
        new(0, 10),
        new(45, 15),
        new(90, 20),
        new(135, 25),
        new(180, 30),
        new(225, 35),
        new(270, 40),
        new(315, 45),
        new(360, 50)
    ];

    public Func<double, string> Labeler { get; set; } =
        angle => $"{angle}°";
}

XAML

<UserControl
    x:Class="AvaloniaSample.Polar.Coordinates.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.Coordinates"
    x:DataType="vms:ViewModel">

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

  <lvc:PolarChart>
    <lvc:PolarChart.Series>
      <lvc:XamlPolarLineSeries
          Values="{Binding Values}"
          IsClosed="True"
          Fill="{x:Null}"/>
    </lvc:PolarChart.Series>

    <lvc:PolarChart.AngleAxes>
      <lvc:XamlPolarAxis
          MinLimit="0"
          MaxLimit="360"
          Labeler="{Binding Labeler}"
          ForceStepToMin="True"
          MinStep="30"/>
    </lvc:PolarChart.AngleAxes>
  </lvc:PolarChart>
</UserControl>

Articles you might also find useful: