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

Need help - labeling the X axis with strings

1 Answer 48 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Todd Davis
Top achievements
Rank 1
Todd Davis asked on 14 Aug 2009, 06:07 PM
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 =
                                                   ConfigurationManager.ConnectionStrings[
                                                   "AdventureWorksConnectionString"].ConnectionString,
                                               SelectCommand = "GetSales"
                                           })
            {
                Page.Controls.Add(sqlDataSource);
                radChart.DataSourceID = "myDataSource";
                radChart.PlotArea.XAxis.DataLabelsColumn = "FullName";
                radChart.DataBind();
                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?

1 Answer, 1 is accepted

Sort by
0
Vladimir Milev
Telerik team
answered on 20 Aug 2009, 09:52 AM
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.
Tags
Chart (Obsolete)
Asked by
Todd Davis
Top achievements
Rank 1
Answers by
Vladimir Milev
Telerik team
Share this question
or