CategoricalDataPoint - wrong label position

2 posts, 0 answers
  1. kity
    kity avatar
    71 posts
    Member since:
    Mar 2012

    Posted 17 May 2013 Link to this post



    See Attached file view

    <UserControl
        x:Class="SilverlightApplication1.MainPage"    
        xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
        xmlns:controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Chart"
        xmlns:chartView="clr-namespace:Telerik.Windows.Controls.ChartView;assembly=Telerik.Windows.Controls.Chart"
        xmlns:charting="clr-namespace:Telerik.Charting;assembly=Telerik.Windows.Controls.Chart"
        mc:Ignorable="d"
        d:DesignHeight="300" d:DesignWidth="400">
     
        <Grid x:Name="LayoutRoot" Background="Transparent">              
            <controls:RadCartesianChart x:Name="RadChartAlarm" Palette="Metro"  >    
                <controls:RadCartesianChart.Grid>
                    <chartView:CartesianChartGrid/>
                </controls:RadCartesianChart.Grid>
                <controls:RadCartesianChart.HorizontalAxis>
                    <chartView:LinearAxis FontSize="16" FontFamily="Segoe UI" Minimum="0"/>
                </controls:RadCartesianChart.HorizontalAxis>
                <controls:RadCartesianChart.VerticalAxis>
                    <chartView:CategoricalAxis FontSize="13" FontFamily="Segoe UI" ElementBrush="Pink"  />
                </controls:RadCartesianChart.VerticalAxis>           
                <controls:RadCartesianChart.Series>
                      <chartView:BarSeries>         
                        <chartView:BarSeries.PointTemplates>
                            <DataTemplate>
                               <Rectangle Fill="Yellow"/>
                            </DataTemplate>
                            <DataTemplate>
                               <Rectangle Fill="Black"/>
                            </DataTemplate>
                            <DataTemplate>
                               <Rectangle Fill="Green"/>
                            </DataTemplate>
                            <DataTemplate>
                               <Rectangle Fill="Red"/>
                            </DataTemplate>
                            <DataTemplate>
                               <Rectangle Fill="Gray"/>
                            </DataTemplate>
                        </chartView:BarSeries.PointTemplates>         
                        <chartView:BarSeries.DataPoints>
                            <charting:CategoricalDataPoint Value="10" Category="1Common Function Max / Period an Day"/>
                            <charting:CategoricalDataPoint Value="20" Category="2Power Function Aaravge / Period an Day"/>
                            <charting:CategoricalDataPoint Value="70" Category="3Power Function Aaravge / Period an Hour"/>
                            <charting:CategoricalDataPoint Value="11" Category="4Common Function Max / Period an Day"/>
                            <charting:CategoricalDataPoint Value="35" Category="5Common3 Function Max / Period an Day"/>
                        </chartView:BarSeries.DataPoints>         
                    </chartView:BarSeries>
                </controls:RadCartesianChart.Series>                                               
            </controls:RadCartesianChart>    
        </Grid>
    </UserControl>


    The only one solution for fix this problem at this time is to change side of  CategoricalAxis to HorizontalLocation="Right"

    <controls:RadCartesianChart.VerticalAxis>
                    <chartView:CategoricalAxis x:Name="categoricalAxis" ElementBrush="Pink" FontSize="14" FontFamily="Segoe UI" GapLength="0.3" LineStroke="#FF1A5AC9" LineThickness="1" TickThickness="2" HorizontalLocation="Right"/>
                </controls:RadCartesianChart.VerticalAxis>

  2. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 22 May 2013 Link to this post

    Hi,

    This strange positioning of the labels is actually not a bug and it is caused by the default value of  the TextBlock.TextAlignment property which is Left. This should fix your problem:
    <telerik:CategoricalAxis FontSize="13" FontFamily="Segoe UI" ElementBrush="Pink">
        <telerik:CategoricalAxis.LabelStyle>
            <Style TargetType="TextBlock">
                <Setter Property="TextAlignment" Value="Right"/>
            </Style>
        </telerik:CategoricalAxis.LabelStyle>
    </telerik:CategoricalAxis>
     
    Regards,
    Petar Kirov
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top