Silverlight Bar Chart Data Series

2 posts, 0 answers
  1. Manishkumar
    Manishkumar avatar
    240 posts
    Member since:
    Feb 2009

    Posted 21 Jun 2011 Link to this post

    Can you Please provide solution for displaying Data points in bar charts in vertical format.bar chart counts on the top of the bars overlapping, when the bar heights were fairly close.  can you Please provide the solution to change the text vertical. Please find the attached screen shot for more details.
  2. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 24 Jun 2011 Link to this post

    Hello Manishkumar,

    To be able to rotate the Series Items Labels you should retemplate the default Style and wrap the TextBlock around a  LayoutTransformControl.
    The needed style together with the LayoutTransformControl is demonstrated below:

    <Style x:Key="SeriesItemLabelStyle"
                   TargetType="telerikCharting:SeriesItemLabel">
               <Setter Property="Padding" Value="2,0" />
               <Setter Property="IsHitTestVisible" Value="False"/>
               <Setter Property="ContentTemplate">
                   <Setter.Value>
                       <DataTemplate>
                           <telerik:LayoutTransformControl>
                               <telerik:LayoutTransformControl.Content>
                                   <TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content }" TextAlignment="Center" />
                               </telerik:LayoutTransformControl.Content>
                               <telerik:LayoutTransformControl.LayoutTransform>
                                   <RotateTransform Angle="-90" />
                               </telerik:LayoutTransformControl.LayoutTransform>
                           </telerik:LayoutTransformControl>
                       </DataTemplate>
                   </Setter.Value>
               </Setter>
               <Setter Property="Template" >
                   <Setter.Value>
                       <ControlTemplate TargetType="telerikCharting:SeriesItemLabel">
                           <Canvas x:Name="PART_MainContainer">
                               <Path Visibility="{TemplateBinding ConnectorVisibility}"
                                 Style="{TemplateBinding ConnectorStyle}"
                                 Stroke="{TemplateBinding Stroke}"
                                 StrokeThickness="{TemplateBinding StrokeThickness}">
                                   <Path.Data>
                                       <PathGeometry >
                                           <PathGeometry.Figures>
                                               <PathFigure x:Name="PART_Connector">
                                                   <PathFigure.Segments>
                                                       <PolyLineSegment />
                                                   </PathFigure.Segments>
                                               </PathFigure>
                                           </PathGeometry.Figures>
                                       </PathGeometry>
                                   </Path.Data>
                               </Path>
                               <Border x:Name="PART_TextContainer"
                                   Style="{TemplateBinding LabelStyle}"
                                   BorderBrush="{TemplateBinding Stroke}"
                                   Background="{TemplateBinding Fill}"
                                   Width="{TemplateBinding Width}"
                                   Height="{TemplateBinding Height}">
                                   <ContentPresenter Margin="{TemplateBinding Padding}" />
                               </Border>
                           </Canvas>
                       </ControlTemplate>
                   </Setter.Value>
               </Setter>
           </Style>

    All the best,
    Evgenia
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top