How to customize the axis label format based on the culture in .NET MAUI Chart (SfCartesianChart)?
The .NET MAUI Cartesian Chart allows you to customize the axis label format based on different cultures, such as Dutch, French, etc. The ChartAxis provides the LabelCreated event, which can be used to modify axis labels. The following code illustrates how to use the LabelCreated event to format axis labels according to a specific culture.
[C#]
NumericalAxis secondaryAxis = new NumericalAxis();
secondaryAxis.LabelCreated += (object? sender, ChartAxisLabelEventArgs e) =>
{
double labelContent = Convert.ToDouble(e.Label);
e.Label = labelContent.ToString("C", new CultureInfo("de-DE"));
};
chart.YAxes.Add(secondaryAxis);
Output
Conclusion
I hope you enjoyed learning how to customize the axis label format based on the culture in the .NET MAUI Cartesian chart.
Refer to our .NET MAUI Chart’s feature tour page to learn about its other groundbreaking feature representations. You can also explore our .NET MAUI Chart documentation to understand how to present and manipulate data.
For current customers, check out our .NET MAUI from the License and Downloads page. If you are new to Syncfusion, try our 30-day free trial to check out our .NET MAUI Chart and other .NET MAUI components.
Please let us know in the following comments section if you have any queries or require clarifications. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!