Alignment of Label Text

3 posts, 0 answers
  1. Jeremy Murtishaw
    Jeremy Murtishaw avatar
    86 posts
    Member since:
    Apr 2009

    Posted 17 Sep 2009 Link to this post

    Hello,

    This should be an easy one. I'm looking to make the X-Axis labels on my grid look identical to the one in your example here:

    http://www.telerik.com/help/winforms/buildingdatabinddatabase.html

    I have successfully gotten the text rotated, colored, formatted, etc, but the one thing that doesn't work is the alignment. In your example, the text is right-justified, making it hug right up against the bottom of the grid, which is nice! In my case, even when I set 

    radChart.PlotArea.XAxis.Appearance.LabelAppearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Right;

    It still doesn't do that, but stays center justified, so that longer strings run into the chart, and smaller strings are sitting many pixels below the bottom. How do I get my text to be aligned to the right?

    Thanks!
    Jeremy

  2. Jeremy Murtishaw
    Jeremy Murtishaw avatar
    86 posts
    Member since:
    Apr 2009

    Posted 17 Sep 2009 Link to this post


    Wow, I found the general solution right after I posted. It turns out that you need to align it to the top, instead of the right:

    radChart.PlotArea.XAxis.Appearance.LabelAppearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Top;

    However, I'm still having issues with labels of longer text being mis-aligned compared with labels of shorter text. Is there a way to make sure all the labels are evenly spaced, regardless of text length, but still keep them top aligned?

    Thanks!
    Jeremy
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 23 Sep 2009 Link to this post

    Hi Jeremy,

    Unfortunately, this is caused by the nature of the rotated axis labels in RadChart. The rotation is center-based, longer text appears a bit shifted. I believe the top alignment is respected.

    A possible workaround here is to introduce 90 degree rotation, this way the labels will appear centered at their X positions. You may want to combine this with AutoLayout set to true, so that the chart automatically calculates the space needed for these labels.

    Kind regards,
    Ves
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top