柱状图
1 this.C1BarChart1.Axis.X.Text = "月份"; 2 //柱状图y轴名称 3 this.C1BarChart1.Axis.Y.Text = "总产量(单位/榀)"; 4 //柱状图名称 5 this.C1BarChart1.Header.Text = a.ToString()+"年生产计划统计"; 6 //柱状图图例名称 7 this.C1BarChart1.Legend.Text = "分区:"; 8 //设置柱状图是否显示节点属性值 9 this.C1BarChart1.ShowChartLabels = true; 10 //设置柱状图加载时长 11 this.C1BarChart1.Animation.Duration = 1500; 12 //设置柱状图的柱体是否水平显示 13 this.C1BarChart1.Horizontal = false; 14 15 //设置柱状图x轴属性值 16 var valuesX = new List<String>() { "一月", "二月", "三月", "四月", "五月" ,"六月","七月","八月","九月","十月","十一月","十二月"}; 17 //设置柱体对应值 18 // var valuesEast = new List<Double?>() { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; 19 var valuesWest = new List<Double?>() { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; 20 var valuesEast1 = new List<Double?>(){0,0,0,0,0,0,0,0,0,0,0,0}; 21 22 //创建一个柱体 23 var series = new BarChartSeries(); 24 25 //在柱状图上添加柱体 26 this.C1BarChart1.SeriesList.Add(series); 27 //将柱体与柱状图x轴属性对应 28 series.Data.X.AddRange(valuesX.ToArray<String>()); 29 //将柱体与柱状图y轴属性对应 30 series.Data.Y.AddRange(valuesEast1.ToArray<double?>()); 31 //设置柱体属性名 32 series.Label = "计划总量"; 33 //不懂有什么作用 34 series.LegendEntry = true; 35 //定义一个系列的柱体颜色 36 ChartStyle cs = new ChartStyle(); 37 cs.Fill.Color = Color.FromName("#368ee0"); 38 //cs.Fill.ColorBegin = Color.FromName("#000000"); 39 //cs.Fill.ColorEnd = Color.FromName("#aa5588"); 40 this.C1BarChart1.SeriesStyles.Add(cs); 41 42 //定义柱体悬停的颜色 43 ChartStyle cs1 = new ChartStyle(); 44 cs1.Fill.Color = Color.FromName("#1A66D1"); 45 this.C1BarChart1.SeriesHoverStyles.Add(cs1);