private void YXYHMain3_Load(object sender, EventArgs e) { dataGridView1.AutoGenerateColumns = false; dataGridView1.DataSource = CalTagValue.GetAllTagValues(); dataGridView1.Refresh(); timerLineBind.Interval = ConstYXYH.RefIntvel;; timerLineBind.Enabled = true; lblTemp.Tag = new LabelTag(false, 208, "环境温度"); lblTemp.DoubleClick += new EventHandler(Label_DoubleClick); //双击事件 lblTemp.MouseDown += new MouseEventHandler(control_MouseDown); //鼠标按下事件 //优化出水温度与实际出水温度 chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.Format = "HH:mm"; chart1.DataSource = m_dtLineData; //chart1.Series[0].LegendText = "优化出水温度"; chart1.Series[0].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart1.Series[0].XValueMember = "ValueTime"; chart1.Series[0].YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double; chart1.Series[0].YValueMembers = "F213"; //chart1.Series[1].LegendText = "实际出水温度"; chart1.Series[1].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart1.Series[1].XValueMember = "ValueTime"; chart1.Series[1].YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double; chart1.Series[1].YValueMembers = "F152"; //优化功率与实际功率,**********这里实际显示的是“热负荷” chart3.ChartAreas["ChartArea1"].AxisX.LabelStyle.Format = "HH:mm"; chart3.DataSource = m_dtLineData; //chart1.Series[0].LegendText = "优化热负荷"; chart3.Series[0].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart3.Series[0].XValueMember = "ValueTime"; chart3.Series[0].YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double; chart3.Series[0].YValueMembers = "F219"; //chart1.Series[1].LegendText = "实际热负荷"; chart3.Series[1].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart3.Series[1].XValueMember = "ValueTime"; chart3.Series[1].YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double; chart3.Series[1].YValueMembers = "F202"; //优化抽汽量和实际抽汽量 chart2.ChartAreas["ChartArea1"].AxisX.LabelStyle.Format = "HH:mm"; chart2.DataSource = m_dtLineData; //chart1.Series[0].LegendText = "优化抽汽量"; chart2.Series[0].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart2.Series[0].XValueMember = "ValueTime"; chart2.Series[0].YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double; chart2.Series[0].YValueMembers = "F161"; //chart1.Series[0].LegendText = "优化抽汽量"; chart2.Series[1].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart2.Series[1].XValueMember = "ValueTime"; chart2.Series[1].YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double; chart2.Series[1].YValueMembers = "F222"; timerLineBind_Tick(null, null); }
private void timerLineBind_Tick(object sender, EventArgs e) { SetBindingLabelsText(); //SetLabelsForeColor(Color.Red); //SetLabelsForeColor(Color.Lime); lblDQY.Text = "大气压力:" + CalTagValue.GetTagValueAndUnitByID("4"); lblTemp.Text = "环境温度:" + CalTagValue.GetTagValueAndUnitByID("208"); m_dtLineData = CalTagValue.GetAllData(); try { chart1.DataSource = m_dtLineData; chart1.Series[0].LegendText = "优化出水温度:" + Math.Round(double.Parse(m_dtLineData.Rows[m_dtLineData.Rows.Count - 1]["F213"].ToString()), 2) + "℃"; chart1.Series[1].LegendText = "实际出水温度:" + Math.Round(double.Parse(m_dtLineData.Rows[m_dtLineData.Rows.Count - 1]["F152"].ToString()), 2) + "℃"; chart1.DataBind(); } catch (Exception ex) { WriteLog.WriteLogs(ex.ToString()); } try { chart3.DataSource = m_dtLineData; chart3.Series[0].LegendText = "优化热负荷:" + Math.Round(double.Parse(m_dtLineData.Rows[m_dtLineData.Rows.Count - 1]["F219"].ToString()), 2) + "瓦/平方米"; chart3.Series[1].LegendText = "实际热负荷:" + Math.Round(double.Parse(m_dtLineData.Rows[m_dtLineData.Rows.Count - 1]["F202"].ToString()), 2) + "瓦/平方米"; chart3.DataBind(); } catch (Exception ex) { WriteLog.WriteLogs(ex.ToString()); } try { chart2.DataSource = m_dtLineData; chart2.Series[0].LegendText = "实际循环水量:" + Math.Round(double.Parse(m_dtLineData.Rows[m_dtLineData.Rows.Count - 1]["F161"].ToString()), 2) + "t/h"; chart2.Series[1].LegendText = "优化循环水量:" + Math.Round(double.Parse(m_dtLineData.Rows[m_dtLineData.Rows.Count - 1]["F222"].ToString()), 2) + "t/h"; chart2.DataBind(); } catch (Exception ex) { WriteLog.WriteLogs(ex.ToString()); } viewShowList = CalTagValue.GetAllTagValues().DefaultView; viewShowList.RowFilter = "isShow=1 and TagValue>0"; dataGridView1.DataSource = viewShowList; //dataGridView1.Refresh(); }