This is a migrated thread and some comments may be shown as answers.

How to set categoryAxis Width?

1 Answer 110 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 12 Dec 2013, 02:28 PM
I'm currently loading 4 bar charts on the page, but they don't line up perfectly due to categoryAxis (Y Axis) labels are different length. How do I control the categoryAxis width so the charts will all line up? I've attached a screenshot to show what I mean.

Aaron 

1 Answer, 1 is accepted

Sort by
0
Iliana Nikolova
Telerik team
answered on 14 Dec 2013, 01:36 PM
Hello Aaron,

I am afraid what you would like to achieve is not supported - there is no a built-in option for setting categoryAxis.labels width. As a possible workaround I can suggest using categoryAxis.labels.template and trim the labels after specific width:
$("#chart").kendoChart({
  //....
  categoryAxis: {
    //....
    labels: {
       template: "#= shortLabels(value)#"
    }
  }
});
  
function shortLabels(value) {
   if (value.length > 3) {
      value = value.substring(0, 5);
      return value;
   }
}


Regards,
Iliana Nikolova
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Charts
Asked by
Jon
Top achievements
Rank 1
Answers by
Iliana Nikolova
Telerik team
Share this question
or