You're setting
data1
to the JSON-encoded representation of a
JsonResult
object. You should be setting it to the JSON-encoded representation of the chart data instead.
private IEnumerable getMapData(string id)
{
return from a in bics.Performances
where a.EmployeeId == id
select new
{
a.Ques1,
a.Ques2,
a.Ques3,
a.Ques4,
a.Ques5,
a.Ques6,
a.Ques7,
a.Ques8,
a.Ques9,
a.Ques10
};
}
You'll probably also need to correct the name of the
ViewBag
data, since C# is case-sensitive. Your controller sets
ViewBag.PieChart
, but your view is looking for
ViewBag.Piechart
.
var data1 = @Html.Raw(Json.Encode(ViewBag.PieChart));