Pie Chart SeriesItemLabelStyle and connectors not showing

2 posts, 1 answers
  1. jason
    jason avatar
    28 posts
    Member since:
    Oct 2010

    Posted 07 Mar 2011 Link to this post

    I have created a pie chart with you most recent binaries.  I ran it and everything looked good (spider mode was visible) but then when I applied a SeriesItemLabelStyle to my pie chart the connectors no longer show up?  Am I missing a property in the style?  Here is my style and also a code snippet of where I apply it.  I also attached a screen shot of the pie chart.

    <Style x:Key="PieLabelStyle" TargetType="series:SeriesItemLabel">
            <Setter Property="ConnectorVisibility" Value="Visible" />
            <Setter Property="Template">
                    <ControlTemplate TargetType="series:SeriesItemLabel">
                        <Border x:Name="PART_TextContainer" BorderBrush="Black"  CornerRadius="2" BorderThickness="1" Style="{TemplateBinding LabelStyle}">
                            <Grid >
                                <Grid.ColumnDefinitions >
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                <TextBlock Grid.Column="0" Text="{Binding DataItem.XVal}" Foreground="Black" />
                                <TextBlock Grid.Column="1" Text="{Binding DataItem.YVal}" Foreground="Black" />
                                <Rectangle Fill="LightBlue" Opacity=".3" Grid.ColumnSpan="2"/>
    I tried this in the Chart_DataBound method:
    (series.Definition as SeriesDefinition).SeriesItemLabelStyle = _resources["PieLabelStyle"as Style;

    and also this:
     (definitions[0] as RadialSeriesDefinition).SeriesItemLabelStyle = _resources["PieLabelStyle"as Style;

    I thought I found a couple similar posts on this but none of the replies seemed to work. 
  2. Answer
    Nikolay avatar
    397 posts

    Posted 10 Mar 2011 Link to this post

    Hi jason,

    The connectors are not displayed because you are missing the Path from the style that contains the PathFigure x:Name="PART_Connector". Please, consider setting the style in the following manner :
    <Style x:Key="PieLabelStyle" TargetType="telerikChart:SeriesItemLabel">
        <Setter Property="ConnectorVisibility" Value="Visible" />
        <Setter Property="Template">
                <ControlTemplate TargetType="telerikChart:SeriesItemLabel">
                    <Canvas x:Name="PART_MainContainer">
                        <Path    Visibility="{TemplateBinding ConnectorVisibility}"
                           Style="{TemplateBinding ConnectorStyle}"
                           Stroke="{TemplateBinding Stroke}"
                           StrokeThickness="{TemplateBinding StrokeThickness}">
                                <PathGeometry >
                                        <PathFigure x:Name="PART_Connector">
                                                <PolyLineSegment />
                        <Grid >
                            <Grid.ColumnDefinitions >
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            <TextBlock Grid.Column="0" Text="{Binding DataItem.XVal}" Foreground="Black" />
                            <TextBlock Grid.Column="1" Text="{Binding DataItem.YVal}" Foreground="Black" />
                            <Rectangle Fill="LightBlue" Opacity=".3" Grid.ColumnSpan="2"/>
                            <Border x:Name="PART_TextContainer" BorderBrush="Black" Grid.ColumnSpan="2" CornerRadius="2" BorderThickness="1" Style="{TemplateBinding LabelStyle}">

    RadChart1.DefaultSeriesDefinition.SeriesItemLabelStyle = this.Resources["PieLabelStyle"] as Style;

    This way the connectors should be displayed correctly. Hope this helps.

    Best wishes,
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top