Customize tooltips in Blazorise Charts or how to setup callbacks in object, C#

Viewed 27

I'm trying to customize chart tooltip text with Blazorise.Charts which is based on ChartJs. I know how to do this with JS:

const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
    plugins: {
        tooltip: {
            callbacks: {
                label: function(context) {
                    
                    return ..;
                }
            }
        }
    }
}
});

But I'm not sure how to achieve the same with C#:

 <LineChart @ref="LineChart" TItem="long" id="@ChartId" Class="mw-100" OptionsObject="GetOptionsObject()"/>

private object GetOptionsObject()
{
    return new
    {
        Plugins = new 
        {
           Tooltips = new{
                Padding = 10,
                UsePointStyle = true,
                Position = "nearest",
                XAlign = "center",
                YAlign = "bottom",
                Callbacks = new {
                   Label = ...// stuck here
                }
            }
        }            
}

Can i define some delegate function and would it work with the object? Is there some other way to manage tooltips in Blazorise Charts?

0 Answers
Related