Pushout
View model
using System.Collections.Generic;
using LiveChartsCore;
using CommunityToolkit.Mvvm.ComponentModel;
using LiveChartsCore.SkiaSharpView.Extensions;
namespace ViewModelsSamples.Pies.Pushout;
public partial class ViewModel : ObservableObject
{
// you can convert any array, list or IEnumerable<T> to a pie series collection:
public IEnumerable<ISeries> Series { get; set; } =
new[] { 6, 5, 4, 3, 2 }.AsPieSeries((value, series) =>
{
// pushes out the slice with the value of 6 to 30 pixels.
if (value != 6) return;
series.Pushout = 30;
});
}
using Eto.Forms;
using LiveChartsCore.SkiaSharpView.Eto;
using ViewModelsSamples.Pies.Pushout;
namespace EtoFormsSample.Pies.Pushout;
public class View : Panel
{
private readonly PieChart pieChart;
public View()
{
var viewModel = new ViewModel();
pieChart = new PieChart
{
Series = viewModel.Series,
};
Content = pieChart;
}
}
Articles you might also find useful: