Possibility to set a fixed width space for the axis data labels

1 Answer 13 Views
Charts
Guy
Top achievements
Rank 1
Guy asked on 07 Feb 2024, 07:00 PM

Hi,

Are there any new properties that have been added in version 2022.3.913 where we can defined the width/height of the labels within the axis.

If the labels are set for 20% and the text is longer than the space defined then it will add ellipses for that section.

Similar to the image below.

Thanks!

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 12 Feb 2024, 11:37 AM

Hello Guy,

I see that my colleague Nikolay has aleady replied in the support thread regarding the same issue. As his reply could be helpful to the other users in the forum as well I am pasting it below:

I am afraid setting width and height of the categoryAxis labels is not available. A possible approach to this would be using categoryAxis.labels.template and trimming the labels after a specific width:

$("#chart").kendoChart({
  //....
  categoryAxis: {
    //....
    labels: {
       template: "#= shortLabels(value)#"
    }
  }
});
  
function shortLabels(value) {
   if (value.length > 3) {
      value = value.substring(0, 5);
      return value;
   }
}

Also, I can suggest submitting a feature request in the Feedback portal. Usually, items that get popular get included in the RoadMap for implementation.

Regards,
Neli
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Tags
Charts
Asked by
Guy
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or