Bar Chart question

Thread is closed for posting
2 posts, 0 answers
  1. Sam
    Sam avatar
    103 posts
    Member since:
    Feb 2009

    Posted 10 Jun 2009 Link to this post

    I have a bar chart that I want the Labels on the x axis to display a name not a count. Currently the x axis labels are just a count of 1,2,3,4. Here is the markup and the code behind :

    <asp:SqlDataSource ID="SqlDataSource1" runat="server"  
                                ConnectionString="<%$ ConnectionStrings:tp %>"  
                                SelectCommand="tsp_PortalChart_Get"  
                        SelectCommandType="StoredProcedure"
                        <SelectParameters> 
                            <asp:CookieParameter CookieName="PortalAccountNumber" DefaultValue=""  
                                        Name="AccountNumber" Type="Int32" /> 
                        </SelectParameters> 
                    </asp:SqlDataSource> 
    <telerik:RadChart ID="RadChart1" runat="server"  
        Title="Account Summary" OnItemDataBound="RadChart1_ItemDataBound"  
        DataSourceID="SqlDataSource1"  
        ChartTitle-TextBlock-Appearance-TextProperties-Font="Verdana, 10pt"  
        Width="370px" Height="254px"
     
        <Appearance> 
            <Border Visible="False" /> 
        </Appearance> 
     
    <ChartTitle> 
    <TextBlock Text="Account Summary"
    <Appearance TextProperties-Font="Verdana, 10pt"></Appearance> 
    </TextBlock> 
    </ChartTitle> 
     
                        <Legend Appearance-ItemTextAppearance-TextProperties-Font="Verdana, 8pt"
    <Appearance> 
    <ItemTextAppearance TextProperties-Font="Verdana, 8pt"></ItemTextAppearance> 
    </Appearance> 
                        </Legend> 
                       <Series> 
                        <cc1:ChartSeries Name="Series 1" Type="Bar" DataYColumn="Count"
                        <Appearance LegendDisplayMode="ItemLabels" ></Appearance
                        </cc1:ChartSeries> 
                        </Series> 
                         </telerik:RadChart> 

    Code Behind
    Partial Class UserControls_AccountSummaryChart 
        Inherits System.Web.UI.UserControl 
     
        Protected Sub RadChart1_ItemDataBound(ByVal sender As ObjectByVal e As ChartItemDataBoundEventArgs) 
            e.SeriesItem.Name = CType(e.DataItem, DataRowView)("Name").ToString() 
        End Sub 
     
        Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load 
     
            RadChart1.Skin = Application("TelerikTheme"
            RadChart1.ChartTitle.TextBlock.Text = Application("CompanyName").ToString 
            RadChart1.Chart.Appearance.FillStyle.MainColor = Color.Transparent 
            If Not IsPostBack Then 
     
                RadChart1.DataSourceID = "SqlDataSource1" 
                RadChart1.DataBind() 
                RadChart1.Series(0).Name = "Type" 
     
                Dim barColors As Color() = New Color(4) {Color.Purple, Color.SteelBlue, Color.Green, Color.Yellow, Color.Crimson} 
                Dim i As Integer = 0 
                For Each item As ChartSeriesItem In RadChart1.Series(0).Items 
                    item.Appearance.FillStyle.MainColor = barColors(System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)) 
                Next 
            End If 
     
     
     
     
     
        End Sub 
    End Class 


    Thanks!
    Sam



  2. Sam
    Sam avatar
    103 posts
    Member since:
    Feb 2009

    Posted 10 Jun 2009 Link to this post

    Nevermind I figured it out.

    <PlotArea> 
                        <XAxis DataLabelsColumn="Name"></XAxis> 
                        </PlotArea> 


    Thanks!
    Sam




Back to Top