11 Answers, 1 is accepted
If I understand correctly your scenario you would like to trim the labels of the chart's axis to a specific length? If this is the case you can use a template for the labels and in it call a function which reduces the labels' width. For example:
$(
"#chart"
).kendoChart({
//....
categoryAxis: {
//....
labels: {
template:
"#= shortLabels(value)#"
}
}
});
function
shortLabels(value) {
if
(value.length > 3) {
value = value.substring(0, 5);
return
value;
}
}
If you are requesting a different functionality, please elaborate a bit more.
Regards,
Iliana Nikolova
the Telerik team

Thanks for your response. Actually we are looking for wrap functionality. For example, if the axis label is "Equipment planned production time", then we want to show it in two lines. Following are the two main problems we have
1. Lengthy labels getting messed up with other axis labels.,
2. Chart size is getting reduced based on the label width.
Best regards,
Suresh
I am afraid at present it is not possible to achieve the wrap functionality in Kendo UI DataViz, however we will definitely consider its implementation for future releases. As for the points:
- In order to prevent overlapping of the labels you could use the rotation property (to rotate the labels) or the step property (to render some of the labels);
- I am not quite sure if I understand this correctly. Could you please elaborate a bit more on it? Thank you in advance.
Iliana Nikolova
the Telerik team

Thank you for the information. Kindly let us know if the wrap feature is in consideration in near future so that we can plan accordingly.
Regarding the second point, I have attached two pictures, one with short axis labels and the other with long labels. Let us know how we can handle this apart from trim options.
Best regards,
Suresh
I am afraid I cannot give you exact time frame for the wrap feature at this point. I can suggest you to follow the official Kendo UI Roadmap which says what will be implemented for sure for the next release.
Regarding the second point, this is the default behavior of the Kendo UI Chart and I am afraid there is no suitable workaround that can be suggested in order to change it. Please excuse us for the inconvenience caused.
Iliana Nikolova
the Telerik team

This question was asked in December and now it's June. Has anything changed since that time? Is there way to solve the problem with long labels?
May be it's possible to place long text into legend changing axis labels to numbers?
Thanks.
I am afraid "text-wrap" feature is still not available in Kendo UI Chart, however you could try the suggested workarounds in my previous posts.
Regarding your other question, yes this can be achieved - by design the legend shows series names and it does not depend on the axes labels. For working example check this online demo.
Iliana Nikolova
Telerik

Unfortunately "text-frap" functionality is not implemented yet, however we are working on it and will do our best to provide it as soon as possible. Please excuse us for the inconvenience caused.
Iliana Nikolova
Telerik

Thanks
This feature is tentatively planned for Q2 2014, due in the middle of next month. You can screen its status here on our feedback portal.
Kind regards,
Sebastian
Telerik