现在的位置: 首页 > 综合 > 正文

WebChart 部分属性说明

2012年01月04日 ⁄ 综合 ⁄ 共 1304字 ⁄ 字号 评论关闭
最近弄了两天WebChart,感觉功能还不错,弄清了部分功能,先记下来,以后再慢慢完善,希望各位同行熟悉的都帮忙完善一下,大家共同整理出一个比较好的WebChart的属性说明:
  
 

曲线图:

    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();

抱歉!评论已关闭.