我有一个asp.net应用程序,我在其中使用多个kendo图表。我的要求是使用aspx web方法显示远程数据。但是我没有在剑道图表中获得任何数据。
这是我的代码,
var dataSource = new kendo.data.DataSource({
type: "json",
transport: {
read: {
type: "POST",
url: "Commercial.aspx/FetchCounts",
contentType: 'application/json; charset=utf-8',
datatype: "json"
}, //read
parameterMap: function (options) {
return $.parseJSON(options);
}
},
serverFiltering: false,
serverSorting: false,
schema: {
data: "d",
model: {
fields: {
current: { type: "string" },
target: { type: "string" }
}
}
}
});
function createSparklines() {
$("#chart-CurrentWeekCount").kendoChart({
legend: {
visible: false
},
dataSource : dataSource,
series: [{
type: "bullet",
currentField: "current",
targetField: "target",
target: {
color: "#e13c02"
},
}],
categoryAxis: {
majorGridLines: {
visible: false
},
majorTicks: {
visible: false
}
},
valueAxis: [{
plotBands: [{
from: 0, to: 8000, color: "#ccc", opacity: .3
}],
majorGridLines: {
visible: false
},
min: 0,
max: 8000,
majorUnit: 2000,
minorTicks: {
visible: true
}
}],
tooltip: {
visible: false,
template: "Goal: #= value.target # <br /> Current: #= value.current #"
}
});
}
$(document).ready(createSparklines);
$(document).bind("kendo:skinChange", createSparklines);
方法&#34; FetchCounts&#34;返回以下数据: [{&#34;电流&#34;:5000,&#34;目标&#34;:7500}]
请让我知道我错过了什么。任何想法将不胜感激。
感谢。