简体   繁体   中英

Bar Chart Series PostBack Query

I've got an issue with the postback property. I have a chart (Code below) which has three series pulled from a datasource.

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. However, I try to pull the x value for the second or the third series, which is supposed to be the value on x axis, but all I get is 0. Anybody got any solutions?

Thanks.

<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# Code

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

    }

I have a stacked column chart and the PostBackValue always returns "0" when clicking on any stack item other than the bottom item. The bottom item seems to return the #VALX as expected. Changing the PostBackValue from #VALX to #AXISLABEL solved the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM