Slim Gauge
View model
using System.Collections.Generic;
using LiveChartsCore;
using LiveChartsCore.Measure;
using LiveChartsCore.SkiaSharpView;
using CommunityToolkit.Mvvm.ComponentModel;
namespace ViewModelsSamples.Pies.Gauge4;
public partial class ViewModel : ObservableObject
{
public IEnumerable<ISeries> Series { get; set; }
= new GaugeBuilder()
.WithLabelsSize(20)
.WithLabelsPosition(PolarLabelsPosition.End)
.WithLabelFormatter(point => point.PrimaryValue.ToString())
.WithInnerRadius(20)
.WithMaxColumnWidth(5)
.WithBackground(null)
.AddValue(50, "Vanessa")
.AddValue(80, "Charles")
.AddValue(95, "Ana")
.BuildSeries();
}
using Eto.Forms;
using LiveChartsCore.SkiaSharpView.Eto;
using ViewModelsSamples.Pies.Gauge4;
namespace EtoFormsSample.Pies.Gauge4;
public class View : Panel
{
private readonly PieChart pieChart;
public View()
{
var viewModel = new ViewModel();
pieChart = new PieChart
{
Series = viewModel.Series,
InitialRotation = -90,
MaxAngle = 350,
Total = 100,
};
Content = pieChart;
}
}
Articles you might also find useful: