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

Custom Y Axis labeling

1 Answer 70 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Nigel DeFreitas
Top achievements
Rank 1
Nigel DeFreitas asked on 08 Oct 2010, 02:35 AM
I need to render the Y axis on a horizontal bar chart like so...

                  |
                  |
   My Label |XXXXXXXXXXXXXXXXXXXXX
                  |
                  |
Next Label |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                  |
                  |___________________________________
                  0             1            2              3          4....

Any ideas how this could be done?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 11 Oct 2010, 04:36 PM
Hi Nigel,

I see you want to create a horizontal bar chart. You can set SeriesOrientation to Horizontal in order ro achieve it.
To be able to set custom text for axis labels you can choose one of these approaches:

1. Use XAxis.DataLabelsColumn as shown in our help topic - http://www.telerik.com/help/aspnet-ajax/buildingdatatbindlistcomplex.html.

2. Turn off AutoScale property:

RadChart1.PlotArea.XAxis.AutoScale = false;

Then you can subscribe to BeforeLayout event of the chart and set custom value to every Axis Item. Here is how you can achieve this:

protected void RadChart1_BeforeLayout(object sender, EventArgs e)
    {
        string[] someText = new string[] { "label1", "label2", "label3" };
        for (int i = 0; i < someText.Length; i++)
        {
            RadChart1.PlotArea.XAxis.Items[i].TextBlock.Text = someText[i];
        }
    }

Note, that when using horizontal orientation the vertical axis is actually the X axis, so its items are altered in the above suggestions. I hope this helps.
 
Greetings,
Evgenia
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart (Obsolete)
Asked by
Nigel DeFreitas
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Share this question
or