I'm new in kendoui application , i have create a pie chart application ( for this i fallow kendoui Demo samples. ) when i run the kendo sample (Remote json data) it's working fine but when i run application with my url it gives error like below.
But when i run the application with hard coding json data it's works fine. here is the json (which is return from my url)
[
{ "Amount": 239.9700, "RangeValue": "####below" },
{ "Amount": 4000.0000, "RangeValue": "#1_$_30#Days" },
{ "Amount": 5000.0000, "RangeValue": "#31_$_60#Days" },
{ "Amount": 79.9900, "RangeValue": "#61_$_90#Days" },
{ "Amount": 3000.0000, "RangeValue": "Over_$_90" }
]
Here is the coding what i did..
<!DOCTYPE html>
<html>
<head>
<title>Pie labels</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="Portal/Content/kendo/2012.2.710/kendo.common.min.css" rel="stylesheet" type="text/css" />
<link href="Portal/Piechart/kendo.default.min.css" rel="stylesheet">
<link href="Portal/Piechart/kendo.dataviz.min.css" rel="stylesheet">
<link href="Portal/Piechart/kendo.dataviz.default.min.css" rel="stylesheet">
<script src="Portal/Piechart/jquery.min.js"></script>
<script src="Portal/Piechart/kendo.dataviz.min.js"></script>
</head>
<body>
<div id="example" class="k-content">
<div class="chart-wrapper">
<div id="chart"></div>
</div>
<script>
var CustomerData;
var customername;
var AgingData = [
{ "Amount": 239.9700, "RangeValue": "####below" },
{ "Amount": 4000.0000, "RangeValue": "#1_$_30#Days" },
{ "Amount": 5000.0000, "RangeValue": "#31_$_60#Days" },
{ "Amount": 79.9900, "RangeValue": "#61_$_90#Days" },
{ "Amount": 3000.0000, "RangeValue": "Over_$_90" }
]
function BindData() {
var Url = "http://localhost/CustomerPortal/get/agingchart/2013-12-01/90/30/Fabrikam/1/1?format=json";
alert("start");
CustomerData = new kendo.data.DataSource({
transport: {
read: Url,
dataType: "json",
data: {
Accept: "application/json"
}
},
});
CustomerData.read();//
//createChart();
CustomerData.fetch(function () {
var view = CustomerData.at(0);
customername = "Fabrikam";
});
$("#chart").kendoChart({
title: {
text: customername + " Customer Account Graph"
},
legend: {
position: "Right"
},
chartArea: {
background: ""
},
dataSource: {
data: CustomerData
},
seriesDefaults: {
labels: {
visible: true,
background: "transparent",
template: "#= category #: #= value#"
}
},
series: [{
type: "pie",
field: "Amount",
categoryField: "RangeValue"
}],
seriesColors: ["#42a7ff", "#E99669", "#A6D5A6", "#cccccc", "#E56f9f"],
tooltip: {
visible: true,
template: "${ category } - ${ value }"
}
});//Chart close
};
$(document).ready(BindData);
$(document).bind("kendo:skinChange", createChart);
</script>
</div>
Please guide me how can i get pie chart with Remote json data...