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

Issue with custom XAxis labels

3 Answers 176 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.
Richard Slade
Top achievements
Rank 2
Richard Slade asked on 15 Mar 2010, 06:32 PM
Hi,

I've got a RadChart that I'm building on the fly from a filtered binding source. It shows some values on the Y Axis and along the X Axis it shows the month number that the data corresponds to:

For example
20
15
10
5
     1     2    3    4    5   6  7   8  9   10   11   12

Where 1 = january and so on.

Because I am not binding this to a datasource, but I am building the series and data on the fly, I cannot use the

Me

 

.RadChart.PlotArea.XAxis.DataLabelsColumn as far as I know.

However, I want to replace the X Axis labels with meaningful names I.e Jan Feb Mar etc...

I have tried adding this in during the loop and the labels show, but once the labels show, the data doesn't.

Please can you advise an easy way to get the X Axis labels to be set to a custom value

Thanks

Richard

 

3 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 16 Mar 2010, 11:08 AM
Ok, got it. Realised I needed to not only give the label text, but a value which is the same as the month I am trying to plot.

            'X Axis Custom Labels. Add in Jan - Dec  
            For i As Integer = 1 To 12  
                Dim item As New ChartAxisItem(GetMonthName(i))  
                item.Value = i  
                Me.RadChart.PlotArea.XAxis.Items.Add(item)  
            Next 
0
Rohit
Top achievements
Rank 1
answered on 28 Oct 2010, 10:02 AM
Hi All,
I am facing same problem for custom label (axis label)

I set (x,y) values for series as below
Code is in C#

ChartSeries series = new ChartSeries();
series.Type = ChartSeriesType.Line;

 for (int iCnt = 0; iCnt < 6; iCnt++)
       {
                    series.Items.Add(new ChartSeriesItem(arrdXData[iCnt], arrdYData[iCnt]));
                    // Here some code which set custom label for x-axis instead of 1,2,3...
        }
                    

The below solution not work for me.

For i As Integer = 1 To 12  
                Dim item As New ChartAxisItem(GetMonthName(i))  
                item.Value = i  
                Me.RadChart.PlotArea.XAxis.Items.Add(item)  
            Next 

.

Thanks & Regards
Rohit.
0
Evgenia
Telerik team
answered on 01 Nov 2010, 05:05 PM
Hello Rohit,

To be able to set custom Axis Labels follow this help article -http://www.telerik.com/help/winforms/howtoaddxlabels.html.
Note that you should turn off AutoScale property to be able to populate RadChart Axis Items Labels manually.

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 as of Q1 2013)
Asked by
Richard Slade
Top achievements
Rank 2
Answers by
Richard Slade
Top achievements
Rank 2
Rohit
Top achievements
Rank 1
Evgenia
Telerik team
Share this question
or