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

Silverlight Bar Chart Data Series

1 Answer 45 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Manishkumar
Top achievements
Rank 1
Manishkumar asked on 21 Jun 2011, 12:18 PM
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.

1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 24 Jun 2011, 11:37 AM
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
Tags
General Discussions
Asked by
Manishkumar
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Share this question
or