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

Dynamic Multiline Axis Labels

3 Answers 169 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 13 May 2009, 12:49 PM
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
  

3 Answers, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 15 May 2009, 01:53 PM
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.
0
Rob
Top achievements
Rank 1
answered on 15 May 2009, 03:06 PM
Hi Manuel
sorry - I tried this - the \n -  before asking on the forum,
see image - after adding the \n

any other ideas?
thanks
RobZ

0
Giuseppe
Telerik team
answered on 18 May 2009, 02:07 PM
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.
Tags
Chart (Obsolete)
Asked by
Rob
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Rob
Top achievements
Rank 1
Share this question
or