'How to use Chartjs.Blazor onClick method

I need an example of using onclick option in chartjs,blazor package.

I have to get the data when, I click a portion of a graph or a slice in a pie/dugout chart.

_barConfig.Options = new BarOptions
                    {
                        Responsive = true,
                        Title = new OptionsTitle
                        {
                            Display = true,
                            Text = Title
                        },
                        Scales = new BarScales
                        {
                            YAxes = new List<CartesianAxis>
                            {
                                new BarLinearCartesianAxis
                                {
                                    Ticks = new LinearCartesianTicks
                                    {
                                        BeginAtZero = true
                                    }
                                }
                            }
                        },
                        OnClick = ""`enter code here`
                    };


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source