Add Point On Click

sample image

View model

using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using LiveChartsCore;
using LiveChartsCore.Defaults;
using LiveChartsCore.SkiaSharpView;

namespace ViewModelsSamples.Events.AddPointOnClick;

[ObservableObject]
public partial class ViewModel
{
    public ViewModel()
    {
        var data = new ObservableCollection<ObservablePoint>
        {
            new(0, 5),
            new(3, 8),
            new(7, 9)
        };

        Data = data;

        SeriesCollection = new ISeries[]
        {
            new LineSeries<ObservablePoint>
            {
                Values = data,
                Fill = null,
                DataPadding = new LiveChartsCore.Drawing.LvcPoint(5, 5)
            }
        };
    }

    public ObservableCollection<ObservablePoint> Data { get; set; }

    public ISeries[] SeriesCollection { get; set; }
}

<UserControl
    x:Class="UnoWinUISample.Events.AddPointOnClick.View"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Uno.WinUI"
    xmlns:vms="using:ViewModelsSamples.Events.AddPointOnClick"
    mc:Ignorable="d">

    <UserControl.DataContext>
        <vms:ViewModel/>
    </UserControl.DataContext>
    <lvc:CartesianChart
        x:Name="chart"
        Series="{Binding SeriesCollection}"
        PointerPressed="Chart_PointerPressed"
        TooltipPosition="Hidden">
    </lvc:CartesianChart>
</UserControl>