Radial Area
This web site builds the control from code behind but you could also grab it from the toolbox, this sample also uses a ViewModel to populate the properties of the control(s) in this sample.
View model
using LiveChartsCore;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore.SkiaSharpView.Painting;
using SkiaSharp;
using CommunityToolkit.Mvvm.ComponentModel;
namespace ViewModelsSamples.Polar.RadialArea;
public partial class ViewModel : ObservableObject
{
public ISeries[] Series { get; set; } =
{
new PolarLineSeries<int>
{
Values = new[] { 7, 5, 7, 5, 6 },
LineSmoothness = 0,
GeometrySize= 0,
Fill = new SolidColorPaint(SKColors.Blue.WithAlpha(90))
},
new PolarLineSeries<int>
{
Values = new[] { 2, 7, 5, 9, 7 },
LineSmoothness = 1,
GeometrySize = 0,
Fill = new SolidColorPaint(SKColors.Red.WithAlpha(90))
}
};
public PolarAxis[] AngleAxes { get; set; } =
{
new PolarAxis
{
LabelsRotation = LiveCharts.TangentAngle,
Labels = new[] { "first", "second", "third", "forth", "fifth" }
}
};
}
Form code behind
using System.Windows.Forms;
using LiveChartsCore.SkiaSharpView.WinForms;
using ViewModelsSamples.Polar.RadialArea;
namespace WinFormsSample.Polar.RadialArea;
public partial class View : UserControl
{
/// <summary>
/// Initializes a new instance of the <see cref="View"/> class.
/// </summary>
public View()
{
InitializeComponent();
Size = new System.Drawing.Size(50, 50);
var viewModel = new ViewModel();
var polarChart = new PolarChart
{
Series = viewModel.Series,
AngleAxes = viewModel.AngleAxes,
InitialRotation = -45,
// out of livecharts properties...
Location = new System.Drawing.Point(0, 0),
Size = new System.Drawing.Size(50, 50),
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom
};
Controls.Add(polarChart);
}
}