2

我对回发属性有疑问。我有一个图表(下面的代码),其中包含从数据源中提取的三个系列。

all series display fine but I've enabled the bars in the chart to respond to the click event and when items from the first series is selected, everything works fine. 但是,我尝试提取第二个或第三个系列的 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;

    }
4

1 回答 1

1

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

于 2015-04-21T12:54:46.870 回答