Skip to main content
All docs
V25.1
  • DxChartBase.HideTooltip() Method

    Hides the tooltip shown with a ShowTooltip method call.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    public void HideTooltip()

    Remarks

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

    Chart components allow you to change tooltip visibility in code. Call DxChart.ShowTooltip, DxPieChart.ShowTooltip, or DxPolarChart.ShowTooltip method overloads to show the tooltip for the specified series point. To hide the tooltip, call the HideTooltip() method.

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

    DxChart - Show and Hide Tooltip in Code

    <DxChart Data="@SalesData" @ref="@chart">
        <DxChartLineSeries Name="2017"
                           Filter="@((SaleInfo s) => s.Date.Year == 2017)"
                           ArgumentField="@(s => s.City)"
                           ValueField="@(s => s.Amount)"
                           SummaryMethod="Enumerable.Sum" />
        <DxChartLineSeries Name="2018"
                           Filter="@((SaleInfo s) => s.Date.Year == 2018)"
                           ArgumentField="@(s => s.City)"
                           ValueField="@(s => s.Amount)"
                           SummaryMethod="Enumerable.Sum" />
        <DxChartLegend AllowToggleSeries="true" 
                       Orientation="Orientation.Vertical"
                       Position="RelativePosition.Outside"
                       HorizontalAlignment="HorizontalAlignment.Right">
            <DxChartTitle Text="Years" />
        </DxChartLegend>
        <DxChartTooltip Enabled="true" />
    </DxChart>
    
    <DxButton Text=" Show Tooltip" Click="@OnShowTooltipButtonClick" />
    <DxButton Text = "Hide Tooltip" Click="@OnHideTooltipButtonClick" />
    
    @code {
        DxChart<SaleInfo> chart;
        string seriesName = "2017";
    
        void OnShowTooltipButtonClick() {
            var point = SalesData.Where(x => x.City == "Denver").FirstOrDefault();
            if(point != null)
                // Pass the series name as a parameter
                chart.ShowTooltip(point, seriesName);
                // Pass the series index (order) as a parameter
                chart.ShowTooltip(point, 0);
        }
    
        void OnHideTooltipButtonClick() {
            chart.HideTooltip();
        }
    
        IEnumerable<SaleInfo> SalesData;
        protected override async Task OnInitializedAsync() {
            SalesData = await Sales.GetSalesAsync();
        }
    }
    
    See Also