I want to show the date in the proper format dd/mm/yy, how can I get this done?
4 Answers, 1 is accepted
The simplest option would be add a property to the object that contains the formatted date. Otherwise you'll need to parse and format the date:
categoryAxis: {
labels: {
template: "#= formatDate(value) #"
}
}
...
var dateRegex = /\/Date\((\d+)\)\//;
function formatDate(dateString) {
var ticks = parseInt(dateString.replace(dateRegex, "$1"), 10),
d = new Date(ticks);
return d.getDate() + "/"+
(d.getMonth() + 1) + "/" +
d.getFullYear().toString().substring(2,4)
}
I hope this helps.
Tsvetomir Tsonev
the Telerik team

I have a similar problem but can't seem to get the sample you gave to work for me. The template call to formatDate never seems to execute. I've tried putting a simple alert within the formatDate function and tried with breakpoints but it never seems to get called. Any ideas?
What categories do you get when you remove the template? Maybe the categories are not getting populated from the data source in the first place.
Greetings,Tsvetomir Tsonev
the Telerik team

I should also mention that I initialize the chart in a doc.ready function without specifying the datasource then, when the filter criteria is entered by the user, I populate the chart as follows and trigger a chart refresh.
$(
"#chart").kendoChart({
theme:
"black",
color:
"white",
title: { text:
"Sample Chart" },
dataSource: graphData,
series: [{type:
"line", field: "ParameterValue", name: "Value"}],
categoryAxis: { template:
"#= formatDate(value) #", field: "ValueTimestamp" }
});