How to change grouped point default tooltip text in Blazor Charts?
This article explains how to change GroupTo default tooltip using TooltipRender event in Blazor Charts.
Change GroupTo Default Tooltip Using TooltipRender Event
Blazor Charts provides an option to change GroupTo default tooltip using TooltipRender event.
To modify the GroupTo default tooltip, you need to utilize the TooltipRender event to change the Text argument to customize the GroupTo tooltip text of the accumulation chart.
The below code example demonstrates how to change default GroupTo tooltip using TooltipRender event.
Index.razor
In this code snippet, the TooltipRenderEvent
is used to customize the tooltip text for the accumulation chart. By handling the TooltipRender event, the default tooltip text is modified to display a custom message. The Text argument is altered to format the tooltip as "Other Browsers : " followed by the value.
@using Syncfusion.Blazor
@using Syncfusion.Blazor.Charts
<SfAccumulationChart>
<AccumulationChartEvents TooltipRender="TooltipRenderEvent"></AccumulationChartEvents>
<AccumulationChartSeriesCollection>
<AccumulationChartSeries GroupMode="GroupMode.Value" GroupTo="5" Explode="true" DataSource="@DoughnutChartPoints1" XName="Browser" YName="Users" InnerRadius="40%" Radius="50%" />
</AccumulationChartSeriesCollection>
<AccumulationChartTooltipSettings Enable="true" Header=""></AccumulationChartTooltipSettings>
</SfAccumulationChart>
@code {
public List<DoughnutData> DoughnutChartPoints1 { get; set; } = new List<DoughnutData>
{
new DoughnutData { Browser = "Chrome", Users = 59 },
new DoughnutData { Browser = "UC Browser", Users = 4 },
new DoughnutData { Browser = "Internet Explorer", Users = 6},
new DoughnutData { Browser = "Sogou Explorer", Users = 1},
new DoughnutData { Browser = "QQ", Users = 3},
new DoughnutData { Browser = "Safari", Users = 5},
new DoughnutData { Browser = "Opera", Users = 2},
new DoughnutData { Browser = "Edge", Users = 7},
new DoughnutData { Browser = "Others", Users = 9},
};
public class DoughnutData
{
public string? Browser { get; set; }
public long Users { get; set; }
}
public void TooltipRenderEvent(Syncfusion.Blazor.Charts.TooltipRenderEventArgs args)
{
var text = args.Text.Split(":");
args.Text = "Other Browsers : " + text[1];
}
}
The following screenshot illustrates the output of the code snippet.
Live Sample for Changing Grouped Tooltip Text
Conclusion
I hope you enjoyed learning how to change groupto default tooltip using TooltipRender event in Blazor Charts.
You can refer to our Blazor Chart feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Blazor Chart example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, support portal, or feedback portal. We are always happy to assist you!