编程改变vs.net 2010中chart控件的样式

来源:互联网 发布:沈航网络自助服务平台 编辑:程序博客网 时间:2024/05/22 03:17

要在后台程序中改变chart控件的样式(如 条形统计图,扇形统计图等),可以以下方法:

//---------

 SeriesChartType st = (SeriesChartType)Enum.Parse(typeof(SeriesChartType), DropDownList1.SelectedItem.Text);
 Chart1.Series.FindByName("Series1").ChartType = st;

//----------

 

DropDownList列表源码如下

<asp:DropDownList
        ID="DropDownList1" runat="server" AutoPostBack="True" Height="34px"
        onselectedindexchanged="DropDownList1_SelectedIndexChanged" Width="124px">
        <asp:ListItem>Point</asp:ListItem>
        <asp:ListItem>FastPoint</asp:ListItem>
        <asp:ListItem>Bubble</asp:ListItem>
        <asp:ListItem>Line</asp:ListItem>
        <asp:ListItem>Spline</asp:ListItem>
        <asp:ListItem>Stepline</asp:ListItem>
        <asp:ListItem>Bar</asp:ListItem>
        <asp:ListItem>StackedBar</asp:ListItem>
        <asp:ListItem>StackedBar100</asp:ListItem>
        <asp:ListItem>Column</asp:ListItem>
        <asp:ListItem>StackedColumn</asp:ListItem>
        <asp:ListItem>StackedColumn100</asp:ListItem>
        <asp:ListItem>Area</asp:ListItem>
        <asp:ListItem>SplineArea</asp:ListItem>
    </asp:DropDownList>

原创粉丝点击