当前位置: 首页>>代码示例>>C#>>正文


C# Chart.SaveAsImage方法代码示例

本文整理汇总了C#中Chart.SaveAsImage方法的典型用法代码示例。如果您正苦于以下问题:C# Chart.SaveAsImage方法的具体用法?C# Chart.SaveAsImage怎么用?C# Chart.SaveAsImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Chart的用法示例。


在下文中一共展示了Chart.SaveAsImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AutoCreatChartForLastDay


//.........这里部分代码省略.........
                    {
                        intOneDayStop = Convert.ToInt32(dt.Rows[0][0]);
                    }
                    else
                    {
                        intOneDayStop = 0;
                    }
                    perOneDayStop = Math.Round((double)intOneDayStop / 86400, 2);
                    #endregion
                    #region Pause Time SQL
                    strSql = "select sum(status_timespan) from lca_dt_period where line_status='Pause' and to_char(info_date,'yyyy-mm-dd hh24:mi:ss') between '" + strTemp + " 07:00:00" + "' and '" + strTempEnd + " 06:59:59" + "'";
                    dt.Clear();
                    dt = oleu.SQLQuery_DataTable(strSql);
                    if (Convert.ToString(dt.Rows[0][0]) != "")
                    {
                        intOneDayPause = Convert.ToInt32(dt.Rows[0][0]);
                    }
                    else
                    {
                        intOneDayPause = 0;
                    }
                    perOneDayPause = Math.Round((double)intOneDayPause / 86400, 2);
                    #endregion
                    #region Run Time SQL
                    strSql = "select sum(status_timespan) from lca_dt_period where line_status='Run' and to_char(info_date,'yyyy-mm-dd hh24:mi:ss') between '" + strTemp + " 07:00:00" + "' and '" + strTempEnd + " 06:59:59" + "'";
                    dt.Clear();
                    dt = oleu.SQLQuery_DataTable(strSql);
                    if (Convert.ToString(dt.Rows[0][0]) != "")
                    {
                        intOneDayRun = Convert.ToInt32(dt.Rows[0][0]);

                    }
                    else
                    {
                        intOneDayRun = 0;

                    }
                    perOneDayRun = Math.Round((double)intOneDayRun / 86400, 2);
                    #endregion
                    #region Day Shift Run Time SQL
                    strSql = "select sum(status_timespan) from lca_dt_period where date_type='Day' and line_status='Run' and to_char(info_date,'yyyy-mm-dd hh24:mi:ss') between '" + strTemp + " 07:00:00" + "' and '" + strTempEnd + " 06:59:59" + "'";
                    dt.Clear();
                    dt = oleu.SQLQuery_DataTable(strSql);
                    if (Convert.ToString(dt.Rows[0][0]) != "")
                    {
                        intDayShiftRun = Convert.ToInt32(dt.Rows[0][0]);

                    }
                    else
                    {
                        intDayShiftRun = 0;

                    }
                    perDayShiftRun = Math.Round((double)intDayShiftRun / 43200, 4);
                    #endregion
                    #region Night Shift Run Time SQL
                    strSql = "select sum(status_timespan) from lca_dt_period where date_type='Night' and line_status='Run' and to_char(info_date,'yyyy-mm-dd hh24:mi:ss') between '" + strTemp + " 07:00:00" + "' and '" + strTempEnd + " 06:59:59" + "'";
                    dt.Clear();
                    dt = oleu.SQLQuery_DataTable(strSql);
                    if (Convert.ToString(dt.Rows[0][0]) != "")
                    {
                        intNightShiftRun = Convert.ToInt32(dt.Rows[0][0]);

                    }
                    else
                    {
                        intNightShiftRun = 0;

                    }
                    perNightShiftRun = Math.Round((double)intNightShiftRun / 43200, 4);
                    #endregion
                    #region  Hourly Run Time SQL
                    if (perDayShiftRun != (double)0)
                    {
                        chDailyReport1.Series["Day"].Points.AddXY(strTemp, perDayShiftRun * 100);
                    }
                    if (perNightShiftRun != (double)0)
                    {
                        chDailyReport1.Series["Night"].Points.AddXY(strTemp, perNightShiftRun * 100);
                    }
                    dtTemp = dtTemp.AddDays(1);
                }

            }
            else
            { throw new Exception("End Date can't earlier than From Date!"); }
            #endregion
            */
            #endregion
            oleu.destroy();
            #region Save Log
            String chartPath = @"D:\tomcat\webapps\HSAPE\store\" + fromDate.ToString("yyyyMMdd") + "_" + endDate.AddDays(-1).ToString("yyyyMMdd") + "Daily Chart.Gif";
            chDailyReport1.SaveAsImage(chartPath, System.Drawing.Imaging.ImageFormat.Gif);
            String fileName = "DailyData " + fromDate.ToString("yyyyMMdd") + "-" + endDate.ToString("yyyyMMdd");
            DataTable dtNew = new DataTable();
            dtNew = FormLCADowntTime.Instance.WriteDataGridToTable(dgvDailyData, "HourlyData");
            dataDriver.WriteDataToFile(dtNew, fileName);

            #endregion
        }
开发者ID:tianya857727,项目名称:LCA,代码行数:101,代码来源:FormLCADailyChart.cs

示例2: btCreateChart_Click


//.........这里部分代码省略.........
                    dt = oleu.SQLQuery_DataTable(strSql);
                    if (Convert.ToString(dt.Rows[0][0]) != "")
                    {
                        intOneDayPause = Convert.ToInt32(dt.Rows[0][0]);
                    }
                    else
                    {
                        intOneDayPause = 0;
                    }
                    perOneDayPause = Math.Round((double)intOneDayPause / 86400, 2);
                    #endregion
                    #region Run Time SQL
                    strSql = "select sum(status_timespan) from lca_dt_period where line_status='Run' and to_char(info_date,'yyyy-mm-dd hh24:mi:ss') between '" + strTemp + " 07:00:00" + "' and '" + strTempEnd + " 06:59:59" + "'";
                    dt.Clear();
                    dt = oleu.SQLQuery_DataTable(strSql);
                    if (Convert.ToString(dt.Rows[0][0]) != "")
                    {
                        intOneDayRun = Convert.ToInt32(dt.Rows[0][0]);

                    }
                    else
                    {
                        intOneDayRun = 0;

                    }
                    perOneDayRun = Math.Round((double)intOneDayRun / 86400, 2);
                    #endregion
                    #region Day Shift Run Time SQL
                    strSql = "select sum(status_timespan) from lca_dt_period where date_type='Day' and line_status='Run' and to_char(info_date,'yyyy-mm-dd hh24:mi:ss') between '" + strTemp + " 07:00:00" + "' and '" + strTempEnd + " 06:59:59" + "'";
                    dt.Clear();
                    dt = oleu.SQLQuery_DataTable(strSql);
                    if (Convert.ToString(dt.Rows[0][0]) != "")
                    {
                        intDayShiftRun = Convert.ToInt32(dt.Rows[0][0]);

                    }
                    else
                    {
                        intDayShiftRun = 0;

                    }
                    perDayShiftRun = Math.Round((double)intDayShiftRun / 43200, 4);
                    #endregion
                    #region Night Shift Run Time SQL
                    strSql = "select sum(status_timespan) from lca_dt_period where date_type='Night' and line_status='Run' and to_char(info_date,'yyyy-mm-dd hh24:mi:ss') between '" + strTemp + " 07:00:00" + "' and '" + strTempEnd + " 06:59:59" + "'";
                    dt.Clear();
                    dt = oleu.SQLQuery_DataTable(strSql);
                    if (Convert.ToString(dt.Rows[0][0]) != "")
                    {
                        intNightShiftRun = Convert.ToInt32(dt.Rows[0][0]);

                    }
                    else
                    {
                        intNightShiftRun = 0;

                    }
                    perNightShiftRun = Math.Round((double)intNightShiftRun / 43200, 4);
                    #endregion
                    //chDailyReport1.Series["STOP"].Points.AddXY(strTemp, perOneDayStop);
                    //chDailyReport1.Series["PAUSE"].Points.AddXY(strTemp, intOneDayPause);
                    //chDailyReport1.Series["RUN"].Points.AddXY(strTemp, perOneDayRun);
                    if (perDayShiftRun != (double)0)
                    {
                        chDailyReport1.Series["Day"].Points.AddXY(strTemp, perDayShiftRun * 100);
                    }
                    if(perNightShiftRun!=(double)0)
                    {
                        chDailyReport1.Series["Night"].Points.AddXY(strTemp, perNightShiftRun*100);
                    }
                    dtTemp = dtTemp.AddDays(1);
                }

            }
            else
            { throw new Exception("End Date can't earlier than From Date!"); }
            #endregion

            oleu.destroy();
            #region Save Log
            String chartPath = @"C:\LCA Data\" + dtFromDate.ToString("yyyyMMdd") + "_" + dtEndDate.AddDays(-1).ToString("yyyyMMdd") + "Daily Chart.Gif";
            chDailyReport1.SaveAsImage(chartPath, System.Drawing.Imaging.ImageFormat.Gif);
            String fileName = "DailyData " + dtFromDate.ToString("yyyyMMdd") + "-" + dtEndDate.ToString("yyyyMMdd");
            DataTable dtNew = new DataTable();
            dtNew=FormLCADowntTime.Instance.WriteDataGridToTable(dgvDailyData, "HourlyData");
            dataDriver.WriteDataToFile(dtNew, fileName);
            #endregion
            #region Send Email
            //SmtpClient _smtp = new SmtpClient("mailhost.woo.sing.seagate.com");
            //MailMessage message = new MailMessage("[email protected]", "[email protected]");
            //message.Body = "This is a test e-mail message sent by an application. ";
            //string someArrows = new string(new char[] { '\u2190', '\u2191', '\u2192', '\u2193' });
            //message.Body += Environment.NewLine + someArrows;
            //message.BodyEncoding = System.Text.Encoding.UTF8;
            //message.Subject = "test message 1" + someArrows;
            //message.SubjectEncoding = System.Text.Encoding.UTF8;
            //_smtp.Send(message);

            #endregion
        }
开发者ID:tianya857727,项目名称:LCA,代码行数:101,代码来源:FormLCADailyChart.cs


注:本文中的Chart.SaveAsImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。