标签:
public partial class WebForm4 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string sql = string.Format("select * from a_Stu"); CreatePie(MyService.SqlHelper.ExecuteDataSet(CommandType.Text, sql)); } public void CreatePie(DataSet ds) { Series Series1 = new Series("OnePie", ViewType.Pie); //面板添加一个Series 类型Pie WebControl.Series.Add(Series1); SeriesPoint [] sp=new SeriesPoint[ds.Tables[0].Rows.Count]; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { sp[i] = new SeriesPoint(ds.Tables[0].Rows[i]["name"].ToString(), ds.Tables[0].Rows[i]["age"].ToString()); } Series1.Points.AddRange(sp); //设置百分比 Series1.Label.PointOptions.ValueNumericOptions.Format = NumericFormat.Percent; //设置显示名称及数据 Series1.LegendPointOptions.PointView = PointView.ArgumentAndValues; //显示饼图数据位置 ((PieSeriesLabel)Series1.Label).Position = PieSeriesLabelPosition.TwoColumns; } }
标签:
原文地址:http://www.cnblogs.com/xumingyang/p/4600443.html