我试图完成的是让导航器部分逐步完成,而不是在用户将选择器拖入或拖出时逐步一个月。 我在下面包含了我的来源。 一切正常,但我无法让导航器的步数适应一天的步数。 任何帮助将不胜感激。
$.ajax({
// the url to the service
url: "/api/TrendAnalysis",
// the format that the data should be in when
// it is returned
contentType: "json",
// the function that executes when the server
// responds to this ajax request successfully
success: function (data) {
$("#progressBar").toggle();
trend = data;
// put the JSON response current and previous data
// for the selected metric on the stock chart
trendgraph.element.kendoStockChart({
theme: trendgraph.theme,
dataSource: {
data:trend
},
title: {
text: "Trend Analysis (Traffic)",
visible: false
},
chartArea: {
background: trendgraph.background
},
dateField: Date.parse(trend.currentdate),
series: [{
type: "line",
field: trendgraph.currentmetric,
categoryField: trendgraph.currentdate,
missValues: "zero",
color: "#1589FF",
tooltip: {
visible: true,
template: "TY #=value#"
}
}, {
type: "line",
field: trendgraph.previousmetric,
missValues: "zero",
tooltip: {
visible: true,
template: "LY #=value#"
},
color: "#ff8a14"
}],
navigator: {
//dateField: trendgraph.currentdate,
categoryAxis: {
baseUnit: "days",
},
series: [{
baseUnit: "fit",
categoryField: trendgraph.currentdate,
type: "area",
field: trendgraph.currentmetric,
missingValues: "zero"
}]
/*select: {
from: trendgraph.from,
to: trendgraph.to
}*/
},
valueAxis: {
labels: {
//visible: false,
format: trendgraph.format.Number,
step: trendgraph.axisstep
}
},
categoryAxis:{
field: trendgraph.currentdate,
baseUnit: "fit"
},
tooltip: {
visible: true,
format: trendgraph.format.Number
},
select: Select,
zoom: Select
});
}
});
function Select(e) {
displayDateRange(kendo.toString(e.to,'d'), kendo.toString(e.from, 'd'));
}
事实证明,这是日期作为字符串传入的方式,而不是 JSON 日期字符串格式或新的日期(年、月、日)。