DxChartBase.TooltipShowing Event
Fires before a tooltip appears.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public EventCallback<ChartTooltipShowingEventArgs> TooltipShowing { get; set; }
Event Data
The TooltipShowing event's data class is ChartTooltipShowingEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Cancel | Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs. |
TooltipInfo | Returns information about the tooltip that is about to appear. |
Remarks
Add a DxChartTooltip object to chart markup and set the DxChartTooltip.Enabled property to true to enable tooltip functionality.
The chart component raises the TooltipShowing
event in the following cases:
- You call DxChart.ShowTooltip, DxPieChart.ShowTooltip, or DxPolarChart.ShowTooltip method overloads.
- A user hovers a mouse pointer over a series point.
In the event handler, use the TooltipInfo argument property to get information about the tooltip that is about to appear.
You can also set the event’s Cancel
argument property to true
to disable tooltip functionality for individual series points.
The following code snippet disables tooltips for series points that correspond to the specified series:
<DxChart Data="@SalesData"
TooltipShowing="@OnTooltipShowing">
<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>
@code {
void OnTooltipShowing(ChartTooltipShowingEventArgs e) {
if (e.TooltipInfo.Series.Name == "2017")
e.Cancel = true;
}
IEnumerable<SaleInfo> SalesData;
protected override async Task OnInitializedAsync() {
SalesData = await Sales.GetSalesAsync();
}
}