Polar Coordinates
View model
using LiveChartsCore;
using LiveChartsCore.Defaults;
using LiveChartsCore.SkiaSharpView;
namespace ViewModelsSamples.Polar.Coordinates;
public class ViewModel
{
public ISeries[] Series { get; set; } = [
new PolarLineSeries<ObservablePolarPoint>
{
Values = [
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),
],
IsClosed = false,
Fill = null
}
];
public PolarAxis[] AngleAxes { get; set; } = [
new PolarAxis
{
// force the axis to always show 360 degrees.
MinLimit = 0,
MaxLimit = 360,
Labeler = angle => $"{angle}°",
ForceStepToMin = true,
MinStep = 30
}
];
}
using Eto.Forms;
using LiveChartsCore.SkiaSharpView.Eto;
using ViewModelsSamples.Polar.Coordinates;
namespace EtoFormsSample.Polar.Coordinates;
public class View : Panel
{
/// <summary>
/// Initializes a new instance of the <see cref="View"/> class.
/// </summary>
public View()
{
var viewModel = new ViewModel();
var polarChart = new PolarChart
{
Series = viewModel.Series,
AngleAxes = viewModel.AngleAxes,
};
Content = polarChart;
}
}
Articles you might also find useful: