私はコントローラーからjosnデータを返し、それを円グラフにバインドしています...しかし、最終的にはページに何も表示されません..どこが間違っているのか教えてもらえますか...
<script type="text/javascript">
$(function () {
var chart;
alert('1');
$(document).ready(function () {
var options = {
chart: {
renderTo: 'container',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
defaultSeriesType: 'pie'
},
title: {
text:'Resource Reports'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
color: '#000000',
connectorColor: '#000000',
formatter: function () {
//return '<b>' + this.point.name + '</b>: ' + this.percentage + ' %';
}
}
}
},
series: [{
type: 'pie',
name: 'Fruits',
data:[]
}]
};
$.getJSON('<%= Url.Action("GetData","JqueryCharts") %>', null, function (data) {
alert('2');
options.series = json;
chart = new Highcharts.chart(options);
});
});
});
</script>
これは私のコントローラーです
public JsonResult GetData()
{
//int Param1;
//Param1 = 1;
//DataEntitiesModel data = new DataEntitiesModel();
//var procedure=db.Database.SqlQuery<DataEntitiesModel>("ResourceReports @EmployeeID",new SqlParameter("@EmployeeID", Param1) );
//var procedure = db.Database.SqlQuery<DataEntitiesModel>("Select * from EmployeeDetails");
//var data = db.ProjectReports.ToList().Select( e => new
//{
// Id = e.EmployeeID,
// Name = e.EmployeeName
//});
var EmployeeDetails = db.EmployeeDetails.ToList<EmployeeDetail>().Select(e => new
{
id=e.EmployeId,
Name = e.EmployeeName
});
return Json(EmployeeDetails, JsonRequestBehavior.AllowGet);
}