//private static void zedGraphControl1_MouseMove(object sender, MouseEventArgs e)//鼠标移动出现虚线 //{ // using (Graphics gc = MainForm.getInstance().DTSReal.CreateGraphics()) // using (Pen pen = new Pen(Color.Gray)) // { // pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot; // RectangleF rect = MainForm.getInstance().DTSReal.GraphPane.Chart.Rect; // //确保在画图区域 // if (rect.Contains(e.Location)) // { // MainForm.getInstance().DTSReal.Refresh(); // gc.DrawLine(pen, e.X, rect.Top, e.X, rect.Bottom); // gc.DrawLine(pen, rect.Left, e.Y, rect.Right, e.Y); // } // } //} public static void drawRealDTS(List <DataTable> dt) { float wellzero = ZedGraphClass.getWellZero(); ZedGraph.GraphPane gp = MainForm.getInstance().DTSReal.GraphPane; MainForm.getInstance().DTSReal.PointValueEvent += new ZedGraphControl.PointValueHandler(ZedGraphClass.MyPointValueHandlerTime);//设置节点信息显示样式 //MainForm.getInstance().DTSReal.IsShowHScrollBar = true;//横向滚动条 // MainForm.getInstance().DTSReal.MouseMove += zedGraphControl1_MouseMove;//鼠标在图上移动出现x虚线 MainForm.getInstance().DTSReal.IsShowPointValues = true; // MainForm.getInstance().DTSReal.IsZoomOnMouseCenter = false; //使用滚轮时以鼠标所在点进行缩放还是以图形中心进行缩放。 gp.GraphObjList.Clear(); gp.CurveList.Clear(); //int Linenumber = Convert.ToInt32(MainForm.getInstance().DTSLineNumber.Text); //int k = 0; //if (dt.Count - Linenumber < 0) //{ //} //else //{ // k = dt.Count - Linenumber; //} for (int i = 1; i < dt.Count; i++)//从第一条线开始,并且两条线 { DataTable table = dt[i]; string Linename = table.Rows[0][0].ToString(); PointPairList list1 = new PointPairList(); for (int j = 0; j < table.Rows.Count; j++) { double x; float y; //X轴减去部分井口数据。 x = float.Parse(table.Rows[j][1].ToString()) - wellzero; y = float.Parse(table.Rows[j][2].ToString()); list1.Add(x, y); } if (list1.Count == 0)//如果曲线没有数据 { continue; } else { Color co = ZedGraphClass.GetColor(i); LineItem _lineitem2 = gp.AddCurve(Linename, list1, ZedGraphClass.GetColor(i), SymbolType.Circle); _lineitem2.Line.Width = 2.0F; //线的宽度 string la = _lineitem2.Label.Text.ToString(); _lineitem2.Symbol.Size = 2.4F; //线上节点的大小 _lineitem2.Symbol.Fill = new Fill(co); //线上节点的颜色 //gp.AxisChange();//若是 } } gp.AxisChange();//若是放到上面的那一行,因为数据太多,会有延迟,导致图形颜色不断变化(一条线一条线的画) MainForm.getInstance().DTSReal.Refresh(); }
public static void DrawingDep()//画时间温度曲线 { //获取时间的查询条件 string messageError = null; String SQLstr = getSQLstr(); MySqlConnection mycon = new MySqlConnection(); mycon = getMycon(); //获取井口位置 float wellzero = ZedGraphClass.getWellZero(); //获取循环(单循环还是多循环) string button = MainForm.getInstance().number.Text; //画图图禁止菜单和画图区域 MainForm.getInstance().groupBox2.Enabled = false; MainForm.getInstance().zgcDep.Enabled = false; //新建数据库连接 string DsingleDepth = MainForm.getInstance().DsingleDepth.Text; if (SQLstr != null) { DataTable SQLName = getTNameTable(DintervalTime1, DintervalTime2);//获取需要使用的表名称 if (SQLName.Rows.Count != 0) { ArrayList SQLList = MyDataTable.getDepth(wellzero, DsingleDepth); //获取深度值 if (SQLList.Count <= 15 && SQLList.Count > 0) //15条线之内 { SQLList = ZedGraphClass.getNewDepth(SQLList); //去重 ZedGraph.GraphPane gp = MainForm.getInstance().zgcDep.GraphPane; //gp.CurveList.Clear();//清除上一步画的图 gp.GraphObjList.Clear(); gp.CurveList.Clear(); //是否X、Y轴缩放的定义 if (MainForm.getInstance().label1.Text == "1") { MainForm.getInstance().zgcDep.IsEnableVZoom = true; //Y轴缩放 MainForm.getInstance().zgcDep.IsEnableHZoom = true; //x轴缩放 } else { MainForm.getInstance().zgcDep.IsEnableVZoom = false; //禁止Y轴缩放 MainForm.getInstance().zgcDep.IsEnableHZoom = true; //x轴缩放 } MainForm.getInstance().zgcDep.PointValueEvent += new ZedGraphControl.PointValueHandler(ZedGraphClass.MyPointValueHandlerDep); //设置节点信息显示样式 MainForm.getInstance().zgcDep.MouseMove += zedGraphControl1_MouseMove; //鼠标在图上移动出现x虚线 MainForm.getInstance().zgcDep.IsShowPointValues = true; //显示节点坐标值 MainForm.getInstance().zgcDep.IsZoomOnMouseCenter = false; //使用滚轮时以鼠标所在点进行缩放还是以图形中心进行缩放。 if (MainForm.getInstance().DintervalTM1.Text != "" && MainForm.getInstance().DintervalTM2.Text != "") { gp.YAxis.Scale.Min = float.Parse(MainForm.getInstance().DintervalTM1.Text); gp.YAxis.Scale.Max = float.Parse(MainForm.getInstance().DintervalTM2.Text); } else { gp.YAxis.Scale.MaxAuto = true; //自动设置大小 gp.YAxis.Scale.MinAuto = true; } MainForm.getInstance().zgcDep.IsAutoScrollRange = false; //坐标轴刻度格式 gp.XAxis.Scale.Format = "yyyy-MM-dd HH:mm:ss"; //横轴格式 gp.XAxis.Type = AxisType.Date; //格式 string[] hn = new string[SQLList.Count]; //折线的标签 if (button == "two") //循环作图 { for (int xunhuan = 0; xunhuan < 4; xunhuan++) { //清除上一步画的图 gp.GraphObjList.Clear(); gp.CurveList.Clear(); for (int i = 0; i < SQLList.Count; i++) { System.Threading.Thread.Sleep(1000); PointPairList list1 = new PointPairList(); DataTable dtValue = new DataTable(); string SQLque = "RecordTime"; dtValue = MyDataTable.getDataTable(SQLName, Convert.ToInt32(SQLList[i]), SQLstr, SQLque, mycon); float e = Convert.ToInt32(SQLList[i].ToString()) - wellzero; hn[i] = e + "m"; for (int k = 0; k < dtValue.Rows.Count; k++) { int bili = 1; if (dtValue.Rows.Count > 1000) { bili = dtValue.Rows.Count / 500; } if (k % bili == 0) { double x = (double)new XDate((DateTime)dtValue.Rows[k]["RecordTime"]); string a = dtValue.Rows[k]["RecordTime"].ToString(); double y = double.Parse(dtValue.Rows[k]["TM"].ToString()); list1.Add(x, y); } } if (list1.Count == 0 && xunhuan == 0) //如果曲线没有数据 { messageError += "深度" + SQLList[i] + "m无数据\n"; continue; } else { Color co = ZedGraphClass.GetColor(i); LineItem _lineitem2 = gp.AddCurve(hn[i], list1, co, SymbolType.Circle); _lineitem2.Line.Width = 2.0F; //线的宽度 //节点设置 if (drawAttribute.Linenum == 2) { _lineitem2.Line.IsVisible = false; } _lineitem2.Symbol.Size = 2.4F; //线上节点的大小 _lineitem2.Symbol.Fill = new Fill(co); //线上节点的颜色 gp.AxisChange(); MainForm.getInstance().zgcDep.Refresh(); } } } } else { for (int i = 0; i < SQLList.Count; i++) { PointPairList list1 = new PointPairList(); DataTable dtValue = new DataTable(); string SQLque = "RecordTime"; dtValue = MyDataTable.getDataTable(SQLName, Convert.ToInt32(SQLList[i]), SQLstr, SQLque, mycon); float e = Convert.ToInt32(SQLList[i].ToString()) - wellzero; hn[i] = e + "m"; for (int k = 0; k < dtValue.Rows.Count; k++) { int bili = 1; if (dtValue.Rows.Count > 1000) { bili = dtValue.Rows.Count / 500; } if (k % bili == 0) { double x = (double)new XDate((DateTime)dtValue.Rows[k]["RecordTime"]); string a = dtValue.Rows[k]["RecordTime"].ToString(); double y = double.Parse(dtValue.Rows[k]["TM"].ToString()); list1.Add(x, y); } } if (list1.Count == 0) //如果曲线没有数据 { messageError += "深度" + SQLList[i] + "m无数据\n"; continue; } else { Color co = ZedGraphClass.GetColor(i); LineItem _lineitem2 = gp.AddCurve(hn[i], list1, co, SymbolType.Circle); _lineitem2.Line.Width = 2.0F; //线的宽度 //节点设置 if (drawAttribute.Linenum == 2) { _lineitem2.Line.IsVisible = false; } _lineitem2.Symbol.Size = 2.4F; //线上节点的大小 _lineitem2.Symbol.Fill = new Fill(co); //线上节点的颜色 gp.AxisChange(); MainForm.getInstance().zgcDep.Refresh(); } } } } else if (SQLList.Count > 15) { //MessageBox.Show("深度区间太大,曲线条数大于15"); MessageBox.Show("深度区间太大,曲线条数大于15!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { // MessageBox.Show("在所选时间区间内数据库中无数据");//表中无数据 MessageBox.Show("请填写深度!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { // MessageBox.Show("所选时间区间内没有数据,请更改时间区域!"); //没有表 MessageBox.Show("所选时间区间内没有数据,请更改时间区域!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (messageError != null) { MessageBox.Show("以下深度点无数据!\n" + messageError, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { // MessageBox.Show("时间区间选择不正确,请修改!"); MessageBox.Show("时间区间选择不正确,请修改!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } MainForm.getInstance().groupBox2.Enabled = true; MainForm.getInstance().zgcDep.Enabled = true; mycon.Close(); mycon.Dispose(); SQLstr = null; }
public static void DrawingGratDep()//画时间温度曲线 { MyThread myt = new MyThread(); string messageError = null; string GratDepth = MainForm.getInstance().textBox3.Text; String SQLstr = getstr();//获取str MainForm.getInstance().groupBox1.Enabled = false; MainForm.getInstance().GDep.Enabled = false; MySqlConnection mycon = new MySqlConnection(); mycon = getMycon(); string button = MainForm.getInstance().number.Text; float wellzero = ZedGraphClass.getWellZero(); if (SQLstr != null) { DataTable SQLName = getTNameTable(GratDepTime1, GratDepTime2);//获取需要使用的表名称 if (SQLName.Rows.Count != 0) { ArrayList SQLList = MyDataTable.getDepth(wellzero, GratDepth);//获取深度值 if (SQLList.Count != 0) { SQLList = ZedGraphClass.getNewDepth(SQLList);//去重 ZedGraph.GraphPane gp = MainForm.getInstance().GDep.GraphPane; gp.GraphObjList.Clear(); gp.CurveList.Clear(); if (MainForm.getInstance().label1.Text == "1") { MainForm.getInstance().GDep.IsEnableVZoom = true; //Y轴缩放 MainForm.getInstance().GDep.IsEnableHZoom = true; //x轴缩放 } else { MainForm.getInstance().GDep.IsEnableVZoom = false; //禁止Y轴缩放 MainForm.getInstance().GDep.IsEnableHZoom = true; //x轴缩放 } MainForm.getInstance().GDep.PointValueEvent += new ZedGraphControl.PointValueHandler(ZedGraphClass.MyPointValueHandlerDep); //设置节点信息显示样式 //MainForm.getInstance().GDep.IsShowHScrollBar = true; //是否显示横向滚动条。 //MainForm.getInstance().GDep.ZoomStepFraction = 0;//不允许鼠标放大缩小 MainForm.getInstance().GDep.MouseMove += zedGraphControl1_MouseMove; //鼠标在图上移动出现x虚线 MainForm.getInstance().GDep.IsShowPointValues = true; //显示节点坐标值 MainForm.getInstance().GDep.IsZoomOnMouseCenter = false; //使用滚轮时以鼠标所在点进行缩放还是以图形中心进行缩放。 if (MainForm.getInstance().GratDepTM1.Text != "" && MainForm.getInstance().GratDepTM2.Text != "") { gp.YAxis.Scale.Min = float.Parse(MainForm.getInstance().GratDepTM1.Text); gp.YAxis.Scale.Max = float.Parse(MainForm.getInstance().GratDepTM2.Text); } else { gp.YAxis.Scale.MaxAuto = true;//自动设置大小 gp.YAxis.Scale.MinAuto = true; } MainForm.getInstance().GDep.IsAutoScrollRange = false; gp.XAxis.Scale.Format = "yyyy-MM-dd HH:mm:ss"; //横轴格式 gp.XAxis.Type = AxisType.Date; //格式 string[] hn = new string[SQLList.Count]; //折现的标签 if (button == "two") { for (int k = 0; k < 4; k++) { gp.GraphObjList.Clear(); gp.CurveList.Clear();//清除上一步画的图 for (int i = 0; i < SQLList.Count; i++) { System.Threading.Thread.Sleep(1000); DataTable dtValue = new DataTable(); string SQLque = "RecordTime"; dtValue = MyDataTable.getDataTable(SQLName, Convert.ToInt32(SQLList[i]), SQLstr, SQLque, mycon); float e = Convert.ToInt32(SQLList[i].ToString()) - wellzero; hn[i] = e + "m"; //hn[i] = SQLList[i] + "m"; PointPairList list1 = new PointPairList(); for (int j = 0; j < dtValue.Rows.Count; j++) { int bili = 1; if (dtValue.Rows.Count > 1000) { bili = dtValue.Rows.Count / 500; } if (j % bili == 0) { // string a = dt.Rows[j]["RecordTime"].ToString(); double x = (double)new XDate((DateTime)dtValue.Rows[j]["RecordTime"]); //double x = (double)new XDate((DateTime)dt.Rows[j]["RecordTime"]); float y = float.Parse(dtValue.Rows[j]["TM"].ToString()); list1.Add(x, y); } //TextObj text = new TextObj("shiji", x, y); //gp.GraphObjList.Add(text); } if (list1.Count == 0 && k == 0)//如果曲线没有数据或缺少数据 { //MessageBox.Show("曲线不存在"); messageError += "深度" + SQLList[i] + "m无数据\n"; continue; } else { Color co = ZedGraphClass.GetColor(i); LineItem _lineitem2 = gp.AddCurve(hn[i], list1, ZedGraphClass.GetColor(i), SymbolType.Circle); //_lineitem2.Label.IsVisible = false;//名称不见的一种形式 _lineitem2.Line.Width = 2.0F;//线的宽度 //节点设置 if (drawAttribute.Linenum == 2) { _lineitem2.Line.IsVisible = false; } _lineitem2.Symbol.Size = 2.4F; //线上节点的大小 _lineitem2.Symbol.Fill = new Fill(co); //线上节点的颜色 gp.AxisChange(); MainForm.getInstance().GDep.Refresh(); } } } } else { for (int i = 0; i < SQLList.Count; i++)//先做深度循环 { DataTable dtValue = new DataTable(); string SQLque = "RecordTime"; dtValue = MyDataTable.getDataTable(SQLName, Convert.ToInt32(SQLList[i]), SQLstr, SQLque, mycon); float e = Convert.ToInt32(SQLList[i].ToString()) - wellzero; hn[i] = e + "m"; PointPairList list1 = new PointPairList(); for (int j = 0; j < dtValue.Rows.Count; j++) { int bili = 1; if (dtValue.Rows.Count > 1000) { bili = dtValue.Rows.Count / 500; } if (j % bili == 0) { double x = (double)new XDate((DateTime)dtValue.Rows[j]["RecordTime"]); // string a = dt.Rows[j]["RecordTime"].ToString(); double y = double.Parse(dtValue.Rows[j]["TM"].ToString()); list1.Add(x, y); } } if (list1.Count == 0)//如果曲线没有数据 { messageError += "深度" + SQLList[i] + "m无数据\n"; continue; } else { Color co = ZedGraphClass.GetColor(i); LineItem _lineitem2 = gp.AddCurve(hn[i], list1, co, SymbolType.Circle); _lineitem2.Line.Width = 2.0F;//线的宽度 string la = _lineitem2.Label.Text.ToString(); //节点设置 if (drawAttribute.Linenum == 2) { _lineitem2.Line.IsVisible = false; } _lineitem2.Symbol.Size = 2.4F; //线上节点的大小 _lineitem2.Symbol.Fill = new Fill(co); //线上节点的颜色 gp.AxisChange(); MainForm.getInstance().GDep.Refresh(); } } } } else { //MessageBox.Show("深度输入不正确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("请填写深度!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { //MessageBox.Show("所选时间区间内没有数据,请更改时间区域!"); //没有表 MessageBox.Show("所选时间区间内没有数据,请更改时间区域!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (messageError != null) { MessageBox.Show("以下深度点无数据!\n" + messageError, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("时间区间选择不正确,请修改!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } MainForm.getInstance().groupBox1.Enabled = true; MainForm.getInstance().GDep.Enabled = true; mycon.Close(); mycon.Dispose(); SQLstr = null; }
//private static void zedGraphControl1_MouseMove(object sender, MouseEventArgs e)//鼠标移动出现虚线 //{ // using (Graphics gc = MainForm.getInstance().GratReal.CreateGraphics()) // using (Pen pen = new Pen(Color.Gray)) // { // pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot; // RectangleF rect = MainForm.getInstance().GratReal.GraphPane.Chart.Rect; // //确保在画图区域 // if (rect.Contains(e.Location)) // { // MainForm.getInstance().GratReal.Refresh(); // gc.DrawLine(pen, e.X, rect.Top, e.X, rect.Bottom); // gc.DrawLine(pen, rect.Left, e.Y, rect.Right, e.Y); // } // } //} public static void drawRealGrat(List <DataTable> dt) { int Linenumber = Convert.ToInt32(MainForm.getInstance().GratLineNumber.Text); float wellzero = ZedGraphClass.getWellZero(); //if (dt.Count <= Linenumber) //{ // //画图 //} //else //{ // //达到11的话,删除最初的列表。并作图。 // int j = dt.Count - Linenumber; // if (j > 0) // { // for (int i = 0; i < j; i++) // { // dt.RemoveAt(0); // } // } //} ZedGraph.GraphPane gp = MainForm.getInstance().GratReal.GraphPane; MainForm.getInstance().GratReal.PointValueEvent += new ZedGraphControl.PointValueHandler(ZedGraphClass.MyPointValueHandlerTime);//设置节点信息显示样式 //MainForm.getInstance().GratReal.IsShowHScrollBar = true;//横向滚动条 //MainForm.getInstance().GratReal.MouseMove += zedGraphControl1_MouseMove;//鼠标在图上移动出现x虚线 MainForm.getInstance().GratReal.IsShowPointValues = true; // MainForm.getInstance().GratReal.IsZoomOnMouseCenter = false; //使用滚轮时以鼠标所在点进行缩放还是以图形中心进行缩放。 gp.GraphObjList.Clear(); gp.CurveList.Clear(); int k = 0; if (dt.Count - Linenumber < 0) { } else { k = dt.Count - Linenumber; } for (int i = k; i < dt.Count; i++)//从第几条线开始,到结束 { DataTable table = dt[i]; string Linename = table.Rows[0][0].ToString(); PointPairList list1 = new PointPairList(); for (int j = 0; j < table.Rows.Count; j++) { double x; float y; x = float.Parse(table.Rows[j]["fb"].ToString()) - wellzero; y = float.Parse(table.Rows[j]["fc"].ToString()); list1.Add(x, y); } if (list1.Count == 0)//如果曲线没有数据 { //MessageBox.Show("曲线不存在"); continue; } else { Color co = ZedGraphClass.GetColor(i); LineItem _lineitem2 = gp.AddCurve(Linename, list1, ZedGraphClass.GetColor(i), SymbolType.Circle); _lineitem2.Line.Width = 2.0F; //线的宽度 string la = _lineitem2.Label.Text.ToString(); _lineitem2.Symbol.Size = 2.4F; //线上节点的大小 _lineitem2.Symbol.Fill = new Fill(co); //线上节点的颜色 gp.AxisChange(); } } MainForm.getInstance().GratReal.Refresh(); }
public static void DrawingGratTime()//画深度温度曲线 { float wellzero = ZedGraphClass.getWellZero(); MainForm.getInstance().groupBox4.Enabled = false; MainForm.getInstance().GTime.Enabled = false; MySqlConnection mycon = new MySqlConnection(); mycon = getMycon(); string button = MainForm.getInstance().number.Text; //ArrayList h2 = getGTime(mycon);//获取表名称列表 DataTable SQLTableTime = getGTime(mycon); //获取时间值 if (SQLTableTime.Rows.Count < 15 && SQLTableTime.Rows.Count > 0) //15条线之内 { ZedGraph.GraphPane gp = MainForm.getInstance().GTime.GraphPane; gp.GraphObjList.Clear(); gp.CurveList.Clear(); //清除上一步画的图 if (MainForm.getInstance().label1.Text == "1") { MainForm.getInstance().GTime.IsEnableVZoom = true; //Y轴缩放 MainForm.getInstance().GTime.IsEnableHZoom = true; //x轴缩放 } else { MainForm.getInstance().GTime.IsEnableVZoom = false; //禁止Y轴缩放 MainForm.getInstance().GTime.IsEnableHZoom = true; //x轴缩放 } MainForm.getInstance().GTime.PointValueEvent += new ZedGraphControl.PointValueHandler(ZedGraphClass.MyPointValueHandlerTime); //设置节点信息显示样式 //MainForm.getInstance().GTime.IsShowHScrollBar = true;//横向滚动条 MainForm.getInstance().GTime.MouseMove += zedGraphControl1_MouseMove; //鼠标在图上移动出现x虚线 MainForm.getInstance().GTime.IsShowPointValues = true; // MainForm.getInstance().GTime.IsZoomOnMouseCenter = false; //使用滚轮时以鼠标所在点进行缩放还是以图形中心进行缩放。 //设置XY轴的起始点 if (MainForm.getInstance().GratDepTM3.Text != "" && MainForm.getInstance().GratDepTM4.Text != "") { gp.YAxis.Scale.Min = float.Parse(MainForm.getInstance().GratDepTM3.Text); gp.YAxis.Scale.Max = float.Parse(MainForm.getInstance().GratDepTM4.Text); } else { gp.YAxis.Scale.MaxAuto = true; gp.YAxis.Scale.MinAuto = true; } MainForm.getInstance().GTime.IsAutoScrollRange = false; //ZedGraphClass.stile(gp);//在程序打开时已经加载过了 //坐标轴标题格式 // gp.Title.Text = "LD27-2平台 A22H井 温度深度曲线"; //图表轴名称 //gp.XAxis.Title.Text = "深度"; //X轴名称; //gp.YAxis.Title.Text = "温度"; //Y轴名称 string[] hn = new string[SQLTableTime.Rows.Count]; //图例名称 if (button == "two") //循环生成 { for (int k = 0; k < 4; k++) //循环四次结束循环 { gp.GraphObjList.Clear(); gp.CurveList.Clear(); for (int i = 0; i < SQLTableTime.Rows.Count; i++) { //清除上一步画的图 System.Threading.Thread.Sleep(1500); string Str = null; DataTable dtValue = new DataTable(); Str = "SELECT Depth,RecordTime,TM from " + SQLTableTime.Rows[i]["folderTable"] + " where RecordTime=\'" + Convert.ToDateTime(SQLTableTime.Rows[i]["folderTime"]) + "\' ORDER BY Depth"; // str3 = "SELECT COUNT(*) from " + tableName.Rows[j][0] + " WHERE RecordTime between \'" + DintervalTime1 + "\' AND \'" + DintervalTime2 + "\'"; dtValue = getDataTable(Str, mycon); hn[i] = SQLTableTime.Rows[i]["folderTime"].ToString(); PointPairList list1 = new PointPairList(); for (int j = 0; j < dtValue.Rows.Count; j++) { double x; float y; if (num == 1) { x = float.Parse(dtValue.Rows[j]["TM"].ToString()); y = float.Parse(dtValue.Rows[j]["Depth"].ToString()) - wellzero; } else { x = float.Parse(dtValue.Rows[j]["Depth"].ToString()) - wellzero; y = float.Parse(dtValue.Rows[j]["TM"].ToString()); } list1.Add(x, y); } if (list1.Count == 0 && k == 0) //如果曲线没有数据 { messageError += "时间" + (MainForm.getInstance().TimeList.Items[i]).ToString() + "无数据\n"; continue; } else { Color co = ZedGraphClass.GetColor(i); LineItem _lineitem2 = gp.AddCurve(hn[i], list1, ZedGraphClass.GetColor(i), SymbolType.Circle); _lineitem2.Line.Width = 2.0F; //线的宽度 _lineitem2.Symbol.Size = 2.4F; //线上节点的大小 if (drawAttribute.Linenum == 2) { _lineitem2.Line.IsVisible = false; } _lineitem2.Symbol.Fill = new Fill(co); //线上节点的颜色 gp.AxisChange(); MainForm.getInstance().GTime.Refresh(); } } } } else //生成 { for (int i = 0; i < SQLTableTime.Rows.Count; i++) { string Str = null; DataTable dtValue = new DataTable(); Str = "SELECT Depth,RecordTime,TM from " + SQLTableTime.Rows[i]["folderTable"] + " where RecordTime=\'" + Convert.ToDateTime(SQLTableTime.Rows[i]["folderTime"]) + "\' ORDER BY Depth"; // str3 = "SELECT COUNT(*) from " + tableName.Rows[j][0] + " WHERE RecordTime between \'" + DintervalTime1 + "\' AND \'" + DintervalTime2 + "\'"; dtValue = getDataTable(Str, mycon); hn[i] = SQLTableTime.Rows[i]["folderTime"].ToString(); PointPairList list1 = new PointPairList(); for (int j = 0; j < dtValue.Rows.Count; j++) { double x; float y; if (num == 1) { x = float.Parse(dtValue.Rows[j]["TM"].ToString()); y = float.Parse(dtValue.Rows[j]["Depth"].ToString()) - wellzero; } else { x = float.Parse(dtValue.Rows[j]["Depth"].ToString()) - wellzero; y = float.Parse(dtValue.Rows[j]["TM"].ToString()); } list1.Add(x, y); } if (list1.Count == 0) //如果曲线没有数据 { messageError += "时间" + (MainForm.getInstance().TimeList.Items[i]).ToString() + "无数据\n"; continue; } else { Color co = ZedGraphClass.GetColor(i); LineItem _lineitem2 = gp.AddCurve(hn[i], list1, ZedGraphClass.GetColor(i), SymbolType.Circle); _lineitem2.Line.Width = 2.0F; //线的宽度 //string la = _lineitem2.Label.Text.ToString(); if (drawAttribute.Linenum == 2) { _lineitem2.Line.IsVisible = false; } _lineitem2.Symbol.Size = 2.4F; //线上节点的大小 _lineitem2.Symbol.Fill = new Fill(co); //线上节点的颜色 gp.AxisChange(); MainForm.getInstance().GTime.Refresh(); } } } } else if (SQLTableTime.Rows.Count > 15) { MessageBox.Show("时间区间太大,曲线条数大于15"); } else { if (messageError == null) { MessageBox.Show("没有添加时间点!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } MainForm.getInstance().groupBox4.Enabled = true; MainForm.getInstance().GTime.Enabled = true; mycon.Close(); if (messageError != null) { MessageBox.Show("以下时间点无数据!\n" + messageError, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }