Basic
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 ContentPage instance, but LiveCharts controls can be used inside any container.
View model
using LiveChartsCore;
namespace ViewModelsSamples.Polar.Basic;
public class ViewModel
{
public double[] Values { get; set; } =
[15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1];
public double CotangentAngle { get; set; } =
LiveCharts.CotangentAngle;
public double TangentAngle { get; set; } =
LiveCharts.TangentAngle;
}
XAML
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="MauiSample.Polar.Basic.View"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.Maui;assembly=LiveChartsCore.SkiaSharpView.Maui"
xmlns:vms="clr-namespace:ViewModelsSamples.Polar.Basic;assembly=ViewModelsSamples"
xmlns:c="clr-namespace:LiveChartsCore;assembly=LiveChartsCore"
x:DataType="vms:ViewModel">
<ContentPage.BindingContext>
<vms:ViewModel/>
</ContentPage.BindingContext>
<lvc:PolarChart>
<lvc:PolarChart.Title>
<lvc:XamlDrawnLabelVisual
Text="My chart title"
Paint="#303030"
TextSize="25"
Padding="15"/>
</lvc:PolarChart.Title>
<lvc:PolarChart.Series>
<lvc:SeriesCollection>
<lvc:XamlPolarLineSeries
Values="{Binding Values}"
ShowDataLabels="True"
GeometrySize="15"
DataLabelsSize="8"
DataLabelsPosition="Middle"
DataLabelsRotation="{Static c:LiveCharts.CotangentAngle}"
IsClosed="True"/>
</lvc:SeriesCollection>
</lvc:PolarChart.Series>
<lvc:PolarChart.RadiusAxes>
<lvc:PolarAxesCollection>
<lvc:XamlPolarAxis
LabelsAngle="-60"
MaxLimit="30"/>
</lvc:PolarAxesCollection>
</lvc:PolarChart.RadiusAxes>
<lvc:PolarChart.AngleAxes>
<lvc:PolarAxesCollection>
<lvc:XamlPolarAxis
LabelsRotation="{Static c:LiveCharts.TangentAngle}"/>
</lvc:PolarAxesCollection>
</lvc:PolarChart.AngleAxes>
</lvc:PolarChart>
</ContentPage>