Axis Style
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 CommunityToolkit.Mvvm.ComponentModel;
using LiveChartsCore;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore.SkiaSharpView.Painting;
using LiveChartsCore.SkiaSharpView.Painting.Effects;
using SkiaSharp;
namespace ViewModelsSamples.Axes.Style;
[ObservableObject]
public partial class ViewModel
{
public ISeries[] Series { get; set; } =
{
new LineSeries<int>
{
Values = new int[] { 5, 3, 2, 8, 7, 4, 5, 4, 6, 7, 5 },
Fill = null,
GeometrySize = 0
}
};
public Axis[] XAxes { get; set; } =
{
new Axis
{
MinLimit = 0,
MaxLimit = 10,
ForceStepToMin = true,
MinStep = 0.5,
TextSize = 14,
SeparatorsPaint = new SolidColorPaint
{
Color = SKColors.Gray,
StrokeThickness = 2
}
}
};
public Axis[] YAxes { get; set; } =
{
new Axis
{
MinLimit = 0,
MaxLimit = 10,
ForceStepToMin = true,
MinStep = 1,
TextSize = 14,
SeparatorsPaint = new SolidColorPaint
{
Color = SKColors.Gray,
StrokeThickness = 2,
PathEffect = new DashEffect(new float[] { 3, 3 })
}
}
};
public DrawMarginFrame Frame { get; set; } =
new()
{
Fill = new SolidColorPaint
{
Color = new SKColor(0, 0, 0, 30)
},
Stroke = new SolidColorPaint
{
Color = new SKColor(80, 80, 80),
StrokeThickness = 2
}
};
}
Form code behind
using System.Windows.Forms;
using LiveChartsCore.SkiaSharpView.WinForms;
using ViewModelsSamples.Axes.Style;
namespace WinFormsSample.Axes.Style;
public partial class View : UserControl
{
private readonly CartesianChart cartesianChart;
public View()
{
InitializeComponent();
Size = new System.Drawing.Size(100, 100);
var viewModel = new ViewModel();
cartesianChart = new CartesianChart
{
Series = viewModel.Series,
XAxes = viewModel.XAxes,
YAxes = viewModel.YAxes,
DrawMarginFrame = viewModel.Frame,
// out of livecharts properties...
Location = new System.Drawing.Point(0, 0),
Size = new System.Drawing.Size(100, 100),
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom
};
Controls.Add(cartesianChart);
}
}