This is a migrated thread and some comments may be shown as answers.

RadChart inside DataList Problem

6 Answers 64 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
CS Teacher
Top achievements
Rank 1
CS Teacher asked on 14 May 2010, 09:41 AM
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..

6 Answers, 1 is accepted

Sort by
0
CS Teacher
Top achievements
Rank 1
answered on 14 May 2010, 10:00 AM
you will find in the attachment shot for my result:

0
CS Teacher
Top achievements
Rank 1
answered on 15 May 2010, 09:17 PM
Telerik Developer Please any help in my problem????
0
CS Teacher
Top achievements
Rank 1
answered on 17 May 2010, 08:11 PM
I need your help here ....:(
0
Ves
Telerik team
answered on 19 May 2010, 02:54 PM
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.
0
CS Teacher
Top achievements
Rank 1
answered on 20 May 2010, 07:33 PM
Sorry but that didn't help can u give an example of a radchart within datalist.....
0
Ves
Telerik team
answered on 26 May 2010, 08:06 AM
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.
Tags
Chart (Obsolete)
Asked by
CS Teacher
Top achievements
Rank 1
Answers by
CS Teacher
Top achievements
Rank 1
Ves
Telerik team
Share this question
or