How to customize axis labels using ChartFormatAxisLabel event in WinForms Chart?
The ChartFormatAxisLabel event can be used to customize labels for any axis within Syncfusion® WinForms Charts. The following code snippet demonstrates how to append "XX" to all labels on the X-axis.
this.chartControl1.ChartFormatAxisLabel += new ChartFormatAxisLabelEventHandler(this.chartControl1_ChartFormatAxisLabelEventHandler);
private void chartControl1_ChartFormatAxisLabelEventHandler(object sender, ChartFormatAxisLabelEventArgs args)
{
if (args.IsAxisPrimary && args.AxisOrientation == ChartOrientation.Horizontal)
{
args.Label = args.Value.ToString() + "XX";
args.Handled = true;
}
}
AddHandler Me.chartControl1.ChartFormatAxisLabel, AddressOf Me.chartControl1_ChartFormatAxisLabelEventHandler
Private Sub chartControl1_ChartFormatAxisLabelEventHandler(sender As Object, args As ChartFormatAxisLabelEventArgs)
If args.IsAxisPrimary AndAlso args.AxisOrientation = Orientation.Horizontal Then
args.Label = args.Value.ToString() + "XX"
args.Handled = True
End If
EndOutput:
Conclusion
I hope you enjoyed learning about how to customize axis labels using ChartFormatAxisLabel event in WinForms Chart.
You can refer to our WinForms Chart feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications. You can also explore our WinForms Chart examples 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, Direct-Trac, or feedback portal. We are always happy to assist you!