Need help - labeling the X axis with strings

Thread is closed for posting
2 posts, 0 answers
  1. Todd Davis
    Todd Davis avatar
    36 posts
    Member since:
    Aug 2009

    Posted 14 Aug 2009 Link to this post

    I am VERY new to Telerik and charting in particular, and need some help understanding how this control works.

    My first question is a very basic one, but I can't seem to figure it out. I have a stored proc that returns to columns of data. One column has each person's name (i.e. Ted Smith) and the second column has a monetary amount (i.e. $12000). I am using the Adventureworks DB for data at the moment.

    My code behind looks like this:
            protected void BindData(RadChart radChart)
                using (var sqlDataSource = new SqlDataSource
                                                   ID = "myDataSource",
                                                   ConnectionString =
                                                   SelectCommand = "GetSales"
                    radChart.DataSourceID = "myDataSource";
                    radChart.PlotArea.XAxis.DataLabelsColumn = "FullName";
                    radChart.Series[0].DataYColumn = "TotalDue";
                    radChart.Series[0].DataXColumn = "FullName";

    When I run the application, the chart shows the Y axis (TotalDue) as I would expect it to, in a numeric format. But the X axis just shows the numbers 0-8, not the names of the people. This doesn't help me much. How do I get the names of the people to show up?
  2. Vladimir Milev
    Vladimir Milev avatar
    1061 posts

    Posted 20 Aug 2009 Link to this post

    Hi Todd Davis,

    Please try moving the setter of the DataLabelsColumn before this line:
      radChart.DataSourceID = "myDataSource";

    Also, please remove the call to databind().

    Best wishes,
    Vladimir Milev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top