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

PlotAreaAxisYStyle example

2 Answers 32 Views
Chart
This is a migrated thread and some comments may be shown as answers.
rachel
Top achievements
Rank 1
rachel asked on 13 Sep 2014, 04:11 PM
Hi, I have a Silverlight RadChart displaying multiple horizontal stacked series.  The labels on the y axis are centred and I need them to be right-aligned.  I believe I need to set the DefaultView.ChartArea.PlotAreaAxisYStyle style, but I can't get this to work either in code or XAML.

There seem to be no examples available anywhere that demonstrate the use of this style - could someone possibly supply one?

Thanks,

Ben Jackson
Asprey

2 Answers, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 17 Sep 2014, 11:26 AM
Hello Ben,

You can use the exposed ItemLabelStyle property as shown below:
<telerik:RadChart.DefaultView>
    <telerik:ChartDefaultView>
        <telerik:ChartDefaultView.ChartArea>
            <telerik:ChartArea LegendName="Legend1">
                <telerik:ChartArea.AxisX>
                    <telerik:AxisX Title="Axis title">
                        <telerik:AxisX.AxisStyles>
                            <telerik:AxisStyles ItemLabelStyle="{StaticResource CustomLabelStyle}" />
                        </telerik:AxisX.AxisStyles>
                    </telerik:AxisX>
                </telerik:ChartArea.AxisX>
                <telerik:ChartArea.AxisY>
                    <telerik:AxisY Title="Axis title"/>
                </telerik:ChartArea.AxisY>
            </telerik:ChartArea>
        </telerik:ChartDefaultView.ChartArea>
        <telerik:ChartDefaultView.ChartLegend>
            <telerik:ChartLegend x:Name="Legend1" />
        </telerik:ChartDefaultView.ChartLegend>
        <telerik:ChartDefaultView.ChartTitle>
            <telerik:ChartTitle Content="RadChart" />
        </telerik:ChartDefaultView.ChartTitle>
    </telerik:ChartDefaultView>
</telerik:RadChart.DefaultView>

where the style should have TextBlock as target type:
<Style x:Key="CustomLabelStyle" TargetType="TextBlock">
    <Setter Property="Foreground" Value="Orange" />
    <Setter Property="TextAlignment" Value="Right" />
</Style>

More information can be found in our help topic describing how to style the axis item label.


Regards,
Sia
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
rachel
Top achievements
Rank 1
answered on 20 Jan 2015, 06:16 PM
Many thanks!
Tags
Chart
Asked by
rachel
Top achievements
Rank 1
Answers by
Sia
Telerik team
rachel
Top achievements
Rank 1
Share this question
or