or
here url="http://demos.kendoui.com/service/products/create", is a remote end point.var dataSource = new kendo.data.DataSource({ transport: { // make JSONP request to http://demos.kendoui.com/service/products/create create: { url: "http://demos.kendoui.com/service/products/create", dataType: "jsonp" // "jsonp" is required for cross-domain requests; use "json" for same-domain requests }, });
$('#DateChart').kendoChart({
...
categoryAxis: {
baseUnit: "fit",
autoBaseUnitSteps: {
seconds: [],
minutes: [],
hours: [],
days: [1],
weeks: [1],
months: [1,3],
years: [1]
},
maxDateGroups: MaxBars,
},
tooltip: {
visible: true,
template: $('#DateChartTemplate').html()
}
});
<
script
id
=
"DateChartTemplate"
type
=
"text/x-kendo-template"
>
# var BaseUnit = $('\#DateChart').data("kendoChart").options.categoryAxis.baseUnit;
var FirstDate = array[0].Date;
var LastDate = array[array.length - 1].Date;
if (BaseUnit == "days" || (BaseUnit == "fit" &&
Math.round((LastDate - FirstDate) / 86400000) <
MaxBars
)) { #
#:value#<br />
#=kendo.format("{0:ddd MMM d}", category)#
# } else if (BaseUnit == "weeks" || (BaseUnit == "fit" &&
(Math.round((LastDate - FirstDate) / 86400000)
+ FirstDate.getDay() - LastDate.getDay()) / 7 <
MaxBars
)) { #
#:value#<br />
#=kendo.format("{0:'Week of' MMM d}", category)#
# } else if (BaseUnit == "months" || (BaseUnit == "fit" &&
(LastDate.getFullYear() - FirstDate.getFullYear()) * 12
+ LastDate.getMonth() - FirstDate.getMonth() < 3 *
MaxBars
)) { #
#:value#<br />
#=kendo.format("{0:MMMM yyyy}", category)#
# } else { #
#:value#<
br
/>
#=kendo.format("{0:yyyy}", category)#
# } #
</
script
>