【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();

        }

 

版权声明:程序员胖胖胖虎阿 发表于 2023年9月4日 上午1:40。
转载请注明:【Vegas原创】ComponentArt经典使用(饼图) | 胖虎的工具箱-编程导航

相关文章

暂无评论

暂无评论...