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

Refreshing the chart will not showing the X-axis lables

1 Answer 46 Views
Chart (obsolete as of Q1 2013)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Top achievements
Rank 1
chandra asked on 11 Jun 2008, 12:56 PM

I have drawn the Gantt chart with date on X-axis, time on Y-axis.
I  have added the range of the X-Axis using the following Statement

radChart1.PlotArea.XAxis.AddRange(GraphStartTime.ToOADate(), GraphStartTime.AddDays(7).ToOADate(), 1);

I have set the Y-AxisLabel text to "XYZ".

My requirement is to change the AxisLabel text to "ABC", when the user clicks on the button.

I add the following code:
private void btnChangeAxisLabel_Click(object sender, EventArgs e)
            radChart1.PlotArea.YAxis.AxisLabel.TextBlock.Text = "XYZ";

It is changing the AxisLabel text to "ABC".
But X-Axis ChartAxisItem's TextBlock.Text is not appearing(i.e The dates what i have added to X-axis is not appearing).

Please share the sample code.


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 13 Jun 2008, 09:16 AM
Hello chandra,

Are the X-axis items' labels visible before you change the Y-AxisLabel or the X-Axis items' labels get hidden when you set the new Y-AxisLabel? We cannot reproduce the issue locally. Here is a sample code, that changes the Y-AxisLabel while the X-axis items' labels stay visible (do not change):
public Form1() 
protected override void OnLoad(EventArgs e) 
    Random r = new Random(42); 
    radChart1.PlotArea.XAxis.AutoScale = false
    radChart1.PlotArea.XAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.LongDate; 
    radChart1.PlotArea.XAxis.Appearance.CustomFormat = "MMMM dd, yyyy"
    radChart1.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = -60; 
    radChart1.PlotArea.XAxis.AddRange(DateTime.Today.ToOADate(), DateTime.Today.AddDays(7).ToOADate(), 1); 
    radChart1.PlotArea.YAxis.AxisLabel.Visible = true
    radChart1.PlotArea.YAxis.AxisLabel.TextBlock.Text = "Initial text (ABC)"
    for (int i = 0; i < 10; i++) 
        this.radChart1.Series[0].AddItem(Math.Round(r.NextDouble() * 100)); 
private void radChart1_Click(object sender, ChartClickEventArgs args) 
    radChart1.PlotArea.YAxis.AxisLabel.TextBlock.Text = "Another text (XYZ)"
Note, that the range on X-axis is added before adding items to the Series.

Let us know if this example helps.

the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Chart (obsolete as of Q1 2013)
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question