Remove comma in CategoryAxis labels in Xamarin.Forms Chart.
In this article, you can see how to remove the comma in category axis labels in Xamarin Charts while using the ArrangeByIndex property.
You can show the first series x-values alone in axis labels instead of showing all series x-values with comma by invoking the LabelCreated event in CategoryAxis and customizing the axis label based on your requirements. The following code snippet demonstrates how to remove the comma in CategoryAxis axis labels using the label created event.
XAML:
<chart:SfChart.PrimaryAxis> <chart:CategoryAxis LabelCreated="CategoryAxis_LabelCreated" /> </chart:SfChart.PrimaryAxis>
C#:
private void CategoryAxis_LabelCreated(object sender, ChartAxisLabelEventArgs e) { e.LabelContent = e.LabelContent.Split(',')[0].Trim(); }
Output:
Before Solution | After Solution |
|
|
Conclusion
I hope you enjoyed learning about how to remove comma in CategoryAxis labels in Xamarin.Forms Chart.
You can refer to our Xamarin Chart’s feature tour page to know about its other groundbreaking feature representations. You can also explore our Xamarin Chart Documentation to understand how to present and manipulate data.
For current customers, you can check out our Xamarin 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 Xamarin Chart and other Xamarin components.
If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac or feedback portal. We are always happy to assist you!