XAxis.Item.Visible not work

Thread is closed for posting
4 posts, 1 answers
  1. Filleau
    Filleau avatar
    114 posts
    Member since:
    Jun 2006

    Posted 01 Oct 2008 Link to this post

    Hi, whith the last realease (07/08)

    I try to control the visibility of my axis labels

    If i do a simple thing like :

    For I = 0 To Graph.PlotArea.XAxis.Items.Count - 1
        Graph.PlotArea.XAxis.Item(I).Visible = False
    Next

     The X labels are visible

    What is wrong ?

    Thanks

  2. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 02 Oct 2008 Link to this post

    Hi,

    The code seems to be correct. However it is important that it is executed after the X axis items are created. If the X axis AutoScale property is set to true (this is the default value) the items will not be available before BeforeLayout event. This means that the labels count in this loop will be 0. While you can move the code to BeforeLayout event handler and it will work, there is another simple solution for this problem:

    Graph.PlotArea.XAxis.Appearance.LabelAppearance.Visible = False

    Best regards,
    Ves
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Filleau
    Filleau avatar
    114 posts
    Member since:
    Jun 2006

    Posted 03 Oct 2008 Link to this post

    Sorry, but in debug mode I can see that items.count = 742
    and autoscale is set to True.
    Trying to move my loop in the BeforeLayout event handler doesn't solve it.

     Graph.PlotArea.XAxis.Appearance.LabelAppearance.Visible = False  will not solve my problem because the code I give you is to resume my problem.

    In fact I have a Tables with 2 fields: Date and Values

    I have one record for each days.

    So I try to find a way to display all the value, but only months on the Xaxis.

    In my final code, I test in the loop if 

    Graph.PlotArea.XAxis.Item(I).TextBlock.Text=

    Graph.PlotArea.XAxis.Item(I-1).TextBlock.Text in order to make it visible or not

  5. Answer
    Ves
    Admin
    Ves avatar
    2879 posts

    Posted 06 Oct 2008 Link to this post

    Hi Filleau,

    Please, use this code:

    Graph.PlotArea.XAxis.Item(I).TextBlock.Appearance.Visible = False

    As this will not hide the ticks, you may need to hide them like this:

    Graph.PlotArea.XAxis.Appearance.MajorTick.Visible = False

    Hope this helps.

    Greetings,
    Ves
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top