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

Help with Chart XAxis Label Rotation

2 Answers 106 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Barry
Top achievements
Rank 1
Barry asked on 26 Jan 2009, 07:01 PM
I want to programatically rotate the XAxis label by 90 degrees 

I've tried code like:
StyleAxisX sl = new StyleAxisX(RadChart1.PlotArea.XAxis);
sl.LabelAppearance.RotationAngle = 90;
chartSeries.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = sl.LabelAppearance.RotationAngle;

However, I get "Object reference not set to an instance of an object.".

I've tried other ways but can't resolve the problem; always the "object reference... " message.

Would be grateful for your help (am a relative Telerik newby but experienced .NET programmer).

TIA

Barry

2 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 27 Jan 2009, 07:10 AM
Hi Barry,

Here is the answer provided in your support ticket:

ChartSeries' PlotArea property is only populated when  the series is added to RadChart Series collection. The line of code you have pointed tries to access the PlotArea property of the series before it has been added to the chart's collection. Still, currently RadChart can have only one PlotArea, so it is safe to access it like this: RadChart1.PlotArea...Hope this helps.

Kind regards,
Ves
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Barry
Top achievements
Rank 1
answered on 27 Jan 2009, 09:49 AM
THanks - that's really helpful and fixed the problem.

I do find the format of the help very unhelpful and difficult to navigate.  I couldn't find "RotationAngle" in the help.

Kind regards

Barry
Tags
Chart (Obsolete)
Asked by
Barry
Top achievements
Rank 1
Answers by
Ves
Telerik team
Barry
Top achievements
Rank 1
Share this question
or