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

Adding to the X-Axis

1 Answer 33 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 07 Apr 2009, 11:24 PM
I'm trying to create a chart with custom x-axis values. Right now, they are defaulting to 1, 2, 3, 4, 5...etc.
I need them to be a specific string value from the datatable. "P 2009, P 2010, P 2010, etc. etc."
There are several things that are dependent on the for loop below (which I left out) which is why I need to keep the for loop.
I cannot bind the series to the datatable. I know that would be much easier, but a lot of functionality is dependent on the for loop below. How may I add the X-axis values?

for
(int idx = 0; idx < dtDataTable.Rows.Count; idx++)

 

{

 

 

  int iValue = Convert.ToInt32(dtDataTable.Rows[idx][sSeries]);

 

 

  string sLabel = iValue.ToString("#,#", CultureInfo.InvariantCulture);

 

  csGLFunc.AddItem(iValue, sLabel);

}

 

this

 

.RadChart1.Series.Add(csGLFunc);

Any help would be very much appreciated.

Thank you.

Sincerely,

Jeff

 

1 Answer, 1 is accepted

Sort by
0
Dessy
Telerik team
answered on 10 Apr 2009, 01:41 PM
Hi Jeff,

In order to achieve this, you should set AutoScale property to false.

RadChart1.PlotArea.XAxis.AutoScale = false;

Then, that one option for adding  items to XAxis would be to use AddItem method of the Axis inside the same loop:

RadChart1.PlotArea.XAxis.AddItem(label)

where label is the string variable which will be added to XAxis.

 

Hope that helps.

Greetings,
Dessy
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Chart (Obsolete)
Asked by
Jeff
Top achievements
Rank 1
Answers by
Dessy
Telerik team
Share this question
or