Hi.. I have a pie chart where the items label will always be cut off whenever it is too long. Any idea how can I fix it? Apart from this, I tried to style the SeriesItemLabel to have transparent background but after I had apply the style the ShowConnectors in spidermode doesn't work anymore. Below is the xaml code:
<Window x:Class="Telerik_Pie_Chart.MainWindow" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Title="MainWindow" Height="300" Width="300"> <Window.Resources> <Style x:Key="SeriesItemLabelStyle" TargetType="{x:Type telerik:SeriesItemLabel}"> <Setter Property="Padding" Value="2,0"/> <Setter Property="IsHitTestVisible" Value="False"/> <Setter Property="Fill" Value="Transparent"/> <Setter Property="ContentTemplate"> <Setter.Value> <DataTemplate> <TextBlock TextAlignment="Center" Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}"/> </DataTemplate> </Setter.Value> </Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type telerik:SeriesItemLabel}"> <Canvas x:Name="PART_MainContainer"> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="HoverStates"> <VisualState x:Name="Normal"> <Storyboard> <DoubleAnimation Duration="0:0:0.15" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_MainContainer"/> </Storyboard> </VisualState> <VisualState x:Name="Hovered"> <Storyboard> <DoubleAnimation Duration="0:0:0.15" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_MainContainer"/> </Storyboard> </VisualState> <VisualState x:Name="Hidden"> <Storyboard> <DoubleAnimation Duration="0:0:0.15" To="0.15" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_MainContainer"/> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Path Style="{TemplateBinding ConnectorStyle}" Stroke="{TemplateBinding Stroke}" StrokeThickness="{TemplateBinding StrokeThickness}" Visibility="{TemplateBinding ConnectorVisibility}"> <Path.Data> <PathGeometry> <PathFigure> <PolyLineSegment/> </PathFigure> </PathGeometry> </Path.Data> </Path> <Border x:Name="PART_TextContainer" BorderBrush="{TemplateBinding Stroke}" Background="{TemplateBinding Fill}" Height="{TemplateBinding Height}" Style="{TemplateBinding LabelStyle}" Width="{TemplateBinding Width}"> <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Margin="{TemplateBinding Padding}"/> </Border> </Canvas> </ControlTemplate> </Setter.Value> </Setter> </Style> </Window.Resources> <Grid> <telerik:RadChart Name="radChart1" Background="Black"> <telerik:RadChart.DefaultView> <telerik:ChartDefaultView ChartLegend="{x:Null}"> <telerik:ChartDefaultView.ChartArea> <telerik:ChartArea SmartLabelsEnabled="True"/> </telerik:ChartDefaultView.ChartArea> </telerik:ChartDefaultView> </telerik:RadChart.DefaultView> <telerik:RadChart.SeriesMappings> <telerik:SeriesMapping ItemsSource="{Binding Pies}"> <telerik:SeriesMapping.SeriesDefinition> <telerik:PieSeriesDefinition ItemLabelFormat="#XCAT #Y #%{P0} test with long item label" RadiusFactor="0.5" SeriesItemLabelStyle="{StaticResource SeriesItemLabelStyle}"> <telerik:PieSeriesDefinition.LabelSettings> <telerik:RadialLabelSettings ShowZeroValueLabels="False" SpiderModeEnabled="True" ShowConnectors="True"/> </telerik:PieSeriesDefinition.LabelSettings> </telerik:PieSeriesDefinition> </telerik:SeriesMapping.SeriesDefinition> <telerik:SeriesMapping.ItemMappings> <telerik:ItemMapping FieldName="Label" DataPointMember="XCategory"/> <telerik:ItemMapping FieldName="Value" DataPointMember="YValue"/> </telerik:SeriesMapping.ItemMappings> </telerik:SeriesMapping> </telerik:RadChart.SeriesMappings> </telerik:RadChart> </Grid></Window>