0

Is there a way to add the line break in the client side ? For example, I want the category axis label to be displayed as:

JUN   
2012

But my database (server) returns it as "JUN 2012" and I don't want to add \n there, but want to achieve it from client side.

Any ideas ?

user
  • 5,370
  • 8
  • 47
  • 75

1 Answers1

0

First Solution Try converting the date strings to objects and use \n in format

Link http://dojo.telerik.com/@harsh/iBaHe

$("#chart").kendoChart({
  categoryAxis: [{
    labels: {
      format: "{0:MMM \n yyyy}"
    },
    categories: [new Date("Jun 2011"), new Date("Jun 2012"), new Date("Jun 2013")]
  }],
  series: [{
    data: [1, 2, 3]
  }]
});
Harsh
  • 1,072
  • 1
  • 10
  • 16
  • But in my example, the categories are not static. Its the return of a method. [eg: chartData.categories] Will this work here ? – Sarath Subramaniam Mar 10 '15 at 06:44
  • @SharathSubramaniam yes it will work. The only thing you need to do is to convert the array of date strings returned from your function to array of date objects... – Harsh Mar 10 '15 at 07:50