ASP.net中使用Chart做统计图。


三种图:饼图,柱形图,线形图


http://www.jq-school.com/Show.aspx?id=311


http://blog.csdn.net/liudongyue1987/article/details/4674530



贴出饼图的数据绑定:

 //默认----按照统计
            string querySql = "SELECT SUBSTR(adddate,1,10) as adddate,count(*) as counts  FROM `user_infor` where adddate>='" + this.StartDate.Text + " 00:00:00' and adddate<='" + this.EndDate.Text + " 23:59:59' group by  SUBSTR(adddate,1,10);";
            DataSet analyseDs = MySQLHelper.GetDataSet(out errorMsg, querySql);

            List<string> list1 = new List<string>();
            List<int> list2 = new List<int>();

            for (int i = 0; i < analyseDs.Tables[0].Rows.Count; i++)
            {
                list1.Add(analyseDs.Tables[0].Rows[i]["adddate"].ToString());
                list2.Add(Convert.ToInt32(analyseDs.Tables[0].Rows[i]["counts"]));
            }
            Series series = Chart2.Series.Add("My Series");
            series.ToolTip = "#VALX: #VALY 人";
            series.LegendToolTip = "#PERCENT";
            series.PostBackValue = "#INDEX";
            series.LegendPostBackValue = "#INDEX";
            series.LegendText = "#VALX";
            series.Label = "#VALX (#PERCENT)";
            series.Points.DataBindXY(list1, list2);
            Chart2.Series[0]["PieLabelStyle"] = "Outside";//饼图说明显示方式(外面)
            series.ChartType = SeriesChartType.Pie; //图标的显示风格(饼图)
            series.ShadowOffset = 2;
            series.BorderColor = Color.DarkGray;
            Chart2.Width = 880;
            Chart2.Height = 400;

            Title tPie = new Title("用户注册统计饼状图");
            this.Chart2.Titles.Add(tPie);


©️2020 CSDN 皮肤主题: 大白 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值