public static RealTimeActivePlayerStatisticsReport ToIndexRealTimeActivePlayerStatisticsReport() { string time = DateTime.Now.ToShortDateString(); RealTimeActivePlayerStatisticsReport report = new RealTimeActivePlayerStatisticsReport(); report.items = new List <RealTimeActiveItem>(); for (int i = 0; i <= 23; i++) { int beginTime = i; int endTime = i + 1; if (endTime == 24) { endTime = 0; } string sql = "select F_GameNo,COUNT(F_LBAccount) as playerCount from dbo.T_GameLog where F_LogTime >= '" + time + " " + beginTime + ":00:00' and F_LogTime< '" + time + " " + endTime + ":00:00' group by F_GameNo"; using (SqlDataReader reader = SqlHelper.ExecuteReader(System.Data.CommandType.Text, sql, null)) { while (reader.Read()) { RealTimeActiveItem item = new RealTimeActiveItem(); item.EGameName = reader["F_GameNo"].ToString(); item.PlayerCounts = reader["playerCount"].ToString(); item.HourString = endTime.ToString(); report.items.Add(item); } } } return(report); }
public ActionResult Default() { ///顶部矩形框数据 IndexTopReport data = DataReportApp.ToIndexTopReport(); ViewBag.PlayerAllCount = data.PlayerAllCount; ViewBag.PlayerCountToday = data.PlayerCountToday; ViewBag.TotalConsumeLbCount = data.TotalConsumeLbCount; ViewBag.TotalConsumeLoveBirdCount = data.TotalConsumeLoveBirdCount; //人员实时情况统计 RealTimeActivePlayerStatisticsReport rept = DataReportApp.ToIndexRealTimeActivePlayerStatisticsReport(); // rept.items var data1 = "{ " + " labels: [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\", \"13\", \"14\", \"15\", \"16\", \"17\", \"18\", \"19\", \"20\", \"21\", \"22\", \"23\"], " + " datasets: [ " + " { " + "label: \"My First dataset\", " + " fillColor: \"rgba(255,0,0,0.2)\", " + " strokeColor: \"rgba(255,0,0,1)\", " + " pointColor: \"rgba(255,0,0,1)\", " + " pointStrokeColor: \"#fff\", " + " pointHighlightFill: \"#fff\", " + " pointHighlightStroke: \"rgba(255,0,0,1)\", " + " data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()] " + " }, " + " { " + " label: \"My Second dataset\", " + " fillColor: \"rgba(0,255,0,0.2)\", " + " strokeColor: \"rgba(0,255,0,1)\", " + " pointColor: \"rgba(0,255,0,1)\", " + " pointStrokeColor: \"#fff\", " + " pointHighlightFill: \"#fff\", " + " pointHighlightStroke: \"rgba(0,255,0,1)\", " + " data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()] " + " }, " + " { " + " label: \"My Second dataset\", " + " fillColor: \"rgba(255,255,0,0.2)\", " + " strokeColor: \"rgba(255,255,0,1)\", " + " pointColor: \"rgba(255,255,0,1)\", " + " pointStrokeColor: \"#fff\", " + " pointHighlightFill: \"#fff\", " + " pointHighlightStroke: \"rgba(255,255,0,1)\", " + " data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()] " + " }, " + " { " + " label: \"My Second dataset\", " + " fillColor: \"rgba(151,187,205,0.2)\", " + " strokeColor: \"rgba(151,187,205,1)\", " + " pointColor: \"rgba(151,187,205,1)\", " + " pointStrokeColor: \"#fff\", " + " pointHighlightFill: \"#fff\", " + " pointHighlightStroke: \"rgba(151,187,205,1)\", " + " data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()] " + " }, " + " { " + " label: \"My Second dataset\", " + " fillColor: \"rgba(151,187,205,0.2)\", " + " strokeColor: \"rgba(151,187,205,1)\", " + " pointColor: \"rgba(151,187,205,1)\", " + " pointStrokeColor: \"#fff\", " + " pointHighlightFill: \"#fff\", " + " pointHighlightStroke: \"rgba(151,187,205,1)\", " + " data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()] " + " } " + " ] " + " }"; ViewBag.data1 = data1; return(View()); }