后台绑定数据,直接返回json数据
IList<SummaryHour> adHourData = summarybll.FindList(str); List<int> Hour = new List<int>() { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 }; List<int> downNumber = new List<int>() { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; List<int> RegisterNumber = new List<int>() { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; List<int> ClickNumber = new List<int>() { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; double max = 1; if (adHourData.Count() > 0) { max = adHourData.OrderByDescending(x => x.DownNumber).FirstOrDefault().DownNumber; Hour.Clear(); downNumber.Clear(); RegisterNumber.Clear(); ClickNumber.Clear(); foreach (var item in adHourData) { Hour.Add(item.Hour); downNumber.Add(item.DownNumber); RegisterNumber.Add(item.RegisterNumber); ClickNumber.Add(item.ClickNumber); } } results = new { Hour = Hour, DownNumber = downNumber, RegisterNumber = RegisterNumber, ClickNumber = ClickNumber, max = max, type = 0 }; return Json(results);