private void ChartDataBinding() { if (DateTime.Parse(enddate.Value).Date >= DateTime.Now.Date) { this.RegisterStartupScript("日期错误", "<script>alert('只能查询当天之前的数据!');</script>"); return; } if (DateTime.Parse(startdate.Value).Date > DateTime.Parse(enddate.Value).Date) { this.RegisterStartupScript("日期错误", "<script>alert('开始时间必须小于结束时间!');</script>"); return; } SeatManageWebV2.Code.ReadingRoomStatistics rrsta = new Code.ReadingRoomStatistics(); List <string> roomList = new List <string>(); foreach (System.Web.UI.WebControls.ListItem li in cblreadingroom.Items) { if (li.Selected) { roomList.Add(li.Value); } } List <SeatManage.ClassModel.ReadingRoomInfo> rooms = new List <SeatManage.ClassModel.ReadingRoomInfo>(); if (roomList.Count == 0) { List <string> libno = new List <string>(); libno.Add(ddlLibrary.SelectedItem.Value); rooms = SeatManage.Bll.T_SM_ReadingRoom.GetReadingRooms(null, libno, null); } else { rooms = SeatManage.Bll.T_SM_ReadingRoom.GetReadingRooms(roomList, null, null); } SeatManage.ClassModel.ReadingRoomUsageStatistics roomUsage = rrsta.StatisticsSelectAndLeave(rooms, DateTime.Parse(startdate.Value), DateTime.Parse(enddate.Value)); Chart1.Series.Clear(); System.Web.UI.DataVisualization.Charting.Series sers = new System.Web.UI.DataVisualization.Charting.Series(); sers.Name = "EnterOutCount"; sers.Points.DataBindXY(roomUsage.SeatSelect.DefaultView, "SelectType", roomUsage.SeatSelect.DefaultView, "Count"); sers.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Pie; sers.ChartArea = "ChartArea1"; sers.IsValueShownAsLabel = true; sers.YValuesPerPoint = 4; Chart1.Series.Add(sers); Chart2.Series.Clear(); System.Web.UI.DataVisualization.Charting.Series serl = new System.Web.UI.DataVisualization.Charting.Series(); serl.Name = "EnterOutCount"; serl.Points.DataBindXY(roomUsage.SeatLeave.DefaultView, "LeaveType", roomUsage.SeatLeave.DefaultView, "Count"); serl.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Pie; serl.ChartArea = "ChartArea1"; serl.IsValueShownAsLabel = true; serl.YValuesPerPoint = 4; Chart2.Series.Add(serl); Chart3.Series.Clear(); System.Web.UI.DataVisualization.Charting.Series sert = new System.Web.UI.DataVisualization.Charting.Series(); sert.Name = "EnterOutCount"; sert.Points.DataBindXY(roomUsage.SeatTime.DefaultView, "SeatTime", roomUsage.SeatTime.DefaultView, "Count"); sert.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Pie; sert.ChartArea = "ChartArea1"; sert.IsValueShownAsLabel = true; sert.YValuesPerPoint = 4; Chart3.Series.Add(sert); }
public JsonResult HourChartDataBinding(DateTime?begin, DateTime?end, string libNo = "", string roomStr = "", string cbselect = "", string cbleave = "", string cbonseat = "") { if (begin == null || end == null) { return(Json(new { title = "日期错误", msg = "请选择日期!" })); } if (end.Value.Date >= DateTime.Now.Date) { return(Json(new { title = "日期错误", msg = "只能查询当天之前的数据!" })); } if (begin.Value.Date > end.Value.Date) { return(Json(new { title = "日期错误", msg = "开始时间必须小于结束时间!" }));; } if (string.IsNullOrEmpty(libNo)) { return(Json(new { title = "图书馆错误", msg = "请选择图书馆!" })); } StringBuilder sb = new StringBuilder(); Dictionary <string, System.Data.DataTable> dataTables = new Dictionary <string, DataTable>(); SeatManageWebV5.Code.ReadingRoomStatistics rrsta = new SeatManageWebV5.Code.ReadingRoomStatistics(); List <string> roomList = new List <string>(); if (!string.IsNullOrEmpty(roomStr)) { var arr = roomStr.Split(','); if (arr != null && arr.Length > 0) { foreach (var item in arr) { if (!string.IsNullOrEmpty(item)) { roomList.Add(item); } } } } if (roomList.Count == 0) { List <string> libno = new List <string>(); libno.Add(libNo); DataTable dt = rrsta.StatisticsHoursLibData(libno, begin.Value, end.Value); DataView dv = dt.DefaultView; dataTables.Add(libNo, dt); sb = GetHourChartJson(dt); } else { List <SeatManage.ClassModel.ReadingRoomInfo> rooms = SeatManage.Bll.ClientConfigOperate.GetReadingRooms(roomList); foreach (SeatManage.ClassModel.ReadingRoomInfo room in rooms) { SeatManage.ClassModel.ReadingRoomUsageStatistics roomUsage = rrsta.StatisticsHoursRoomData(room, begin.Value, end.Value); DataTable dt = roomUsage.StatisticsData; DataView dv = dt.DefaultView; dataTables.Add(room.Name, dt); sb.Append(GetHourChartJson(dt).ToString()); } } Session["DataTables"] = dataTables; return(Json(new { title = "", msg = "", data = sb.ToString() })); }
public JsonResult OutChartDataBinding(DateTime?begin, DateTime?end, string libNo = "", string rbltype = "", string rbleatype = "", string roomStr = "") { if (begin == null || end == null) { return(Json(new { title = "日期错误", msg = "请选择日期!" })); } if (end.Value.Date >= DateTime.Now.Date) { return(Json(new { title = "日期错误", msg = "只能查询当天之前的数据!" })); } if (begin.Value.Date > end.Value.Date) { return(Json(new { title = "日期错误", msg = "开始时间必须小于结束时间!" }));; } if (string.IsNullOrEmpty(libNo)) { return(Json(new { title = "图书馆错误", msg = "请选择图书馆!" })); } Dictionary <string, DataTable> dataTables = new Dictionary <string, DataTable>(); DataTable dtx = new DataTable(); dtx.Columns.Add("EnterOutCount", typeof(int)); dtx.Columns.Add("AttendanceCount", typeof(string)); dtx.Columns.Add("Room", typeof(string)); SeatManageWebV5.Code.ReadingRoomStatistics rrsta = new SeatManageWebV5.Code.ReadingRoomStatistics(); List <string> roomList = new List <string>(); if (!string.IsNullOrEmpty(roomStr)) { var arr = roomStr.Split(','); if (arr != null && arr.Length > 0) { foreach (var item in arr) { if (!string.IsNullOrEmpty(item)) { roomList.Add(item); } } } } StringBuilder sb1 = new StringBuilder(); StringBuilder sb2 = new StringBuilder(); if (roomList.Count == 0) { List <string> libno = new List <string>(); libno.Add(libNo); SeatManage.ClassModel.ReadingRoomUsageStatistics libUsage = rrsta.StatisticsDayLibData(libno, begin.Value, end.Value, ((SeatManage.ClassModel.StatisticsType) int.Parse(rbltype))); DataTable dt = libUsage.StatisticsData; DataView dv = dt.DefaultView; dataTables.Add(libNo, dt); string Title = string.Format("阅览室进出人次统计"); var ztext = ""; var colName = ""; if (rbleatype == "0" || rbleatype == "EnterOutCount") { ztext = "进出人次"; colName = "EnterOutCount"; } else { ztext = "上座率"; colName = "Attendance"; } sb1.Append("{title: {text: '" + Title + "'}, tooltip: {},legend: { data: ['" + ztext + "' ]}, xAxis: {axisLabel: {interval: 0,rotate:45,margin:2,textStyle:{color:\"#222\"}},"); sb1.Append(" data: ["); foreach (DataRow r in dt.Rows) { sb1.Append("'" + r["Date"] + "'"); sb1.Append(","); } sb1.Remove(sb1.Length - 1, 1); sb1.Append("] }, grid: { x: 40,x2: 100,y2: 150}, yAxis: {}, series: [{name: '" + ztext + "',type: 'bar',"); sb1.Append(" data: ["); foreach (DataRow r in dt.Rows) { sb1.Append("" + r[colName] + ""); sb1.Append(","); } sb1.Remove(sb1.Length - 1, 1); sb1.Append("],color: ['#ffff00']}]}"); DataRow dr = dtx.NewRow(); dr["Room"] = libNo; dr["EnterOutCount"] = libUsage.EnterOurCount; dr["AttendanceCount"] = (libUsage.Attendance * 100).ToString("0.00"); dtx.Rows.Add(dr); } else { List <SeatManage.ClassModel.ReadingRoomInfo> rooms = SeatManage.Bll.ClientConfigOperate.GetReadingRooms(roomList); string Title = string.Format("阅览室进出人次统计"); var ztext = ""; var colName = ""; if (rbleatype == "0" || rbleatype == "EnterOutCount") { colName = "EnterOutCount"; } else { colName = "Attendance"; } sb1.Append("{title: {text: '" + Title + "'}, tooltip: {},legend: { data: [%ztext% ]}, xAxis: {axisLabel: {interval: 0,rotate:45,margin:2,textStyle:{color:\"#222\"}},"); sb1.Append(" data: [%Date%] },"); sb1.Append(" grid: { x: 40,x2: 100,y2: 150}, yAxis: {}, series: [%series%]}"); int i = 0; var dateStr = ""; var ztextStr = ""; var series = ""; foreach (SeatManage.ClassModel.ReadingRoomInfo room in rooms) { SeatManage.ClassModel.ReadingRoomUsageStatistics roomUsage = rrsta.StatisticsDayRoomData(room, begin.Value, end.Value, ((SeatManage.ClassModel.StatisticsType) int.Parse(rbltype))); DataTable dt = roomUsage.StatisticsData; DataView dv = dt.DefaultView; dataTables.Add(room.Name, dt); if (i == 0) { foreach (DataRow r in dt.Rows) { dateStr += ("'" + r["Date"] + "'"); dateStr += (","); } } series += ("{name: '" + room.Name + "',type: 'bar', data: ["); foreach (DataRow r in dt.Rows) { series += ("" + r[colName] + ""); series += (","); } series.Remove(series.Length - 1, 1); series += ("]},"); ztext += "'" + room.Name + "'" + ","; DataRow dr = dtx.NewRow(); dr["Room"] = roomUsage.RoomInfo.Name; dr["EnterOutCount"] = roomUsage.EnterOurCount; dr["AttendanceCount"] = (roomUsage.Attendance * 100).ToString("0.00"); dtx.Rows.Add(dr); i++; } sb1.Replace("%Date%", dateStr.TrimEnd(',')); sb1.Replace("%ztext%", ztext.TrimEnd(',')); sb1.Replace("%series%", series.TrimEnd(',')); } Session["DataTables"] = dataTables; /*if (rbleatype == "EnterOutCount") * { * libraryEnterOutInfo.ChartAreas[0].AxisX.Title = "阅览室"; * libraryEnterOutInfo.ChartAreas[0].AxisY.Title = "人次"; * sereo.Name = "EnterOutCount"; * sereo.LegendText = "进出人次"; * sereo.Points.DataBindXY(dtx.DefaultView, "Room", dtx.DefaultView, "EnterOutCount"); * } * else * { * libraryAttendanceInfo.ChartAreas[0].AxisX.Title = "阅览室"; * libraryAttendanceInfo.ChartAreas[0].AxisY.Title = "人次"; * * sera.Name = "EnterOutCount"; * sera.LegendText = "上座率(%)"; * sera.Points.DataBindXY(dtx.DefaultView, "Room", dtx.DefaultView, "AttendanceCount"); * }*/ string Title1 = string.Format("阅览室进出人次统计(总数)"); var ztext1 = ""; var colName1 = ""; if (rbleatype == "0" || rbleatype == "EnterOutCount") { ztext1 = "进出人次"; colName1 = "EnterOutCount"; } else { ztext1 = "上座率"; colName1 = "AttendanceCount"; } sb2.Append("{title: {text: '" + Title1 + "'}, tooltip: {},legend: { data: ['" + ztext1 + "' ]}, xAxis: {axisLabel: {interval: 0,rotate:45,margin:2,textStyle:{color:\"#222\"}},"); sb2.Append(" data: ["); foreach (DataRow r in dtx.Rows) { sb2.Append("'" + r["Room"] + "'"); sb2.Append(","); } sb2.Remove(sb2.Length - 1, 1); sb2.Append("] }, grid: { x: 40,x2: 100,y2: 150}, yAxis: {}, series: [{name: '" + ztext1 + "',type: 'bar',"); sb2.Append(" data: ["); foreach (DataRow r in dtx.Rows) { sb2.Append("" + r[colName1] + ""); sb2.Append(","); } sb2.Remove(sb2.Length - 1, 1); sb2.Append("]}]}"); return(Json(new { title = "", msg = "", data1 = sb1.ToString(), data2 = sb2.ToString() })); }
public JsonResult SeatUseChartDataBinding(DateTime?begin, DateTime?end, string libNo = "", string roomStr = "") { if (begin == null || end == null) { return(Json(new { title = "日期错误", msg = "请选择日期!" })); } /*if (end.Value.Date >= DateTime.Now.Date) * { * return Json(new { title = "日期错误", msg = "只能查询当天之前的数据!" }); * }*/ if (begin.Value.Date > end.Value.Date) { return(Json(new { title = "日期错误", msg = "开始时间必须小于结束时间!" }));; } if (string.IsNullOrEmpty(libNo)) { return(Json(new { title = "图书馆错误", msg = "请选择图书馆!" })); } SeatManageWebV5.Code.ReadingRoomStatistics rrsta = new SeatManageWebV5.Code.ReadingRoomStatistics(); List <string> roomList = new List <string>(); if (!string.IsNullOrEmpty(roomStr)) { var arr = roomStr.Split(','); if (arr != null && arr.Length > 0) { foreach (var item in arr) { if (!string.IsNullOrEmpty(item)) { roomList.Add(item); } } } } List <SeatManage.ClassModel.ReadingRoomInfo> rooms = new List <SeatManage.ClassModel.ReadingRoomInfo>(); if (roomList.Count == 0) { List <string> libno = new List <string>(); libno.Add(libNo); rooms = SeatManage.Bll.T_SM_ReadingRoom.GetReadingRooms(null, libno, null); } else { rooms = SeatManage.Bll.ClientConfigOperate.GetReadingRooms(roomList); } SeatManage.ClassModel.ReadingRoomUsageStatistics roomUsage = rrsta.StatisticsSelectAndLeave(rooms, begin.Value, end.Value); var data1 = GetSeatUseChartJson(roomUsage.SeatSelect, "SelectType"); var data2 = GetSeatUseChartJson(roomUsage.SeatLeave, "LeaveType"); var data3 = GetSeatUseChartJson(roomUsage.SeatTime, "SeatTime"); Dictionary <string, DataTable> dataTables = new Dictionary <string, DataTable>(); dataTables.Add("选座方式", roomUsage.SeatSelect); dataTables.Add("离开方式", roomUsage.SeatLeave); dataTables.Add("在座时长", roomUsage.SeatTime); Session["DataTables"] = dataTables; return(Json(new { title = "", msg = "", data1 = data1, data2 = data2, data3 = data3 })); }
private void ChartDataBinding() { if (DateTime.Parse(enddate.Value).Date >= DateTime.Now.Date) { RegisterStartupScript("日期错误", "<script>alert('只能查询当天之前的数据!');</script>"); return; } if (DateTime.Parse(startdate.Value).Date > DateTime.Parse(enddate.Value).Date) { RegisterStartupScript("日期错误", "<script>alert('开始时间必须小于结束时间!');</script>"); return; } Dictionary <string, DataTable> dataTables = new Dictionary <string, DataTable>(); ReadingRoomStatistics rrsta = new ReadingRoomStatistics(); List <string> roomList = new List <string>(); foreach (ListItem li in cblreadingroom.Items) { if (li.Selected) { roomList.Add(li.Value); } } librarySeatUsedInfo.ChartAreas[0].AxisX.Interval = 1; librarySeatUsedInfo.ChartAreas[0].AxisX.Title = "时"; librarySeatUsedInfo.ChartAreas[0].AxisX.TitleAlignment = System.Drawing.StringAlignment.Far; librarySeatUsedInfo.ChartAreas[0].AxisX.MajorGrid.LineColor = System.Drawing.Color.WhiteSmoke; librarySeatUsedInfo.ChartAreas[0].AxisY.Title = "人次"; librarySeatUsedInfo.ChartAreas[0].AxisY.TitleAlignment = System.Drawing.StringAlignment.Far; librarySeatUsedInfo.ChartAreas[0].AxisY.MajorGrid.LineColor = System.Drawing.Color.WhiteSmoke; librarySeatUsedInfo.ChartAreas[0].BackColor = System.Drawing.Color.WhiteSmoke; librarySeatUsedInfo.Series.Clear(); if (roomList.Count == 0) { List <string> libno = new List <string>(); libno.Add(ddlLibrary.SelectedItem.Value); DataTable dt = rrsta.StatisticsHoursLibData(libno, DateTime.Parse(startdate.Value), DateTime.Parse(enddate.Value)); DataView dv = dt.DefaultView; dataTables.Add(ddlLibrary.SelectedItem.Text, dt); if (cbselect.Checked) { System.Web.UI.DataVisualization.Charting.Series ser = new System.Web.UI.DataVisualization.Charting.Series(); ser.Name = "EnterCount"; ser.LegendText = "入座人次"; ser.Points.DataBindXY(dv, "Hour", dv, "EnterCount"); ser.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Spline; ser.ChartArea = "ChartArea1"; ser.IsValueShownAsLabel = true; ser.YValuesPerPoint = 4; librarySeatUsedInfo.Series.Add(ser); } if (cbleave.Checked) { System.Web.UI.DataVisualization.Charting.Series serx = new System.Web.UI.DataVisualization.Charting.Series(); serx.Name = "LeaveCount"; serx.LegendText = "离开人次"; serx.Points.DataBindXY(dv, "Hour", dv, "OutCount"); serx.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Spline; serx.ChartArea = "ChartArea1"; serx.IsValueShownAsLabel = true; serx.YValuesPerPoint = 4; librarySeatUsedInfo.Series.Add(serx); } if (cbonseat.Checked) { System.Web.UI.DataVisualization.Charting.Series serx = new System.Web.UI.DataVisualization.Charting.Series(); serx.Name = "SeatCount"; serx.LegendText = "在座人数"; serx.Points.DataBindXY(dv, "Hour", dv, "SeatCount"); serx.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Spline; serx.ChartArea = "ChartArea1"; serx.IsValueShownAsLabel = true; serx.YValuesPerPoint = 4; librarySeatUsedInfo.Series.Add(serx); } } else { List <SeatManage.ClassModel.ReadingRoomInfo> rooms = SeatManage.Bll.ClientConfigOperate.GetReadingRooms(roomList); foreach (SeatManage.ClassModel.ReadingRoomInfo room in rooms) { SeatManage.ClassModel.ReadingRoomUsageStatistics roomUsage = rrsta.StatisticsHoursRoomData(room, DateTime.Parse(startdate.Value), DateTime.Parse(enddate.Value)); DataTable dt = roomUsage.StatisticsData; DataView dv = dt.DefaultView; dataTables.Add(room.Name, dt); if (cbselect.Checked) { System.Web.UI.DataVisualization.Charting.Series ser = new System.Web.UI.DataVisualization.Charting.Series(); ser.Name = room.No + "EnterCount"; ser.LegendText = room.Name + "入座人次"; ser.Points.DataBindXY(dv, "Hour", dv, "EnterCount"); ser.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Spline; ser.ChartArea = "ChartArea1"; ser.IsValueShownAsLabel = true; ser.YValuesPerPoint = 4; librarySeatUsedInfo.Series.Add(ser); } if (cbleave.Checked) { System.Web.UI.DataVisualization.Charting.Series serx = new System.Web.UI.DataVisualization.Charting.Series(); serx.Name = room.No + "LeaveCount"; serx.LegendText = room.Name + "离开人次"; serx.Points.DataBindXY(dv, "Hour", dv, "OutCount"); serx.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Spline; serx.ChartArea = "ChartArea1"; serx.IsValueShownAsLabel = true; serx.YValuesPerPoint = 4; librarySeatUsedInfo.Series.Add(serx); } if (cbonseat.Checked) { System.Web.UI.DataVisualization.Charting.Series serx = new System.Web.UI.DataVisualization.Charting.Series(); serx.Name = room.No + "SeatCount"; serx.LegendText = room.Name + "在座人数"; serx.Points.DataBindXY(dv, "Hour", dv, "SeatCount"); serx.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Spline; serx.ChartArea = "ChartArea1"; serx.IsValueShownAsLabel = true; serx.YValuesPerPoint = 4; librarySeatUsedInfo.Series.Add(serx); } } } Session["DataTables"] = dataTables; }
private void ChartDataBinding() { if (DateTime.Parse(enddate.Value).Date >= DateTime.Now.Date) { this.RegisterStartupScript("日期错误", "<script>alert('只能查询当天之前的数据!');</script>"); return; } if (DateTime.Parse(startdate.Value).Date > DateTime.Parse(enddate.Value).Date) { this.RegisterStartupScript("日期错误", "<script>alert('开始时间必须小于结束时间!');</script>"); return; } SeatManageWebV5.Code.ReadingRoomStatistics rrsta = new Code.ReadingRoomStatistics(); tl.InnerText = "阅览室进出人次统计(" + rbltype.SelectedItem.Text + ")"; List <string> roomList = new List <string>(); foreach (System.Web.UI.WebControls.ListItem li in cblreadingroom.Items) { if (li.Selected) { roomList.Add(li.Value); } } librarySeatUsedInfo.ChartAreas[0].AxisX.Title = "时间"; librarySeatUsedInfo.ChartAreas[0].AxisX.TitleAlignment = System.Drawing.StringAlignment.Far; librarySeatUsedInfo.ChartAreas[0].AxisX.MajorGrid.LineColor = System.Drawing.Color.WhiteSmoke; librarySeatUsedInfo.ChartAreas[0].AxisY.Title = "人次"; librarySeatUsedInfo.ChartAreas[0].AxisY.TitleAlignment = System.Drawing.StringAlignment.Far; librarySeatUsedInfo.ChartAreas[0].AxisY.MajorGrid.LineColor = System.Drawing.Color.WhiteSmoke; librarySeatUsedInfo.ChartAreas[0].AxisX.LabelStyle.Angle = 50; switch ((SeatManage.ClassModel.StatisticsType) int.Parse(rbltype.SelectedValue)) { case SeatManage.ClassModel.StatisticsType.DayOfWeek: case SeatManage.ClassModel.StatisticsType.DayOfMonth: case SeatManage.ClassModel.StatisticsType.MonthOfYear: librarySeatUsedInfo.ChartAreas[0].AxisX.LabelStyle.Interval = 1; break; case SeatManage.ClassModel.StatisticsType.DayOfYear: librarySeatUsedInfo.ChartAreas[0].AxisX.LabelStyle.Interval = 20; break; case SeatManage.ClassModel.StatisticsType.WeekOfYear: librarySeatUsedInfo.ChartAreas[0].AxisX.LabelStyle.Interval = 4; break; } DataTable dtx = new DataTable(); dtx.Columns.Add("EnterOutCount", typeof(int)); dtx.Columns.Add("AttendanceCount", typeof(string)); dtx.Columns.Add("Room", typeof(string)); librarySeatUsedInfo.ChartAreas[0].BackColor = System.Drawing.Color.WhiteSmoke; librarySeatUsedInfo.Series.Clear(); Dictionary <string, DataTable> dataTables = new Dictionary <string, DataTable>(); if (roomList.Count == 0) { List <string> libno = new List <string>(); libno.Add(ddlLibrary.SelectedItem.Value); SeatManage.ClassModel.ReadingRoomUsageStatistics libUsage = rrsta.StatisticsDayLibData(libno, DateTime.Parse(startdate.Value), DateTime.Parse(enddate.Value), ((SeatManage.ClassModel.StatisticsType) int.Parse(rbltype.SelectedValue))); DataTable dt = libUsage.StatisticsData; DataView dv = dt.DefaultView; dataTables.Add(ddlLibrary.SelectedItem.Text, dt); if (rbleatype.SelectedValue == "EnterOutCount") { System.Web.UI.DataVisualization.Charting.Series ser = new System.Web.UI.DataVisualization.Charting.Series(); ser.Name = "EnterOutCount"; ser.LegendText = "进出人次"; ser.Points.DataBindXY(dv, "Date", dv, "EnterOutCount"); ser.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Spline; ser.ChartArea = "ChartArea1"; ser.IsValueShownAsLabel = true; ser.YValuesPerPoint = 4; librarySeatUsedInfo.Series.Add(ser); } else { System.Web.UI.DataVisualization.Charting.Series ser = new System.Web.UI.DataVisualization.Charting.Series(); ser.Name = "AttendanceCount"; ser.LegendText = "上座率"; ser.Points.DataBindXY(dv, "Date", dv, "Attendance"); ser.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Spline; ser.ChartArea = "ChartArea1"; ser.IsValueShownAsLabel = true; ser.YValuesPerPoint = 4; librarySeatUsedInfo.Series.Add(ser); } DataRow dr = dtx.NewRow(); dr["Room"] = ddlLibrary.SelectedItem.Text; dr["EnterOutCount"] = libUsage.EnterOurCount; dr["AttendanceCount"] = (libUsage.Attendance * 100).ToString("0.00"); dtx.Rows.Add(dr); } else { List <SeatManage.ClassModel.ReadingRoomInfo> rooms = SeatManage.Bll.ClientConfigOperate.GetReadingRooms(roomList); foreach (SeatManage.ClassModel.ReadingRoomInfo room in rooms) { SeatManage.ClassModel.ReadingRoomUsageStatistics roomUsage = rrsta.StatisticsDayRoomData(room, DateTime.Parse(startdate.Value), DateTime.Parse(enddate.Value), ((SeatManage.ClassModel.StatisticsType) int.Parse(rbltype.SelectedValue))); DataTable dt = roomUsage.StatisticsData; DataView dv = dt.DefaultView; dataTables.Add(room.Name, dt); if (rbleatype.SelectedValue == "EnterOutCount") { System.Web.UI.DataVisualization.Charting.Series ser = new System.Web.UI.DataVisualization.Charting.Series(); ser.Name = room.Name + "EnterOutCount"; ser.LegendText = room.Name + "进出人次"; ser.Points.DataBindXY(dv, "Date", dv, "EnterOutCount"); ser.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Spline; ser.ChartArea = "ChartArea1"; ser.IsValueShownAsLabel = true; ser.YValuesPerPoint = 4; librarySeatUsedInfo.Series.Add(ser); } else { System.Web.UI.DataVisualization.Charting.Series ser = new System.Web.UI.DataVisualization.Charting.Series(); ser.Name = room.Name + "AttendanceCount"; ser.LegendText = room.Name + "上座率"; ser.Points.DataBindXY(dv, "Date", dv, "Attendance"); ser.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Spline; ser.ChartArea = "ChartArea1"; ser.IsValueShownAsLabel = true; ser.YValuesPerPoint = 4; librarySeatUsedInfo.Series.Add(ser); } DataRow dr = dtx.NewRow(); dr["Room"] = roomUsage.RoomInfo.Name; dr["EnterOutCount"] = roomUsage.EnterOurCount; dr["AttendanceCount"] = (roomUsage.Attendance * 100).ToString("0.00"); dtx.Rows.Add(dr); } } Session["DataTables"] = dataTables; if (rbleatype.SelectedValue == "EnterOutCount") { Span1.Visible = false; Span2.Visible = true; libraryEnterOutInfo.Visible = true; libraryAttendanceInfo.Visible = false; libraryEnterOutInfo.ChartAreas[0].AxisX.Title = "阅览室"; libraryEnterOutInfo.ChartAreas[0].AxisX.TitleAlignment = System.Drawing.StringAlignment.Far; libraryEnterOutInfo.ChartAreas[0].AxisX.MajorGrid.LineColor = System.Drawing.Color.WhiteSmoke; libraryEnterOutInfo.ChartAreas[0].AxisY.Title = "人次"; libraryEnterOutInfo.ChartAreas[0].AxisY.TitleAlignment = System.Drawing.StringAlignment.Far; libraryEnterOutInfo.ChartAreas[0].AxisY.MajorGrid.LineColor = System.Drawing.Color.WhiteSmoke; libraryEnterOutInfo.ChartAreas[0].AxisX.LabelStyle.Angle = 50; libraryEnterOutInfo.ChartAreas[0].BackColor = System.Drawing.Color.WhiteSmoke; libraryEnterOutInfo.ChartAreas[0].AxisX.LabelStyle.Interval = 1; libraryEnterOutInfo.Series.Clear(); System.Web.UI.DataVisualization.Charting.Series sereo = new System.Web.UI.DataVisualization.Charting.Series(); sereo.Name = "EnterOutCount"; sereo.LegendText = "进出人次"; sereo.Points.DataBindXY(dtx.DefaultView, "Room", dtx.DefaultView, "EnterOutCount"); sereo.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Column; sereo.ChartArea = "ChartArea1"; sereo["PointWidth"] = "0.1"; sereo.IsValueShownAsLabel = true; sereo.YValuesPerPoint = 4; libraryEnterOutInfo.Series.Add(sereo); } else { libraryEnterOutInfo.Visible = false; libraryAttendanceInfo.Visible = true; Span1.Visible = true; Span2.Visible = false; libraryAttendanceInfo.ChartAreas[0].AxisX.Title = "阅览室"; libraryAttendanceInfo.ChartAreas[0].AxisX.TitleAlignment = System.Drawing.StringAlignment.Far; libraryAttendanceInfo.ChartAreas[0].AxisX.MajorGrid.LineColor = System.Drawing.Color.WhiteSmoke; libraryAttendanceInfo.ChartAreas[0].AxisY.Title = "人次"; libraryAttendanceInfo.ChartAreas[0].AxisY.TitleAlignment = System.Drawing.StringAlignment.Far; libraryAttendanceInfo.ChartAreas[0].AxisY.MajorGrid.LineColor = System.Drawing.Color.WhiteSmoke; libraryAttendanceInfo.ChartAreas[0].AxisX.LabelStyle.Angle = 50; libraryAttendanceInfo.ChartAreas[0].BackColor = System.Drawing.Color.WhiteSmoke; libraryAttendanceInfo.ChartAreas[0].AxisX.LabelStyle.Interval = 1; libraryAttendanceInfo.Series.Clear(); System.Web.UI.DataVisualization.Charting.Series sera = new System.Web.UI.DataVisualization.Charting.Series(); sera.Name = "EnterOutCount"; sera.LegendText = "上座率(%)"; sera.Points.DataBindXY(dtx.DefaultView, "Room", dtx.DefaultView, "AttendanceCount"); sera.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Column; sera.Color = System.Drawing.Color.IndianRed; sera.ChartArea = "ChartArea1"; sera["PointWidth"] = "0.1"; sera.IsValueShownAsLabel = true; sera.YValuesPerPoint = 4; libraryAttendanceInfo.Series.Add(sera); } }