在jquery中设置剑道UI中折线图的分类轴的最小值和最大值



当我在剑道折线图中的类别轴中设置最小值和最大值时。我收到一个错误。在这种情况下,我暂时设置了静态日期,但即使我动态设置它,也发生了同样的错误。

前端代码: 请参阅类别轴:最小值和最大值。

$("#chart").kendoChart({
title: { text: "MyChart" },
theme: "Metro",
dataSource: dataSeries,
series: [{
type: "line",
field: "value()",
categoryField: "Date",
name: "#= group.value #"
}],
legend: {
position: "right"
},
valueAxis: {
line: {
visible: false
}
},
categoryAxis: {                    
min: new Date("6/2/2017"),
max: new Date("7/3/2017"),
baseUnit: "days",
majorGridLines: {
visible: true
},
labels: {
rotation: 40,
padding: { right: 10 },
dateFormats: {
days: "M/d/yy"
},
step: step
}
}
});

当我加载图表时,从剑道js收到此错误。

来自剑道js的错误:

VM2938:3 Uncaught TypeError: d.value is not a function
at eval (eval at getter (kendo.all.js:2048), <anonymous>:3:11)
at n (kendo.all.js:142386)
at init._bindFromObject (kendo.all.js:141977)
at init.bindPoint (kendo.all.js:141936)
at r._bindPoint (kendo.all.js:142838)
at r.traverseDataPoints (kendo.all.js:142802)
at render (kendo.all.js:142432)
at render (kendo.all.js:143397)
at r.init (kendo.all.js:142429)
at new r (kendo.all.js:42)

categoryAxis中,根据 Telerik 文档中的示例,将type属性设置为"date"

例如

categoryAxis: {                    
min: new Date("6/2/2017"),
max: new Date("7/3/2017"),
type: "date",
baseUnit: "days",
majorGridLines: {
visible: true
}, 
labels: {
rotation: 40,
padding: { right: 10 },
dateFormats: {
days: "M/d/yy"
},
step: step
}
}

最新更新