Trying to populate a dataviz chart with remote data but no data is plotted and "TypeError: a[0] is undefined" is thrown by kendo.dataviz.min.js.
chart is setup as follows:
function createChart(Description) {
var chartds = new kendo.data.DataSource({
transport: {
read: {
type: "POST",
url: "../AJAX/service.asmx/GetMetricTrend",
dataType: "json",
contentType: "application/json"
},
parameterMap: function (data, operation) {
if (operation != "read") {
// web service method parameters need to be send as JSON. The Create, Update and Destroy methods have a "products" parameter.
//return JSON.stringify(data);
}
else {
// web services need default values for every parameter
data = $.extend({ intMetricID: 17}, data);
return JSON.stringify(data);
}
}
},
schema: {
data: "d"
}
});
$("#chart").kendoChart({
dataSource: chartds,
title: {
text: Description + " Weekly Trend"
},
legend: {
position: "bottom"
},
seriesDefaults: {
type: "line"
},
series:
[{
field: "Value",
name: "Actual Value"
}],
categoryAxis: {
field: "Week",
labels: {
rotation: 0
}
},
valueAxis: {
labels: {
format: "N0"
},
majorUnit: 10
},
tooltip: {
visible: true,
format: "N0"
}
});
}
JSON response:
{"d":[{"__type":"clsMetricTrendValues","Week":5,"Value":104.00},{"__type":"clsMetricTrendValues","Week":6,"Value":109.00},{"__type":"clsMetricTrendValues","Week":7,"Value":94.00},{"__type":"clsMetricTrendValues","Week":9,"Value":96.00},{"__type":"clsMetricTrendValues","Week":10,"Value":90.00},{"__type":"clsMetricTrendValues","Week":12,"Value":86.00},{"__type":"clsMetricTrendValues","Week":13,"Value":90.00},{"__type":"clsMetricTrendValues","Week":14,"Value":95.00},{"__type":"clsMetricTrendValues","Week":15,"Value":98.00}]}
following .js files are included:
jquery-1.8.2.min.js
jquery-ui-1.9.2.custom.min.js
kendo.dataviz.min.js
kendo.web.min.js
Thanks
chart is setup as follows:
function createChart(Description) {
var chartds = new kendo.data.DataSource({
transport: {
read: {
type: "POST",
url: "../AJAX/service.asmx/GetMetricTrend",
dataType: "json",
contentType: "application/json"
},
parameterMap: function (data, operation) {
if (operation != "read") {
// web service method parameters need to be send as JSON. The Create, Update and Destroy methods have a "products" parameter.
//return JSON.stringify(data);
}
else {
// web services need default values for every parameter
data = $.extend({ intMetricID: 17}, data);
return JSON.stringify(data);
}
}
},
schema: {
data: "d"
}
});
$("#chart").kendoChart({
dataSource: chartds,
title: {
text: Description + " Weekly Trend"
},
legend: {
position: "bottom"
},
seriesDefaults: {
type: "line"
},
series:
[{
field: "Value",
name: "Actual Value"
}],
categoryAxis: {
field: "Week",
labels: {
rotation: 0
}
},
valueAxis: {
labels: {
format: "N0"
},
majorUnit: 10
},
tooltip: {
visible: true,
format: "N0"
}
});
}
JSON response:
{"d":[{"__type":"clsMetricTrendValues","Week":5,"Value":104.00},{"__type":"clsMetricTrendValues","Week":6,"Value":109.00},{"__type":"clsMetricTrendValues","Week":7,"Value":94.00},{"__type":"clsMetricTrendValues","Week":9,"Value":96.00},{"__type":"clsMetricTrendValues","Week":10,"Value":90.00},{"__type":"clsMetricTrendValues","Week":12,"Value":86.00},{"__type":"clsMetricTrendValues","Week":13,"Value":90.00},{"__type":"clsMetricTrendValues","Week":14,"Value":95.00},{"__type":"clsMetricTrendValues","Week":15,"Value":98.00}]}
following .js files are included:
jquery-1.8.2.min.js
jquery-ui-1.9.2.custom.min.js
kendo.dataviz.min.js
kendo.web.min.js
Thanks