Help with Chart XAxis Label Rotation

Thread is closed for posting
3 posts, 0 answers
  1. Barry
    Barry avatar
    11 posts
    Member since:
    Sep 2008

    Posted 26 Jan 2009 Link to this post

    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).


  2. Ves
    Ves avatar
    2926 posts

    Posted 27 Jan 2009 Link to this post

    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,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Barry
    Barry avatar
    11 posts
    Member since:
    Sep 2008

    Posted 27 Jan 2009 Link to this post

    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

Back to Top