コード例 #1
0
ファイル: LJMLR.cs プロジェクト: zzh-git/KS
 private void LJMLR_Load(object sender, EventArgs e)
 {
     chart1.Series[0].XValueType    = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double;
     chart1.Series[0].XValueMember  = "HourOfYear";
     chart1.Series[0].YValueType    = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double;
     chart1.Series[0].YValueMembers = F14;
     chart1.ChartAreas[0].AxisY.LabelStyle.Format = "0.##";
     timerChartBind.Interval = 1000;
     timerChartBind.Enabled  = true;
     dtChart = TagLJValue.GetTotalDataWithNewTable(UnitNO);
     if (dtChart.Rows.Count > 0)
     {
         dateTimePickerBegin1.Value = DateTime.Parse(dtChart.Rows[0]["ValueTime"].ToString());
         dateTimePickerBegin2.Value = dateTimePickerBegin1.Value;
     }
     timerChartBind_Tick(null, null);
 }
コード例 #2
0
ファイル: LJSZMX.cs プロジェクト: zzh-git/KS
        private void LJSZMX_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < sChartNames.Length; i++)
            {
                chartTemp = (Chart)pnlData.Controls.Find(sChartNames[i], true)[0];

                chartTemp.Series[0].XValueType    = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double;
                chartTemp.Series[0].XValueMember  = "HourOfYear";
                chartTemp.Series[0].YValueType    = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double;
                chartTemp.Series[0].YValueMembers = sYValueMembers[i];
                chartTemp.ChartAreas[0].AxisY.LabelStyle.Format = "0.00";
                chartTemp.ChartAreas[0].AxisX.TitleAlignment    = StringAlignment.Far;
            }

            timerChartBind.Interval = 1000;
            timerChartBind.Enabled  = true;
            dtChart = TagLJValue.GetTotalDataWithNewTable(UnitNO); //这些注释都要改过来 ZZH
            if (dtChart.Rows.Count > 0)
            {
                dateTimePickerBegin1.Value = DateTime.Parse(dtChart.Rows[0]["ValueTime"].ToString());
                dateTimePickerBegin2.Value = dateTimePickerBegin1.Value;
            }
            timerChartBind_Tick(null, null);
        }
コード例 #3
0
ファイル: LJSZMX.cs プロジェクト: zzh-git/KS
        private void timerChartBind_Tick(object sender, EventArgs e)
        {
            DataRow row;

            if (lTotalCount < TagLJValue.GetTotalCount(UnitNO))
            {
                lTotalCount = TagLJValue.GetTotalCount(UnitNO);
                dtChart.Dispose();
                dtChart = null;
                dtChart = TagLJValue.GetTotalDataWithNewTable(UnitNO);
                if (dtChart.Rows.Count > 0)
                {
                    dHourOfYear = double.Parse(dtChart.Rows[dtChart.Rows.Count - 1]["HourOfYear"].ToString());
                    if (rdoTotalHours.Checked == true)
                    {
                        dXMin = double.Parse(dtChart.Rows[0]["HourOfYear"].ToString());

                        for (int i = 0; i < sChartNames.Length; i++)
                        {
                            chartTemp = (Chart)pnlData.Controls.Find(sChartNames[i], true)[0];
                            chartTemp.Series[0].XValueMember = "HourOfYear";
                            chartTemp.Series[0].XValueType   = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double;
                            chartTemp.ChartAreas[0].AxisX.MajorGrid.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Auto;
                            chartTemp.ChartAreas[0].AxisX.MajorGrid.Interval     = (int)(dHourOfYear - dXMin) / bHourOfYearGridCount;
                            chartTemp.ChartAreas[0].AxisX.IntervalType           = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Auto;
                            chartTemp.ChartAreas[0].AxisX.Interval          = (int)(dHourOfYear - dXMin) / bHourOfYearGridCount;
                            chartTemp.ChartAreas[0].AxisX.Title             = "供热期累计小时数(h)";
                            chartTemp.ChartAreas[0].AxisX.LabelStyle.Format = "0";
                            //chartTemp.ChartAreas[0].AxisY.Title = string.Format(sYValueLabels[i], Math.Round(double.Parse(dtChart.Rows[dtChart.Rows.Count - 1][sYValueMembers[i]].ToString()), 2));
                            chartTemp.Series[0].LegendText = string.Format(sYValueLabels[i], Math.Round(double.Parse(dtChart.Rows[dtChart.Rows.Count - 1][sYValueMembers[i]].ToString()), 2));
                        }
                    }
                    else
                    {
                        DateTime timeBegin = (DateTime)dtChart.Rows[0]["ValueTime"];
                        DateTime timeEnd   = (DateTime)dtChart.Rows[dtChart.Rows.Count - 1]["ValueTime"];

                        for (int i = 0; i < sChartNames.Length; i++)
                        {
                            chartTemp = (Chart)pnlData.Controls.Find(sChartNames[i], true)[0];
                            chartTemp.Series[0].XValueMember = "ValueTime";
                            chartTemp.Series[0].XValueType   = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime;
                            chartTemp.ChartAreas[0].AxisX.MajorGrid.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Hours;
                            chartTemp.ChartAreas[0].AxisX.MajorGrid.Interval     = (int)(timeEnd - timeBegin).TotalHours / bDateTimeGridCount;
                            chartTemp.ChartAreas[0].AxisX.IntervalType           = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Hours;
                            chartTemp.ChartAreas[0].AxisX.Interval          = (int)(timeEnd - timeBegin).TotalHours / bDateTimeGridCount;
                            chartTemp.ChartAreas[0].AxisX.Title             = "日期时间(t)";
                            chartTemp.ChartAreas[0].AxisX.LabelStyle.Format = "yyyy-MM-dd HH:mm";
                            //chartTemp.ChartAreas[0].AxisY.Title = string.Format(sYValueLabels[i], Math.Round(double.Parse(dtChart.Rows[dtChart.Rows.Count - 1][sYValueMembers[i]].ToString()), 2));
                            chartTemp.Series[0].LegendText = string.Format(sYValueLabels[i], Math.Round(double.Parse(dtChart.Rows[dtChart.Rows.Count - 1][sYValueMembers[i]].ToString()), 2));
                        }
                    }
                    row = dtChart.NewRow();
                    row["ValueTime"]  = DateTime.Parse(dtChart.Rows[dtChart.Rows.Count - 1]["ValueTime"].ToString()).AddSeconds(1);
                    row["HourOfYear"] = dHourOfYear + 0.0001;
                    dtChart.Rows.Add(row);
                }
            }
            row = dtChart.NewRow();
            row["ValueTime"]  = DateTime.Now;
            dHourOfYear      += timerChartBind.Interval / 1000 / 3600d;
            row["HourOfYear"] = dHourOfYear;
            MinMaxValue mmv = TagLJValue.GetMinMaxValue(F3225, UnitNO);

            //chartRLLJZC.ChartAreas[0].AxisX.Title = "供热期累计小时数:" + Math.Round(dHourOfYear, 4).ToString("0.0000")
            //    + "                累计开始时间:" + mmv.BeginDateString + "\n燃料支出最小值:"
            //    + Math.Round(mmv.MinValue / 10000, 4).ToString("0.0000") + "        燃料支出最小值时间:" + mmv.MinDateString
            //    + "\n燃料支出最大值:" + Math.Round(mmv.MaxValue / 10000, 4).ToString("0.0000") + "        燃料支出最大值时间:"
            //    + mmv.MaxDateString + "\n燃料支出平均值:" + TagLJValue.GetTotalDataAvg(F10, UnitNO) + "万元/小时";
            lblMsg.Text = "供热期累计小时数:" + Math.Round(dHourOfYear, 4).ToString("0.0000") + "        累计开始时间:" + mmv.BeginDateString + "        双击每个图可以放大显示。";
            dtChart.Rows.Add(row);

            foreach (string sChartName in sChartNames)
            {
                chartTemp            = (Chart)pnlData.Controls.Find(sChartName, true)[0];
                chartTemp.DataSource = dtChart;
                chartTemp.DataBind();
            }
        }
コード例 #4
0
        private void timerChartBind_Tick(object sender, EventArgs e)
        {
            DataRow row;

            if (lTotalCount < TagLJValue.GetTotalCount(UnitNO))
            {
                lTotalCount = TagLJValue.GetTotalCount(UnitNO);
                dtChart.Dispose();
                dtChart = null;
                dtChart = TagLJValue.GetTotalDataWithNewTable(UnitNO);
                if (dtChart.Rows.Count > 0)
                {
                    dHourOfYear = double.Parse(dtChart.Rows[dtChart.Rows.Count - 1]["HourOfYear"].ToString());
                    if (rdoTotalHours.Checked == true)
                    {
                        chart1.Series[0].XValueMember = "HourOfYear";
                        chart1.Series[0].XValueType   = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double;
                        dXMin = double.Parse(dtChart.Rows[0]["HourOfYear"].ToString());
                        chart1.ChartAreas[0].AxisX.MajorGrid.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Auto;
                        chart1.ChartAreas[0].AxisX.MajorGrid.Interval     = (dHourOfYear - dXMin) / 10;
                        chart1.ChartAreas[0].AxisX.IntervalType           = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Auto;
                        chart1.ChartAreas[0].AxisX.Interval          = (dHourOfYear - dXMin) / 10;
                        chart1.ChartAreas[0].AxisX.Title             = "供热期累计小时数";
                        chart1.ChartAreas[0].AxisX.LabelStyle.Format = "0";
                    }
                    else
                    {
                        DateTime timeBegin = (DateTime)dtChart.Rows[0]["ValueTime"];
                        DateTime timeEnd   = (DateTime)dtChart.Rows[dtChart.Rows.Count - 1]["ValueTime"];
                        chart1.Series[0].XValueMember = "ValueTime";
                        chart1.Series[0].XValueType   = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime;
                        chart1.ChartAreas[0].AxisX.MajorGrid.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Hours;
                        chart1.ChartAreas[0].AxisX.MajorGrid.Interval     = (timeEnd - timeBegin).TotalHours / 6;
                        chart1.ChartAreas[0].AxisX.IntervalType           = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Hours;
                        chart1.ChartAreas[0].AxisX.Interval          = (timeEnd - timeBegin).TotalHours / 6;
                        chart1.ChartAreas[0].AxisX.Title             = "时间";
                        chart1.ChartAreas[0].AxisX.LabelStyle.Format = "yyyy-MM-dd HH:mm";
                    }
                    chart1.ChartAreas[0].AxisY.Title = "累计节标煤量:" + Math.Round(double.Parse(dtChart.Rows[dtChart.Rows.Count - 1][F18].ToString()), 2) + "吨";
                    row = dtChart.NewRow();
                    row["ValueTime"]  = DateTime.Parse(dtChart.Rows[dtChart.Rows.Count - 1]["ValueTime"].ToString()).AddSeconds(1);
                    row["HourOfYear"] = dHourOfYear + 0.0001;
                    dtChart.Rows.Add(row);
                }
            }
            row = dtChart.NewRow();
            row["ValueTime"]  = DateTime.Now;
            dHourOfYear      += timerChartBind.Interval / 1000 / 3600d;
            row["HourOfYear"] = dHourOfYear;
            MinMaxValue mmv = TagLJValue.GetMinMaxValue(F3197, UnitNO);

            if (UnitNO == 5)
            {
                chart1.ChartAreas[0].AxisX.Title = "供热期累计小时数:" + Math.Round(dHourOfYear, 4).ToString("0.0000")
                                                   + "                累计开始时间:" + mmv.BeginDateString + "\n节标煤量最小值:"
                                                   + mmv.MinValue.ToString("0.0000") + "        节标煤量最小值时间:" + mmv.MinDateString
                                                   + "\n节标煤量最大值:" + mmv.MaxValue.ToString("0.0000") + "        节标煤量最大值时间:"
                                                   + mmv.MaxDateString + "\n节标煤量平均值:" + TagLJValue.GetTotalDataAvg(F18, UnitNO) + "吨/小时        累计节省费用:"
                                                   + Math.Round(double.Parse(GlobalVariables.dtChartTotalDatasFive.Rows[GlobalVariables.dtChartTotalDatasFive.Rows.Count - 1][F19].ToString()), 2) + "万元";
            }
            else if (UnitNO == 6)
            {
                chart1.ChartAreas[0].AxisX.Title = "供热期累计小时数:" + Math.Round(dHourOfYear, 4).ToString("0.0000")
                                                   + "                累计开始时间:" + mmv.BeginDateString + "\n节标煤量最小值:"
                                                   + mmv.MinValue.ToString("0.0000") + "        节标煤量最小值时间:" + mmv.MinDateString
                                                   + "\n节标煤量最大值:" + mmv.MaxValue.ToString("0.0000") + "        节标煤量最大值时间:"
                                                   + mmv.MaxDateString + "\n节标煤量平均值:" + TagLJValue.GetTotalDataAvg(F18, UnitNO) + "吨/小时        累计节省费用:"
                                                   + Math.Round(double.Parse(GlobalVariables.dtChartTotalDatasSix.Rows[GlobalVariables.dtChartTotalDatasSix.Rows.Count - 1][F19].ToString()), 2) + "万元";
            }
            chart1.ChartAreas[0].AxisX.TitleAlignment = StringAlignment.Near;
            dtChart.Rows.Add(row);
            chart1.DataSource = dtChart;
            chart1.DataBind();
        }
コード例 #5
0
ファイル: GDLJSR.cs プロジェクト: zzh-git/KS
 private void timerChartBind_Tick(object sender, EventArgs e)
 {
     try
     {
         DataRow row;
         if (lTotalCount < TagLJValue.GetTotalCount(UnitNO))
         {
             lTotalCount = TagLJValue.GetTotalCount(UnitNO);
             dtChart.Dispose();
             dtChart = null;
             dtChart = TagLJValue.GetTotalDataWithNewTable(UnitNO);
             if (dtChart.Rows.Count > 0)
             {
                 dHourOfYear = double.Parse(dtChart.Rows[dtChart.Rows.Count - 1]["HourOfYear"].ToString());
                 if (rdoTotalHours.Checked == true)
                 {
                     chart1.Series[0].XValueMember = "HourOfYear";
                     chart1.Series[0].XValueType   = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double;
                     dXMin = double.Parse(dtChart.Rows[0]["HourOfYear"].ToString());
                     chart1.ChartAreas[0].AxisX.MajorGrid.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Auto;
                     chart1.ChartAreas[0].AxisX.MajorGrid.Interval     = (int)(dHourOfYear - dXMin) / 10;
                     chart1.ChartAreas[0].AxisX.IntervalType           = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Auto;
                     chart1.ChartAreas[0].AxisX.Interval          = (int)(dHourOfYear - dXMin) / 10;
                     chart1.ChartAreas[0].AxisX.Title             = "供热期累计小时数";
                     chart1.ChartAreas[0].AxisX.LabelStyle.Format = "0";
                 }
                 else
                 {
                     DateTime timeBegin = (DateTime)dtChart.Rows[0]["ValueTime"];
                     DateTime timeEnd   = (DateTime)dtChart.Rows[dtChart.Rows.Count - 1]["ValueTime"];
                     chart1.Series[0].XValueMember = "ValueTime";
                     chart1.Series[0].XValueType   = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime;
                     chart1.ChartAreas[0].AxisX.MajorGrid.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Hours;
                     chart1.ChartAreas[0].AxisX.MajorGrid.Interval     = (int)(timeEnd - timeBegin).TotalHours / 6;
                     chart1.ChartAreas[0].AxisX.IntervalType           = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Hours;
                     chart1.ChartAreas[0].AxisX.Interval          = (int)(timeEnd - timeBegin).TotalHours / 6;
                     chart1.ChartAreas[0].AxisX.Title             = "时间";
                     chart1.ChartAreas[0].AxisX.LabelStyle.Format = "yyyy-MM-dd HH:mm";
                 }
                 chart1.ChartAreas[0].AxisY.Title = "供电累计收入:" + Math.Round(double.Parse(dtChart.Rows[dtChart.Rows.Count - 1][F6].ToString()), 2) + "(万元)";
                 row = dtChart.NewRow();
                 row["ValueTime"]  = DateTime.Parse(dtChart.Rows[dtChart.Rows.Count - 1]["ValueTime"].ToString()).AddSeconds(1);
                 row["HourOfYear"] = dHourOfYear + 0.0001;
                 dtChart.Rows.Add(row);
             }
         }
         row = dtChart.NewRow();
         row["ValueTime"]  = DateTime.Now;
         dHourOfYear      += timerChartBind.Interval / 1000 / 3600d;
         row["HourOfYear"] = dHourOfYear;
         MinMaxValue mmv = TagLJValue.GetMinMaxValue(F3226, UnitNO);
         chart1.ChartAreas[0].AxisX.Title = "供热期累计小时数:" + Math.Round(dHourOfYear, 4).ToString("0.0000")
                                            + "                累计开始时间:" + mmv.BeginDateString + "\n供电收入最小值:"
                                            + Math.Round(mmv.MinValue / 10000, 4).ToString("0.0000") + "        供电收入最小值时间:" + mmv.MinDateString
                                            + "\n供电收入最大值:" + Math.Round(mmv.MaxValue / 10000, 4).ToString("0.0000") + "        供电收入最大值时间:"
                                            + mmv.MaxDateString + "\n供电收入平均值:" + TagLJValue.GetTotalDataAvg(F6, UnitNO) + "万元/小时";
         chart1.ChartAreas[0].AxisX.TitleAlignment = StringAlignment.Near;
         dtChart.Rows.Add(row);
         chart1.DataSource = dtChart;
         chart1.DataBind();
         WriteLog.WriteLogs("timerChartBind:" + timerChartBind.Enabled);
     }
     catch (Exception ex)
     { WriteLog.WriteLogs(ex.ToString()); }
 }