【Vegas原创】ComponentArt经典使用(饼图)

void chartbind(string strDept)
        {
            DataSet ds 
= new DataSet();
            
for (int i = 1; i <= 3; i++)
            {
                
//连接数据库,并插入数据
                SqlParameter[] sqlParam = new SqlParameter[4];

                sqlParam[
0= new SqlParameter("@i", SqlDbType.Int, 20, ParameterDirection.Input, false00"@i", DataRowVersion.Default, i);
                sqlParam[
1= new SqlParameter("@j", SqlDbType.NVarChar, 20, ParameterDirection.Input, false00"@j", DataRowVersion.Default, strDept);
                sqlParam[
2= new SqlParameter("@year", SqlDbType.NVarChar, 20, ParameterDirection.Input, false00"@year", DataRowVersion.Default, drpYear.SelectedValue.Trim());
                sqlParam[
3= new SqlParameter("@pa", SqlDbType.NVarChar, 20, ParameterDirection.Input, false00"@pa", DataRowVersion.Default, drpPa.SelectedValue.Trim());
    
                
try
                {
                    
if (i == 1)
                    {
                        DataSet ds1 
= db.GetDataSet("pms_potential_chart", sqlParam);
                        ds.Merge(ds1);
                    }
                    
else if (i == 2)
                    {
                        DataSet ds2 
= db.GetDataSet("pms_potential_chart", sqlParam);
                        ds.Merge(ds2);
                    }
                    
else if (i == 3)
                    {
                        DataSet ds3 
= db.GetDataSet("pms_potential_chart", sqlParam);
                        ds.Merge(ds3);
                    }
                }
                
catch
                {
                    
return;
                }
            }
            
double[] y = new double[10];
            
string[] x = new string[10];

            
for(int i=0;i<ds.Tables[0].Rows.Count;i++)
            {
                x[i]
=ds.Tables[0].Rows[i][0].ToString();
                y[i]
=double.Parse(ds.Tables[0].Rows[i][1].ToString());
            }
            targetChart.DataSource 
= ds.Tables[0].DefaultView;
            targetChart.Series[
"S0"].Parameters["x"= x;
            targetChart.Series[
"S0"].Parameters["y"= y;
            targetChart.DataBind();
            targetChart.Draw();

        }

 

posted @ 2007-10-17 10:29  李济宏(Amadeus)  阅读(169)  评论(0编辑  收藏  举报