RadChart inside DataList Problem

Thread is closed for posting
7 posts, 0 answers
  1. CS Teacher
    CS Teacher avatar
    5 posts
    Member since:
    May 2010

    Posted 14 May 2010 Link to this post

    Hi,
    I'm building a survey management tool and I'm now in the phase of showing the survey result. Some of the survey questions have the matrix type, so I'm using a column radchart control within a datalist to show their results and the radchart consists of multiple series.
    My aspx looks like the following
    <asp:DataList ID="ResultDataList" runat="server" Width="100%" > 
    <ItemTemplate> 
    <table width="100%">  
    <tr> 
    <td> 
    <%#Eval("Question")%> 
        <asp:HiddenField ID="QuestionIDField" runat="server" Value='<%#Eval("QuestionID") %>' /> 
    </td> 
    </tr> 
    <tr> 
    <td > 
    <telerik:RadChart ID="RadChart1" runat="server" Width="500" Height="250" ChartTitle-Visible="false" CreateImageMap="false"   DataGroupColumn="ColumnText"
                      
                                     <PlotArea> 
                            <XAxis DataLabelsColumn="OptionText"
                    </XAxis>  
                            
                   </PlotArea> 
                     
                                     
                                </telerik:RadChart> 
    </td> 
    </tr> 
    <tr><td><hr /></td></tr> 
    </table> 
    </ItemTemplate> 
    </asp:DataList> 
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:SurveyDBConnectionString %>" 
                SelectCommand="select optiontext,text,isnull((select COUNT(resultid)  from SurveyResult where OptionID=SurveyOption.OptionID and ColumnID=ColumnOption.ColumnOptionID   group by OptionID ),'0') as RespondentCount from SurveyOption,ColumnOption  where  SurveyOption.QuestionID=ColumnOption.QuestionID and SurveyOption.QuestionID= @QID"
                <SelectParameters> 
                    <asp:Parameter Name="QID" /> 
                </SelectParameters> 
            </asp:SqlDataSource> 
    and my code behind page looks like this:
     Protected Sub ResultDataList_ItemDataBound(ByVal sender As ObjectByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles ResultDataList.ItemDataBound 
            If (Not e Is NothingThen 
                Dim chart As RadChart = CType(e.Item.FindControl("RadChart1"), RadChart) 
                Dim h As HiddenField = CType(e.Item.FindControl("QuestionIDField"), HiddenField) 
     
                SqlDataSource2.SelectParameters(0).DefaultValue = h.Value 
                chart.DataSource = SqlDataSource2.Select(DataSourceSelectArguments.Empty) 
                chart.Legend.Appearance.GroupNameFormat = "ColumnText" 
               chart.DataBind() 
            End If 
        End Sub 
    my problems are the following:
    1) The legend take the value from XAxis DataLabelsColumn "OptionText" and I wanna show the series value "ColumnText"
    2) the labels above the sries showed the YAxis value "RespondentCount" and I wanna show series value "ColumnText"

    Any help please...
    Thank's in advance..

  2. CS Teacher
    CS Teacher avatar
    5 posts
    Member since:
    May 2010

    Posted 14 May 2010 Link to this post

    you will find in the attachment shot for my result:

  3. CS Teacher
    CS Teacher avatar
    5 posts
    Member since:
    May 2010

    Posted 15 May 2010 Link to this post

    Telerik Developer Please any help in my problem????
  4. CS Teacher
    CS Teacher avatar
    5 posts
    Member since:
    May 2010

    Posted 17 May 2010 Link to this post

    I need your help here ....:(
  5. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 19 May 2010 Link to this post

    Hello,

    You can wire the ItemDataBound event and update each ChartSeriesItem individually. Set e.SeriesItem.Label.TextBlock.Text with the string you need to appear as label  and e.SeriesItem.Name with the string that you need to appear in the legend. You can find this task discussed in details in this blog post.

    Best regards,
    Ves
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. CS Teacher
    CS Teacher avatar
    5 posts
    Member since:
    May 2010

    Posted 20 May 2010 Link to this post

    Sorry but that didn't help can u give an example of a radchart within datalist.....
  7. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 26 May 2010 Link to this post

    Hi,

    I have attached a small example, showing how to configure and format labels in RadChart within a DataList.

    Greetings,
    Ves
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top