Specify Both X And Y
View model
using CommunityToolkit.Mvvm.ComponentModel;
using LiveChartsCore;
using LiveChartsCore.Defaults;
using LiveChartsCore.SkiaSharpView;
namespace ViewModelsSamples.Lines.XY;
public partial class ViewModel : ObservableObject
{
public ISeries[] Series { get; set; } =
{
new LineSeries<ObservablePoint>
{
Values = new ObservablePoint[]
{
new ObservablePoint(0, 4),
new ObservablePoint(1, 3),
new ObservablePoint(3, 8),
new ObservablePoint(18, 6),
new ObservablePoint(20, 12)
}
}
};
}
using Eto.Forms;
using LiveChartsCore.SkiaSharpView.Eto;
using ViewModelsSamples.Lines.XY;
namespace EtoFormsSample.Lines.XY;
public class View : Panel
{
private readonly CartesianChart cartesianChart;
public View()
{
var viewModel = new ViewModel();
cartesianChart = new CartesianChart
{
Series = viewModel.Series,
};
Content = cartesianChart;
}
}
Articles you might also find useful: