Issue with custom XAxis labels

4 posts, 0 answers
  1. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 15 Mar 2010 Link to this post

    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

     

  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 16 Mar 2010 Link to this post

    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 
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Rohit
    Rohit avatar
    2 posts
    Member since:
    Oct 2010

    Posted 28 Oct 2010 Link to this post

    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.
  5. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 01 Nov 2010 Link to this post

    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
Back to Top