Articles in this section
Category / Section

How to change the text displayed in axis labels in .NET WebForms Chart ?

1 min read

The text displayed in axis labels can be customized by using the client-side event OnClientAxesLabelRendering. Refer Chart Events for more information about the events available in Chart. Refer AxesLabelRendering Event for more information about the options available in the OnClientAxesLabelRendering event.

The Event Handler is provided with an object containing properties like cancel, data, model and type as parameter. The property data in Parameter object has options to customize the text of axis labels. The following code example adds “$” as prefix and “K” as suffix to the labels in the Vertical axis.

ASP

<ej:Chart ID="container" OnClientAxesLabelRendering="LabelsRendering" runat="server"> 
</ej:Chart>
<script type="text/javascript">
    //Client-side event handler to handle labels rendering event
    function LabelsRendering(sender) {
        if (sender.data.axis.orientation == 'vertical')
            //Adding prefix and suffix to axis labels
            sender.data.label.Text = '$'+sender.data.label.Text+' K';
    }
</script>

Screenshot:

The following screenshot displays Chart with the prefix and suffix for the primary Y axis labels added in OnClientAxesLabelRendering event.

Chart with the prefix and suffix for the primary Y axis labels

Figure 1: Chart with the prefix and suffix

 

Conclusion

I hope you enjoyed learning about how to change the text displayed in axis labels in .NET WebForms Chart.

You can refer to our .NET WebForms Charts 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 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 forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied