コード例 #1
0
    public void GenerateChart(string part, string Tablename, string fromdate, string todate, string shift, string mchn, string unit, string cell, string operation, string Dimension)
    {
        DBServer db = new DBServer();
        DataSet  ds = new DataSet();

        ds = db.Viewdimension(part, Tablename, fromdate, todate, shift, mchn, unit, cell, operation, Dimension);
        if (ds != null)
        {
            QC_Chart.DataSource = ds.Tables[0];
            QC_Chart.DataBind();
            int row = 0;
            if (ds.Tables[0].Rows.Count > 0)
            {
                string[]  x = new string[ds.Tables[0].Rows.Count];
                decimal[] y = new decimal[ds.Tables[0].Rows.Count];
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    row += 1;
                    x[i] = Convert.ToString(row);
                    y[i] = Convert.ToDecimal(ds.Tables[0].Rows[i][4]);
                    QC_Chart.Series[0].Points.AddY(Convert.ToDecimal(ds.Tables[0].Rows[i][4]));
                }
                QC_Chart.Series["Series1"].Points.DataBindXY(x, y);
                QC_Chart.Series["Series1"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Line;
                QC_Chart.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = false;
                QC_Chart.Series["Series3"].YValueMembers = ds.Tables[0].Columns[5].ColumnName;
                QC_Chart.Series["Series4"].YValueMembers = ds.Tables[0].Columns[6].ColumnName;
                //QC_Chart.Series["Series5"].YValueMembers = "Ranget";
                //QC_Chart.Series["Series6"].YValueMembers = ds.Tables[0].Columns[9].ColumnName;
                //QC_Chart.Series["Series7"].YValueMembers = ds.Tables[0].Columns[10].ColumnName;
                //QC_Chart.Series["Series8"].YValueMembers = ds.Tables[0].Columns[7].ColumnName;
                //QC_Chart.Series["Series9"].YValueMembers = ds.Tables[0].Columns[8].ColumnName;
                sp_usl.InnerText = ds.Tables[0].Rows[0][5].ToString();
                sp_lsl.InnerText = ds.Tables[0].Rows[0][6].ToString();
                QC_Chart.Series["Series1"].EmptyPointStyle.Color          = System.Drawing.Color.Black;
                QC_Chart.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;
                QC_Chart.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false;
                if (ds.Tables[0].Rows[0][3].ToString() == "" || ds.Tables[0].Rows[0][2] == null)
                {
                    sp_CP.InnerText = "0.00";
                }
                else
                {
                    sp_CP.InnerText = ds.Tables[0].Rows[0][3].ToString();
                }
                if (ds.Tables[0].Rows[0][3].ToString() == "" || ds.Tables[0].Rows[0][3] == null)
                {
                    sp_CPK.InnerText = "0.00";
                }
                else
                {
                    sp_CPK.InnerText = ds.Tables[0].Rows[0][3].ToString();
                }
                QC_Chart.ChartAreas["ChartArea1"].AxisY.Maximum  = Convert.ToDouble(ds.Tables[0].Rows[0][5].ToString());
                QC_Chart.ChartAreas["ChartArea1"].AxisY.Minimum  = Convert.ToDouble(ds.Tables[0].Rows[0][6].ToString());
                QC_Chart.ChartAreas["ChartArea1"].AxisY.Interval = 00.002;
                div_chart.Visible = true;
            }
            else
            {
                div_chart.Visible = false;
            }
        }
    }