Axis Pagination

sample image

View model

using System;
using System.Collections.Generic;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using LiveChartsCore;
using LiveChartsCore.SkiaSharpView;

namespace ViewModelsSamples.Axes.Paging;

public partial class ViewModel : ObservableObject
{
    private readonly Random _random = new();

    public ViewModel()
    {
        var trend = 100;
        var values = new List<int>();

        for (var i = 0; i < 100; i++)
        {
            trend += _random.Next(-30, 50);
            values.Add(trend);
        }

        Series = new ISeries[]
        {
            new ColumnSeries<int>
            {
                Values = values
            }
        };

        XAxes = new[] { new Axis() };
    }

    public ISeries[] Series { get; }

    public Axis[] XAxes { get; }

    [RelayCommand]
    public void GoToPage1()
    {
        var axis = XAxes[0];
        axis.MinLimit = -0.5;
        axis.MaxLimit = 10.5;
    }

    [RelayCommand]
    public void GoToPage2()
    {
        var axis = XAxes[0];
        axis.MinLimit = 9.5;
        axis.MaxLimit = 20.5;
    }

    [RelayCommand]
    public void GoToPage3()
    {
        var axis = XAxes[0];
        axis.MinLimit = 19.5;
        axis.MaxLimit = 30.5;
    }

    [RelayCommand]
    public void SeeAll()
    {
        var axis = XAxes[0];
        axis.MinLimit = null;
        axis.MaxLimit = null;
    }
}

using Eto.Forms;
using LiveChartsCore.SkiaSharpView.Eto;
using ViewModelsSamples.Axes.Paging;

namespace EtoFormsSample.Axes.Paging;

public class View : Panel
{
    private readonly CartesianChart cartesianChart;

    public View()
    {
        var viewModel = new ViewModel();

        cartesianChart = new CartesianChart
        {
            Series = viewModel.Series,
            XAxes = viewModel.XAxes,
            ZoomMode = LiveChartsCore.Measure.ZoomAndPanMode.X,
        };

        var b1 = new Button { Text = "Go to page 1" };
        b1.Click += (object sender, System.EventArgs e) => viewModel.GoToPage1();

        var b2 = new Button { Text = "Go to page 2" };
        b2.Click += (object sender, System.EventArgs e) => viewModel.GoToPage2();

        var b3 = new Button { Text = "Go to page 3" };
        b3.Click += (object sender, System.EventArgs e) => viewModel.GoToPage3();

        var b4 = new Button { Text = "Clear" };
        b4.Click += (object sender, System.EventArgs e) => viewModel.SeeAll();

        var buttons = new StackLayout(b1, b2, b3, b4) { Orientation = Orientation.Horizontal, Padding = 2, Spacing = 4 };

        Content = new DynamicLayout(buttons, cartesianChart);
    }
}

Articles you might also find useful: