This is a migrated thread and some comments may be shown as answers.
XAxis.Item.Visible not work
3 Answers 34 Views
This is a migrated thread and some comments may be shown as answers.
Filleau
Top achievements
Rank 1
Filleau asked on 01 Oct 2008, 12:12 PM

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

3 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 02 Oct 2008, 06:04 AM
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.
0
Filleau
Top achievements
Rank 1
answered on 03 Oct 2008, 03:30 PM
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

0
Accepted
Ves
Telerik team
answered on 06 Oct 2008, 08:38 AM
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.
Asked by
Filleau
Top achievements
Rank 1
Answers by
Ves
Telerik team
Filleau
Top achievements
Rank 1
Share this question
or