Hi i am building a pie chart by passing json array to drawchart it displaying labels of chart but unable to find the chart.i need a donut chart where each slice is clickable which carries a id as it parameter when i click the slice it need to open a another chart of that particular slice
<script>
$(document).ready(function () {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "bar.aspx/DistrictAnalysis",
data: "{}",
dataType: "json",
success: function (Result) {
Result = Result.d;
var data = [];
for (var i in Result) {
//var jsondata = new Array(Result[i].City, Result[i].DevelopmentPercentage, Result[i].ID);
var jsondata = { city: Result[i].City, DevelopmentPercentage: Result[i].DevelopmentPercentage, ID: Result[i].ID }
data.push(jsondata);
}
DreawChart(data);
console.log(data);
},
error: function (Result) {
alert("Error");
}
});
function DreawChart(series) {
$('#container').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
title: {
text: 'Village Development Measuring System'
},
tooltip: {
formatter: function () {
return '<b>' + this.point.city + '</b>: ' + this.point.DevelopmentPercentage + ' %';
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.city}</b>: {point.percentage:.1f} %',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
},
connectorColor: 'silver'
}
}
},
series: [
{
data: series,
type: 'pie',
dataType: 'json',
animation: false,
point: {
events: {
click: function (event) {
//var id = this.ID;
//alert(id);
////alert(event.point.ID);
//alert(this.point.ID);
//alert(this.x [![able to get id but chart cannot be created][2]][2]+ " " + this.y);
}
}
}
}
],
});
}
});
</script>
[![able to get id but chart cannot be created][1]][1]
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>