Skip to content

Custom Tooltips (callbacks) #131

@TheLazyLemur

Description

@TheLazyLemur

Describe your question

Is it possible to have tool tips customized not only visually but also what text is displayed inside the toolptip? It seems to be dont using tooltips and callbacks, but im not too sure how to use callbacks with this bridge.

Which Blazor project type is your question related to?

  • Server-Side

Which charts is this question related to?

All Charts

JavaScript equivalent

var chart = new Chart(ctx, {
    type: 'line',
    data: data,
    options: {
        tooltips: {
            callbacks: {
                label: function(tooltipItem, data) {
                    var label = data.datasets[tooltipItem.datasetIndex].label || '';

                    if (label) {
                        label += ': ';
                    }
                    label += Math.round(tooltipItem.yLabel * 100) / 100;
                    return label;
                }
            }
        }
    }
});

Additional context

My Current way of handing tooltips, I cant seem to access the Callbacks from here.

   Tooltips = new Tooltips()
                    {
                        BackgroundColor = EdenColors.hoverWhite,
                        Mode = InteractionMode.Nearest,
                        Intersect = false,
                        DisplayColors = false,
                        Position = TooltipPosition.Average,
                        CornerRadius = 5,
                        XPadding = 10,
                        YPadding = 10,
                        BodyFontFamily = "Poppins",
                        TitleFontFamily = "Poppins",
                        BorderWidth = 1,
                        BorderColor = EdenColors.inactiveColor,
                        TitleFontSize = 12,
                        TitleFontColor = EdenColors.darkGrey,
                        BodyFontSize = 25,
                        BodyFontColor = EdenColors.edenBlue,
                    },

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions