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

Chart X-axis label placement.

6 Answers 212 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 10 Apr 2009, 11:51 PM
I have dates on the x-axis labels. They are too long to all fit. And I can't leave any of them out. And when I rotate them, the text does not look correct. I don't want to rotate them. Is there a way to make them alternate? Like the first date is a bit higher, and the next date is a bit lower, and so forth and so forth? That would just make everything so much easier.

Any help would be very much appreciated.

Thank you.

Sincerely,

Jeff

6 Answers, 1 is accepted

Sort by
0
Accepted
Ves
Telerik team
answered on 13 Apr 2009, 01:12 PM
Hello Jeff,

Unfortunately, it is not possible to alternate the X axis labels this way. As you cannot  leave any label out, the LabelStep property of X axis would not help here -- it can be used to force the chart to display only certain labels like every other or every third label.

So, the only way to show all of them without overlapping is to rotate them. You can use an additional setting, which will improve the text quality for the rotated labels:

RadChart1.Appearance.TextQuality = Telerik.Charting.Styles.TextQuality.AntiAlias;

Hope this is applicable.

Best regards,
Ves
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Jeff
Top achievements
Rank 1
answered on 13 Apr 2009, 06:00 PM
Is there a way to put a textbox around the text values? Like a little rectangle border around them?
0
Ves
Telerik team
answered on 14 Apr 2009, 08:10 AM
Hello Jeff,

All the text elements in RadChart have border, which is transparent by default. All you need to do is provide a color for that border. Additionally, you can set the border style and width:

<XAxis> 
    <Appearance> 
        <LabelAppearance RotationAngle="20"
            <Border Color="Red" PenStyle="Dot" Width="1" /> 
        </LabelAppearance> 
    </Appearance> 
</XAxis> 
 

Hope this helps.

Best wishes,
Ves
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Jeff
Top achievements
Rank 1
answered on 14 Apr 2009, 08:25 PM

Thanks! One more small question. I need to format my Yaxis labels. Problem is...

 

this

 

.RadChart1.PlotArea.YAxis.Appearance.CustomFormat = "{0:#,#;(#,#);0}";
does not yield the correct results.

And neither does...
this.RadChart1.PlotArea.YAxis.Appearance.CustomFormat = "0:#,#;(#,#);0";

I basically need two requirements:
a. That a comma appears after every 3 digits.
b. That negative numbers are displayed with parenthesis instead of a negative sign.

You can probably see I was trying to fullfill those requirements with the code above. If anyone can lend me some helpful tips or advice, I would appreciate it.

Thanks.

Sincerely,

Jeff

 

0
Ves
Telerik team
answered on 15 Apr 2009, 08:34 AM
Hello Jeff,

RadChart will accept all the valid Standard Numeric Format Strings and Custom Numeric Format Strings. So, as long as your format string works in a call to ToString() method, it will work as a custom format for the Y axis.

Here is how you can achieve this:
this.RadChart1.PlotArea.YAxis.Appearance.CustomFormat = "#,#;(#,#)";

Best regards,
Ves
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
Conrad
Top achievements
Rank 1
answered on 30 Oct 2009, 11:49 AM

Hi Jef,

Bit late, but I was looking for something similar.  Had very long X-labels and didn't want to rotate or abbreviate.

So all I did was pop every second label's text to another line.

For i As Integer = 1 To RadChart1.PlotArea.XAxis.Items.Count - 1 Step 2  
                RadChart1.PlotArea.XAxis.Item(i).TextBlock.Text = vbCrLf & RadChart1.PlotArea.XAxis.Item(i).TextBlock.Text  
Next 

Hope this helps.
Tags
Chart (Obsolete)
Asked by
Jeff
Top achievements
Rank 1
Answers by
Ves
Telerik team
Jeff
Top achievements
Rank 1
Conrad
Top achievements
Rank 1
Share this question
or