asp.net Chart 饼状图
DataSet ds = DbHelperOleDb.Query(sbSql.ToString());
DataTable dt = ds.Tables[0];
string[] agencyname = new string[6];
double[] sumshares = new double[6];
sumshares[5] = 0;
for (int i = 0; i < dt.Rows.Count; i++)
{
if (i < 5)
{
agencyname[i] = dt.Rows[i]["fund_Name"].ToString();
sumshares[i] = double.Parse(dt.Rows[i]["total_share"].ToString());
}
else
{
agencyname[5] = "其他";
sumshares[5] += double.Parse(dt.Rows[i]["total_share"].ToString());
}
}
sumshares[5] = Math.Ceiling(sumshares[5]);
Chart1.Series["Series1"].Points.DataBindXY(agencyname, sumshares);
Chart1.Series["Series1"].ChartType = SeriesChartType.Pie;
//参数是否在图类显示(Inside内,Outside 外)
Chart1.Series["Series1"]["PieLabelStyle"] = "Inside";
Chart1.Series["Series1"].LegendText = "#VALX #VAL 万";