I have a problem in binding JSON data with Kendo Pie Chart.
I have data source where I have supplied the url of my service with method name, that is getting me the data from server. I can see the data is returning from the server when I paste that url in my firefox browser. I am also supplying the field name to the grid but not getting my chart displayed. It works fine when i supply hard coded array to it.
Could please anyone help me? Following is the code
<div id= "kendoChart" style="width:50%; float:right; height:450px; margin-top:-20"></div>
<script type="text/javascript">
//var rtData = [3, 15, 30, 45, 92];
var chartDataSource = new kendo.data.DataSource({
transport: {
read: {
url: "/DomainService/ContactedChartDomainService.svc/json/GetContactedChartViews",
dataType: "json"
},
schema:
{
data: "GetContactedChartViewsResult.RootResults"
}
}
});
$(function () {
$("#kendoChart").kendoChart({
dataSource: chartDataSource,
title: { text: "Stats" },
seriesDefault: {
type: "pie"
},
series: [
{
field: "Occurances",
categoryField: "ContactedName"
//type: "pie"
}],
tooltip: {
visible: true
}
});
});
</script>
</div>
my JSON out put is as follow
{"GetContactedChartViewsResult":{"TotalCount":3,"RootResults":[
{"ContactedID":1,"ContactedName":"No","Occurances":5},
{"ContactedID":2,"ContactedName":"Under Consideration","Occurances":1},
{"ContactedID":3,"ContactedName":"Follow Up","Occurances":11}]}}
Kind Regards,
Waseem