Dynamic Multiline Axis Labels

Thread is closed for posting
4 posts, 0 answers
  1. Rob
    Rob avatar
    4 posts
    Member since:
    Oct 2007

    Posted 13 May 2009 Link to this post

    Hi all, 

    can someone please assist, or direct me to a working example 

    I am using RADChart in an ASP.NET page, as a horizontal Gannt chart
    along the bottom axis i would like lables that appear as follows
    APR        MAY
    09            09


    Telerik.Charting.ChartAxisItem cai = new Telerik.Charting.ChartAxisItem();  
    // add 15 days so that label appears in middle of month  
    cai.Value = Convert.ToDecimal(thisDate.AddDays(15).ToOADate());  
    // create text for label  
    cai.TextBlock.Text = thisDate.ToString("MMM yy");  
    // attempt to force linefeed in label - also tried char(10)  
    cai.TextBlock.Text = cai.TextBlock.Text.Replace(' ', Convert.ToChar(13));  
    // set autowrap on - in desperation !!  
    cai.TextBlock.Appearance.AutoTextWrap = Telerik.Charting.Styles.AutoTextWrap.True;  
    // set label alignment to center  
    cai.TextBlock.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Center;  
    // add label to Axis objects  
    radChart.PlotArea.YAxis.Items.Add(cai); 

    unfortunately - Labels Still appear as APR 09      May 09     .....
    Any ideas - suggestions gratefully accepted
      
  2. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 15 May 2009 Link to this post

    Hi Rob,

    You can achieve the desired functionality like this:

    cai.TextBlock.Text = thisDate.ToString("MMM\nyy");  


    Hope this helps.


    All the best,
    Manuel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Rob
    Rob avatar
    4 posts
    Member since:
    Oct 2007

    Posted 15 May 2009 Link to this post

    Hi Manuel
    sorry - I tried this - the \n -  before asking on the forum,
    see image - after adding the \n

    any other ideas?
    thanks
    RobZ

  4. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 18 May 2009 Link to this post

    Hello Rob,

    We assume you have pasted direct link to the chart image, however the cache expires after a certain period of time and the image url is no longer valid and cannot be opened -- we would suggest you to either send us a runnable sample application or modify our sample application (attached to this thread) so we can reproduce the problem locally and advise you how to proceed.

    Looking forward to your reply.


    All the best,
    Manuel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top