public JsonResult GetTaskFrequencyDistributionChart(string startTime, string endTime) { List <TaskFrequencyDistributionChart> ModelList = DbFunction.GetTaskFrequencyDistributionChart(startTime, endTime); List <TaskFrequencyDistributionJson> JsonList = new List <TaskFrequencyDistributionJson>(); for (int i = 0; i < ModelList.Count; i++) { List <int> IntList = new List <int>(); string[] Hour_Arr = ModelList[i].Hours.Split(','); string[] Total_Arr = ModelList[i].Totals.Split(','); for (int j = 0; j < 24; j++) { IntList.Add(0); string timeStr = String.Format("'{0:D2}:00'", j); for (int k = 0; k < Hour_Arr.Length; k++) { if (Hour_Arr[k] == timeStr) { IntList[j] = Convert.ToInt32(Total_Arr[k]); } } } JsonList.Add(new TaskFrequencyDistributionJson() { name = ModelList[i].DepartmentName, data = IntList }); } return(Json(JsonList)); }