public JsonResult GetGradeByActivePeriod() { var result = _gradeRepository.GetSummary(Int32.Parse(_periodId)); string[] labels = new string[result.Data.Count()]; //{ "Pre-Kinder", "Kinder", "Primero", "Segundo", "Tercero", "Cuarto", "Quinto", "Sexto", "Septimo", "Octavo", "Noveno" }; int[] information = new int[result.Data.Count()]; //= { 65, 59, 80, 81, 56, 55, 40, 8, 15, 25, 62 }; for (int i = 0; i < result.Data.Count(); i++) { labels[i] = result.Data[i].Description; information[i] = result.Data[i].Count; } var jsonData = new { labelInfo = labels, dataInfo = information, labelTitle = "Grades by period " + _period }; return(Json(jsonData, JsonRequestBehavior.AllowGet)); }