Skip to main content
All docs
V25.1
  • DxPieChart<T>.ShowTooltip(T, String) Method

    Shows the tooltip for the specified series point.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    public void ShowTooltip(
        T point,
        string seriesName
    )

    Parameters

    Name Type Description
    point T

    The series point for which the tooltip is shown.

    seriesName String

    The series name.

    Remarks

    Add a DxChartTooltip object to chart markup and set the DxChartTooltip.Enabled property to true to enable tooltip functionality.

    DxPieChart allows you to change tooltip visibility in code. Call ShowTooltip method overloads to show the tooltip for the specified series point. To hide the tooltip, call the HideTooltip() method.

    When you call ShowTooltip method overloads, DxPieChart raises the TooltipShowing event. In the event handler, you can get information about the tooltip and specify whether it should appear.

    The following code snippet displays custom Show Tooltip and Hide Tooltip buttons that show and hide the tooltip for the specified series point:

    DxPieChart - Show and Hide Tooltip in Code

    <DxPieChart Data="@SalesData"
                @ref="@pieChart"
                T="SaleInfo">
        <DxPieChartSeries T="SaleInfo"
                          TArgument="string"
                          TValue="double"
                          ValueField="si => si.Amount"
                          ArgumentField="si => si.Region"
                          SummaryMethod="Enumerable.Sum"
                          Name="Region Sales" />
        <DxPieChartSeries T="SaleInfo"
                          TArgument="string"
                          TValue="double"
                          ValueField="si => si.Amount"
                          ArgumentField="si => si.City"
                          SummaryMethod="Enumerable.Sum"
                          Name="City Sales" />
        <DxChartLegend Position="RelativePosition.Outside"
                       HorizontalAlignment="HorizontalAlignment.Center" />
        <DxChartTooltip Enabled="true" />
    </DxPieChart>
    
    <DxButton Text=" Show Tooltip" Click="@OnShowTooltipButtonClick" />
    <DxButton Text = "Hide Tooltip" Click="@OnHideTooltipButtonClick" />
    
    @code {
        DxPieChart<SaleInfo> pieChart;
        string seriesName = "City Sales";
    
        void OnShowTooltipButtonClick() {
            var point = SalesData.Where(x => x.City == "Denver").FirstOrDefault();
            if(point != null)
                // Pass the series name as a parameter
                pieChart.ShowTooltip(point, seriesName);
                // Pass the series index (order) as a parameter
                pieChart.ShowTooltip(point, 1);
        }
    
        void OnHideTooltipButtonClick() {
            pieChart.HideTooltip();
        }
    
        IEnumerable<SaleInfo> SalesData;
    
        protected override async Task OnInitializedAsync() {
            SalesData = await Sales.GetSalesAsync();
        }
    }
    
    See Also