#region 设置x轴滚动 XYDiagram diagram = (XYDiagram)chartRoomUserAnalysisHis.Diagram; diagram.AxisX.VisualRange.Auto = false; //屏幕显示个数 int VisualCount = dtSource.Rows.Count > 30 ? 30 : dtSource.Rows.Count;
//屏幕最小值 DateTime minTime = DateTime.Parse(dtSource.Rows[0]["GETTIME"].ToString()); //屏幕最大值 DateTime maxTime = DateTime.Parse(dtSource.Rows[VisualCount - 1]["GETTIME"].ToString()); diagram.AxisX.VisualRange.MinValue = minTime; diagram.AxisX.VisualRange.MaxValue = maxTime;
#endregion
#region 添加X轴滚动条 XYDiagram diagram = (XYDiagram)chartControl.Diagram; //屏幕显示个数 int VisualCount = dtBackwaterTemper.Rows.Count > 30 ? 30 : dtBackwaterTemper.Rows.Count; //屏幕最小值 string strMinValue = dtBackwaterTemper.Rows[0]["BUILDMETERNAME"].ToString(); //屏幕最大值 string strMaxValue = dtBackwaterTemper.Rows[VisualCount - 1]["BUILDMETERNAME"].ToString(); diagram.AxisX.VisualRange.MinValue = strMinValue; diagram.AxisX.VisualRange.MaxValue = strMaxValue; #endregion