How to change category label name

2 posts, 1 answers
  1. Bulut
    Bulut avatar
    7 posts
    Member since:
    Sep 2018

    Posted 20 Sep 2018 Link to this post

    How can I change category axis label names.


    For example in this example I want to keep months same just change the display name. IE: instead of "January" - "Month One" , just for january. and "Month 4" for April

  2. Answer
    Tsvetomir avatar
    217 posts

    Posted 21 Sep 2018 Link to this post

    Hi Bulut,

    Thank you for the provided Dojo example. 

    The labels inside the categoryAxis property can contain a template which accepts either a string or a function as a value. A function could be used to replace the original text in a label with a custom one. There are numerous approaches that could be used to replace the text. I have used an object to store the months and their respective numbers as follows:

    var otherAlternativeMonthNames = { January: "Month 1", February: "Month 2", March: "Month 3", April: "Month 4"};

    Their respective custom text could be accessed via the value of the argument passed to the function as follows:

      categoryAxis: [{
        labels: {
          template: function(e){
           return otherAlternativeMonthNames[e.value];
        categories: months

    For your convenience, I have modified the Dojo example to reflect the suggestions mentioned above -

    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top