Custom Separators Interval

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.

sample image

View model

using SkiaSharp;
using LiveChartsCore;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore.SkiaSharpView.Painting;
using LiveChartsCore.Kernel.Sketches;

namespace ViewModelsSamples.Axes.CustomSeparatorsInterval;

public class ViewModel
{
    public ISeries[] Series { get; set; } = [
        new LineSeries<int> { Values = [10, 55, 45, 68, 60, 70, 75, 78] }
    ];

    public ICartesianAxis[] YAxes { get; set; } = [
        new Axis
        {
            // We can specify a custom separator collection
            // the library will use this separators instead of
            // calculating them based on the date of the chart
            CustomSeparators = [0, 10, 25, 50, 100],
            MinLimit = 0, // forces the axis to start at 0
            MaxLimit = 100, // forces the axis to end at 100
            SeparatorsPaint = new SolidColorPaint(SKColors.Black.WithAlpha(100))
        }
    ];
}

Form code behind

using System.Windows.Forms;
using LiveChartsCore.SkiaSharpView.WinForms;
using ViewModelsSamples.Axes.CustomSeparatorsInterval;

namespace WinFormsSample.Axes.CustomSeparatorsInterval;

public partial class View : UserControl
{
    private readonly CartesianChart cartesianChart;

    public View()
    {
        InitializeComponent();
        Size = new System.Drawing.Size(50, 50);

        var viewModel = new ViewModel();

        cartesianChart = new CartesianChart
        {
            Series = viewModel.Series,
            YAxes = viewModel.YAxes,

            // out of livecharts properties...
            Location = new System.Drawing.Point(0, 0),
            Size = new System.Drawing.Size(50, 50),
            Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom
        };

        Controls.Add(cartesianChart);
    }
}

Articles you might also find useful: