webform使用chart
作者:互联网
List<int> cuiid = new List<int>();
List<int> cuinum = new List<int>();
getdata();
Chart2.ChartAreas.Add(new ChartArea() { Name = "ca1" }); //背景框
Chart2.ChartAreas[0].Axes[0].MajorGrid.Enabled = false; //X轴上网格
Chart2.ChartAreas[0].Axes[1].MajorGrid.Enabled = false; //y轴上网格
Chart2.Series.Add(new Series()); //添加一个图表序列
Chart2.Series[0].Label = "#VALY"; //设置显示X Y的值
Chart2.Series[0].ChartArea = Chart2.ChartAreas[0].Name; //设置图表背景框ChartArea
Chart2.Series[0].ChartType = SeriesChartType.Column; //图类型(柱状图)
Chart2.Series[0].Points.DataBindXY(cuiid, cuinum); //添加数据
Chart2.Titles.Add("菜品月度销售数量图");
结果:
标签:Series,webform,Chart2,chart,Add,使用,ChartAreas,new,List 来源: https://blog.csdn.net/Ayanamilove/article/details/122529715