mschart 饼图

来源:互联网 发布:mac设置iphone铃声 编辑:程序博客网 时间:2024/04/30 23:52

大家对照线线的样式

前台

<asp:Chart ID="Chart6" BorderlineColor="Green" BorderlineDashStyle="Solid" BorderSkin-BorderColor="Red" BackGradientStyle="TopBottom" BorderlineWidth="1"
        runat="server" Palette="None"
        PaletteCustomColors="192, 192, 255; Silver"  Height="270px">
       <legends>
        <asp:Legend BorderColor="yellow" BorderDashStyle="Solid" BorderWidth="2"    Docking="Bottom" TitleAlignment="Near" Alignment="Center"  TitleFont="Trebuchet MS, 14pt"  Font="Trebuchet MS, 14pt" Name="Default" LegendStyle="Column"></asp:Legend>
       </legends>
       <Series>
            <asp:Series Name="Default" BorderColor="blue"  BorderWidth="1"  ChartType="Pie" BackHatchStyle="Percent20">
            </asp:Series>
        </Series>
  <ChartAreas>
            <asp:ChartArea   BorderDashStyle="Solid" Name="ChartArea1" BorderColor="black"  BorderWidth="2">
            </asp:ChartArea>
        </ChartAreas>
        <BorderSkin  BorderColor="red" BorderDashStyle="Solid" BorderWidth="2" />
    </asp:Chart>

后台

//百分号显示 

Chart6.Series["Default"].Label = "#PERCENT{P}";
            Chart6.Legends["Default"].Title = "工程总造价:  " + "456";
            double[] yValues1 = { 40, 50 };
            string[] xValues1 = { "已完成", "未完成" };
            Chart6.Series["Default"].Points.DataBindXY(xValues1, yValues1);
            foreach (DataPoint point in Chart6.Series["Default"].Points)
            {
                point.LegendText =point.AxisLabel+"   "+Chart6.Series["Default"].Label ;
            }

 //柱图绑定

//数据的绑定还有这个
            Chart2.DataSource = ds.Tables[0];
            Chart2.Series[Finished].YValueMembers = "TotalMoney";//绑定的列名
            Chart2.Series[Unfinished].XValueMember = "score";

原创粉丝点击