Hi,
I have created a horizontal stacked bar chart by geting the values from database. some of the labels are long and some are short
The default label horizontal position is centre how can I change it to right aligned one?
I have attached the screen shot of my chart. also I want to set a fixed width for that x axis label. Is this possible ? Please help...
I have created a horizontal stacked bar chart by geting the values from database. some of the labels are long and some are short
The default label horizontal position is centre how can I change it to right aligned one?
I have attached the screen shot of my chart. also I want to set a fixed width for that x axis label. Is this possible ? Please help...
8 Answers, 1 is accepted
0
Hello Joby,
To change the axis' label positioning, you need to apply a style that targets a TextBlock to the ItemLabelStyle of the RadChart's AxisY as follows:
Likewise, you can set the AxisX labels to a fixed width by applying a similar style, but with a different Setter:
If you want to customize the Axes even further, you can take a look at this help topic.
All the best,
Ivan N.
the Telerik team
To change the axis' label positioning, you need to apply a style that targets a TextBlock to the ItemLabelStyle of the RadChart's AxisY as follows:
<
telerik:AxisY
>
<
telerik:AxisY.AxisStyles
>
<
telerik:AxisStyles
>
<
telerik:AxisStyles.ItemLabelStyle
>
<
Style
TargetType
=
"TextBlock"
>
<
Setter
Property
=
"HorizontalAlignment"
Value
=
"Right"
/>
</
Style
>
</
telerik:AxisStyles.ItemLabelStyle
>
</
telerik:AxisStyles
>
</
telerik:AxisY.AxisStyles
>
</
telerik:AxisY
>
Likewise, you can set the AxisX labels to a fixed width by applying a similar style, but with a different Setter:
<
telerik:AxisX
>
<
telerik:AxisX.AxisStyles
>
<
telerik:AxisStyles
>
<
telerik:AxisStyles.ItemLabelStyle
>
<
Style
TargetType
=
"TextBlock"
>
<
Setter
Property
=
"Width"
Value
=
"20"
/>
</
Style
>
</
telerik:AxisStyles.ItemLabelStyle
>
</
telerik:AxisStyles
>
</
telerik:AxisX.AxisStyles
>
</
telerik:AxisX
>
If you want to customize the Axes even further, you can take a look at this help topic.
All the best,
Ivan N.
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Alex
Top achievements
Rank 1
answered on 05 Dec 2012, 01:53 PM
Hi,
I have a similar problem, but i need to align labels on the horizontal axis to the left. They are aligned to center and overlap if the label text is too long. I tried to set the HorizontalAlignment in ItemLabelStyle for the horizontal axis but it doesn't work, although it works fine for the vertical axis.
Is it possible to left-align labels on the horizontal axis?
Please see the attached screenshot.
I have a similar problem, but i need to align labels on the horizontal axis to the left. They are aligned to center and overlap if the label text is too long. I tried to set the HorizontalAlignment in ItemLabelStyle for the horizontal axis but it doesn't work, although it works fine for the vertical axis.
Is it possible to left-align labels on the horizontal axis?
Please see the attached screenshot.
0
Hello Alex,
Please, find attached a sample project that shows how to achieve the desired result.
Kind regards,
Ivan N.
the Telerik team
Please, find attached a sample project that shows how to achieve the desired result.
Kind regards,
Ivan N.
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Alex
Top achievements
Rank 1
answered on 10 Dec 2012, 12:04 PM
I tried to run the example but the horizontal labels are not rotated. LabelRotationAngle doesn't seem to work. Is there any setting or assembly that i should reference in order to enable label rotation?
Please check the new screenshot.
Please check the new screenshot.
0
Hi Alex,
Labels are rotated appropriately at our end. Take a look at the sample project attached to this message which includes assemblies from the trial version of RadControls for Silverlight.
I've also attached two screenshots which show how the chart should be rendered.
Regards,
Ivan N.
the Telerik team
Labels are rotated appropriately at our end. Take a look at the sample project attached to this message which includes assemblies from the trial version of RadControls for Silverlight.
I've also attached two screenshots which show how the chart should be rendered.
Regards,
Ivan N.
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Alex
Top achievements
Rank 1
answered on 13 Dec 2012, 08:21 AM
Thank you, that's exactly what i needed.
0
Savani
Top achievements
Rank 1
answered on 05 Feb 2013, 10:25 AM
Hi,
I'm also facing the same issue. and i need to display the X axis labels exactly same as in the image you have attached.
But, unfortunately i was unable to open the source code attached and therefore could you please help me with the setting that i need to do to achieve this.
I'm also facing the same issue. and i need to display the X axis labels exactly same as in the image you have attached.
But, unfortunately i was unable to open the source code attached and therefore could you please help me with the setting that i need to do to achieve this.
0
Hello Savani,
I've reattached only the .xaml file and its code-behind .cs file that contain the actual workaround. You should be able to change the appearance of the labels based solely on these two files.
Would you please also explain what exactly prevented you from opening the attached archive so that we may eliminate the problem if there's something wrong on our end?
Kind regards,
Ivan N.
the Telerik team
I've reattached only the .xaml file and its code-behind .cs file that contain the actual workaround. You should be able to change the appearance of the labels based solely on these two files.
Would you please also explain what exactly prevented you from opening the attached archive so that we may eliminate the problem if there's something wrong on our end?
Kind regards,
Ivan N.
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.