条形图系列PostBack查询

时间:2013-01-08 09:13:27

标签: c# asp.net charts

我遇到了postback属性的问题。我有一个图表(下面的代码),它有三个从数据源中提取的系列。

所有系列都显示正常,但我已启用图表中的栏以响应点击事件,当选择第一个系列中的项目时,一切正常。但是,我尝试拉出第二个或第三个系列的x值,这个值应该是x轴上的值,但我得到的是0。任何人都有任何解决方案吗?

感谢。

<asp:Chart ID="CTStatusCategory" runat="server" DataSourceID="DSLegislationCodeSummary" 
        BackColor="#FAEBD7" onclick="CTStatusCategory_Click">
        <Series>
            <asp:Series Name="Pending with Authority" XValueMember="LegislationCategoryCode" 
                YValueMembers="P" PostBackValue="#VALX,#VALY" IsValueShownAsLabel="true"  ChartType="StackedColumn" YAxisType="Primary" ToolTip="#SERIESNAME : #VALY" >
            </asp:Series>
            <asp:Series Name="Yes" XValueMember="LegislationCategoryCode" YValueMembers="Y" ChartType="StackedColumn" IsValueShownAsLabel="true" PostBackValue="#VALX,#VALY" ToolTip="#SERIESNAME : #VALY">
            </asp:Series>                 
            <asp:Series Name="In-Progress" XValueMember="LegislationCategoryCode" YValueMembers="I" ChartType="StackedColumn" IsValueShownAsLabel="true" PostBackValue="#VALX,#VALY" ToolTip="#SERIESNAME : #VALY">
            </asp:Series>
        </Series>
         <ChartAreas>
            <asp:ChartArea Name="ChartArea1" Area3DStyle-Enable3D="false" >
                <AxisX LineColor="DarkGray">
                    <MajorGrid LineColor="LightGray" />
                </AxisX>
                <AxisY LineColor="DarkGray">
                    <MajorGrid LineColor="LightGray" />
                </AxisY>
                <Area3DStyle Enable3D="True" WallWidth="5" LightStyle="Realistic"></Area3DStyle>
                 <Position Height="80" Width="100" X="0" Y="20" />
            </asp:ChartArea>
            </ChartAreas>
            <Legends>
                <asp:Legend BackColor="#FAEBD7" >
                </asp:Legend>
            </Legends>
    </asp:Chart>

C#代码

protected void CTStatusCategory_Click(object sender, ImageMapEventArgs e)
    {
        String dd = e.PostBackValue;

    }

1 个答案:

答案 0 :(得分:0)

我有一个堆积柱形图,当点击除底部项目以外的任何堆栈项目时,PostBackValue总是返回“0”。底部项似乎按预期返回#VALX。将PostBackValue从#VALX更改为#AXISLABEL解决了这个问题。