查看文章 |
曲线图: ChartPointCollection d = new ChartPointCollection();
Chart c = new LineChart(d,Color.Blue); 柱状图: Chart c = new StackedColumnChart(); ChartPointCollection d; d = c.Data; 饼状图: ChartPointCollection data = new ChartPointCollection(); PieChart c = new PieChart(data, Color.Blue); c.Colors = new Color[] { Color.Red, Color.Blue, Color.Yellow, Color.Cyan, Color.AntiqueWhite, Color.RosyBrown }; 添加数据: data.Add(new ChartPoint("Ene", 40)); data.Add(new ChartPoint("Feb", 40)); data.Add(new ChartPoint("Mar", 30)); data.Add(new ChartPoint("Abr", 20)); data.Add(new ChartPoint("May", 10)); data.Add(new ChartPoint("Jun", 25)); 属性说明: ////绘制箭头 AdjustableArrowCap MyArrow = new AdjustableArrowCap(4, 4, true); c.Line.CustomEndCap = MyArrow; c.Line.EndCap = LineCap.Custom; ////线段颜色 c.Line.Color = Color.Red; /// c.ShowLineMarkers = true; c.LineMarker = new CircleLineMarker(2, c.Fill.Color, Color.Black); /////显示文字 c.DataLabels.Visible = true; c.DataLabels.NumberFormat = "C"; c.DataLabels.ForeColor = Color.Black; c.Fill.Color = Color.Black; ////显示边侧说明 c.Legend = "浏览次数"; WebChart1.HasChartLegend = true; ///将设置好的图像添加至图表 WebChart1.Charts.Add(c); WebChart1.RedrawChart(); |