Asp.net Chart不显示系列名称

时间:2015-05-11 16:01:32

标签: c# asp.net charts

我有使用objectdatasource的asp.net图表控件。一切都好。但是我无法显示系列名称。

    <asp:Chart ID="ChartPaun" runat="server"  Height="150px"  CssClass="border"  Width="525px">

    <Series>
        <asp:Series  Name="1puan" YValueType="Int32" LabelBorderDashStyle="NotSet"  
            ShadowOffset="0" IsValueShownAsLabel="True" Color="#D74949" ChartType="Bar" 
            Font="Microsoft Sans Serif, 8pt, style=Bold" LegendText="dsfsdf">

        </asp:Series>
        <asp:Series  Name="2puan" YValueType="Int32" LabelBorderDashStyle="NotSet"  
            ShadowOffset="0" IsValueShownAsLabel="True" Color="#FF8B5A" ChartType="Bar" 
            Font="Microsoft Sans Serif, 8pt, style=Bold">

        </asp:Series>
        <asp:Series  Name="3puan" YValueType="Int32" LabelBorderDashStyle="NotSet"  
            ShadowOffset="0" IsValueShownAsLabel="True" Color="#FFB234" ChartType="Bar" 
            Font="Microsoft Sans Serif, 8pt, style=Bold">

        </asp:Series>
        <asp:Series  Name="4puan" YValueType="Int32" LabelBorderDashStyle="NotSet"  
            ShadowOffset="0" IsValueShownAsLabel="True" Color="#A0DB0D" ChartType="Bar" 
            Font="Microsoft Sans Serif, 8pt, style=Bold">


        </asp:Series>
        <asp:Series  Name="5puan" YValueType="Int32" LabelBorderDashStyle="NotSet"  
            ShadowOffset="0" IsValueShownAsLabel="True" Color="#9BDA00" ChartType="Bar" 
            Font="Microsoft Sans Serif, 8pt, style=Bold">

        </asp:Series>
    </Series>
    <ChartAreas>
        <asp:ChartArea Name="GosterimAlan" AlignmentOrientation="All" AlignmentStyle="AxesView" Area3DStyle-IsClustered="True" Area3DStyle-LightStyle="Realistic">
        <AxisX LineWidth="0" IsMarginVisible="False" Interval="1" Enabled="True">
          </AxisX>
          <Position Height="100" Width="100" X="30" Y="0" />

<Area3DStyle IsClustered="True" LightStyle="Realistic"></Area3DStyle>
</asp:ChartArea>
</ChartAreas>
</asp:Chart>

codebehind:

protected void Page_Load(object sender, EventArgs e)
    {
        ChartPaun.DataSource = odsPuanDagilimi;
        ChartPaun.Series["1puan"].YValueMembers = "birpuan";
        ChartPaun.Series["2puan"].YValueMembers = "ikipuan";
        ChartPaun.Series["3puan"].YValueMembers = "ucpuan";
        ChartPaun.Series["4puan"].YValueMembers = "dortpuan";
        ChartPaun.Series["5puan"].YValueMembers = "bespuan";
        ChartPaun.Series["4puan"].SmartLabelStyle.Enabled = true;
        ChartPaun.DataBind();
        ChartPaun.ChartAreas["GosterimAlan"].AxisY.MajorGrid.Enabled = false;
        ChartPaun.ChartAreas["GosterimAlan"].AxisX.MajorGrid.Enabled = false;
        ChartPaun.ChartAreas["GosterimAlan"].AxisY.LineWidth = 0;
        ChartPaun.ChartAreas["GosterimAlan"].AxisX.LineWidth = 0;
        ChartPaun.ChartAreas["GosterimAlan"].AxisX.LabelStyle.Enabled = false;
        ChartPaun.ChartAreas["GosterimAlan"].AxisY.LabelStyle.Enabled = false;
}

我没有写objectdatasource代码。 如何显示系列名称?我可以从代码隐藏中设置系列名称吗?

0 个答案:

没有答案