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

Hide XAxis Labels

1 Answer 116 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
yossi
Top achievements
Rank 1
yossi asked on 21 Aug 2008, 07:41 AM
Hi,

how do i hide XAxis labels from the chart?

this cose doesnt work :

foreach

(ChartAxisItem item in RadChart1.PlotArea.XAxis.Items)
{

    item.Visible = false;

}

thanks,

yossi.

1 Answer, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 21 Aug 2008, 10:37 AM
Hi yossi,

We would suggest you to handle the BeforeLayout server-side event and execute the code there:

ASPX:
<telerik:RadChart ID="RadChart1" runat="server" AutoLayout="true"  
    OnBeforeLayout="RadChart1_BeforeLayout"
</telerik:RadChart> 

Code-behind:
protected void Page_Load(object sender, EventArgs e) 
    DataTable dt = new DataTable(); 
    dt.Columns.Add("NumberColumn1", typeof(int)); 
 
    for (int i = 0; i < 20; i++) 
    { 
        dt.Rows.Add(new object[] { i }); 
    } 
 
    RadChart1.DataSource = dt
    RadChart1.DataBind(); 
 
protected void RadChart1_BeforeLayout(object sender, EventArgs e) 
    foreach (ChartAxisItem item in RadChart1.PlotArea.XAxis.Items) 
    { 
        item.Visible = false
    } 


Hope this helps.


Greetings,
Manuel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Chart (Obsolete)
Asked by
yossi
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Share this question
or