Change Pie Chart Series Item Label Background

10 posts, 1 answers
  1. Vinnie Petre
    Vinnie Petre avatar
    5 posts
    Member since:
    Jul 2012

    Posted 16 Sep 2010 Link to this post


    I'd like to change the background color on the series item labels for a pie chart.  What's the best way of doing this?  I want it to be a different color than the pie slice.

  2. Answer
    Bartholomeo Rocca
    Bartholomeo Rocca avatar
    247 posts
    Member since:
    May 2006

    Posted 17 Sep 2010 Link to this post

    Hello Vinnie,

    You need to set custom label style to achieve the desired effect -- check this demo here: (it sets the background to transparent but you can use the same approach to customize it the way you want).

  3. Vinnie Petre
    Vinnie Petre avatar
    5 posts
    Member since:
    Jul 2012

    Posted 17 Sep 2010 Link to this post

    Thanks.  I had been trying to set the Background like so (same everything else as the sample you'd pointed me to), but this wasn't having any result:

    <Style x:Key="CustomLabelStyle" TargetType="telerik:SeriesItemLabel">
        <Setter Property="Background" Value="White" />

    So it looks like providing a new ControlTemplate is the only way?
  4. Sia
    Sia avatar
    685 posts

    Posted 22 Sep 2010 Link to this post

    Hello Vinnie Petre,

    Yes, you need to provide a new ControlTemplate in order to change the labels' background.

    You can also use CreateItemStyle delegate. The following blog topic concerns this approach also.

    Hope this helps,
    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
  5. rajkiran
    rajkiran avatar
    2 posts
    Member since:
    Dec 2010

    Posted 15 Dec 2010 Link to this post

    This link not working. Can you help me out setting Item Label Background to transparent, Iam trying the following code, iam able to chage foreground text color but not background color.

    Style style = new Style(typeof(SeriesItemLabel));
                            style.Setters.Add(new Setter(Control.ForegroundProperty, "Black"));
                            style.Setters.Add(new Setter(Control.BackgroundProperty, "White"));
    sm.SeriesDefinition.SeriesItemLabelStyle =  style;

  6. Sia
    Sia avatar
    685 posts

    Posted 16 Dec 2010 Link to this post

    Hi rajkiran,

    The mentioned example was removed from our demos section and that is why you cannot open it. Please check the following example where you can see the same approach showing how to remove the background of your labels.

    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  7. Siddhartha
    Siddhartha avatar
    2 posts
    Member since:
    Dec 2011

    Posted 07 Dec 2011 Link to this post


    I tried using the concept from the given code.

     <Style x:Key="CustomStyle" TargetType="charting:Bar">
                    <Setter Property="Template">
                            <ControlTemplate TargetType="charting:Bar">
                                    <Rectangle x:Name="PART_DefiningGeometry" 
                                       Height="{TemplateBinding ItemActualHeight}"
                                       Width="{TemplateBinding ItemActualWidth}"
                                       Fill="{Binding DataItem.PopulationColor}" />
                                        <ScaleTransform x:Name="PART_AnimationTransform" ScaleY="0" />

    and called it in the following code:

    <chart:RadChart x:Name="chartCarDwell" Grid.Column="0" Grid.Row="1" telerik:StyleManager.Theme="Transparent" Margin="0, 25, 0, 0">
                    <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                        <GradientStop Color="#FF367fb6" Offset="0" />
                        <GradientStop Color="#FF095791" Offset="1" />
                    <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                        <GradientStop Color="#FFa11616" Offset="0" />
                            <!--<GradientStop Color="Crimson" Offset="0" />-->
                            <GradientStop Color="#FF720000" Offset="1" />
                    <charting:SeriesMapping LegendLabel="Car Dwell">
                                <charting:BarSeriesDefinition ShowItemLabels="True" ShowItemToolTips="True" ItemStyle="{StaticResource CustomStyle}">
                                        <charting:BarLabelSettings LabelDisplayMode="MidPoint" Distance="0" />

                        <charting:ItemMapping DataPointMember="YValue" FieldName="AverageDwell"  />
                        <charting:ItemMapping DataPointMember="XCategory" FieldName="ExtendedDay" />

                            <charting:ChartLegend Visibility="Collapsed" />
                            <charting:ChartArea ItemClick="ChartArea_ItemClick"/>


    Still I am getting the default location of the seriesitemlabels within the blocks of color same as the bars.
    Please help me!

  8. Sia
    Sia avatar
    685 posts

    Posted 12 Dec 2011 Link to this post

    Hello Siddhartha,

    Please try the following Style which needs to be applied as SeriesItemLabelStyle:
    <Style x:Key="CustomLabels" TargetType="telerikCharting:SeriesItemLabel">
        <Setter Property="Fill" Value="Transparent"/>
        <Setter Property="Foreground" Value="Black"/>
        <Setter Property="LabelStyle">
                <Style TargetType="Border">
                    <Setter Property="BorderThickness" Value="0"/>

    All the best,
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  9. Vijay
    Vijay avatar
    16 posts
    Member since:
    Apr 2011

    Posted 12 Feb 2013 Link to this post

    Hi I did Everything you said i am able to change the color of the text but still the background is not changing .

    Here is the code

    Style style = new Style(typeof(SeriesItemLabel));
                 style.Setters.Add(new Setter(Shape.FillProperty, new SolidColorBrush(Colors.Transparent)));
                 style.Setters.Add(new Setter(Control.ForegroundProperty, new SolidColorBrush(Colors.Black)));
                var boarderStyle= new Style(typeof(Border));
                boarderStyle.Setters.Add(new Setter(Control.BorderThicknessProperty,0));
                style.Setters.Add(new Setter(SeriesItemLabel.LabelStyleProperty ,boarderStyle));

    I created the style and applied to my series definition

                definition.SeriesItemLabelStyle = style;
    But the back ground is not transparent .

    Please help
  10. Evgenia
    Evgenia avatar
    1437 posts

    Posted 15 Feb 2013 Link to this post

    Hello Vijay,

     Can you please try the SeriesItemLabel style provided in this help topic? Everything should work as expected with it.

    Kind regards,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top