How to change Pie or Doughnut Chart Font Size!?

2 posts, 0 answers
  1. Minseok Bang
    Minseok Bang avatar
    19 posts
    Member since:
    Oct 2009

    Posted 19 Nov 2009 Link to this post

    I make Style
    <Style x:Key="DoughnutStyle1" TargetType="telerikCharting:Doughnut">
       <Setter Property="Foreground" Value="{StaticResource SeriesItemLabelForeground}"/>
       <Setter Property="FontSize" Value="{StaticResource SeriesItemLabelFontSize}"/> --> I want to change code like : Value="8"
       <Setter Property="Template">
        <Setter.Value>
         <ControlTemplate TargetType="telerikCharting:Doughnut">
          <Canvas>
                               
           <Canvas.RenderTransform>
            <ScaleTransform x:Name="PART_AnimationTransform" ScaleX="0" ScaleY="0"/>
           </Canvas.RenderTransform>
                               
           <Path x:Name="PART_DefiningGeometry" StrokeThickness="{StaticResource RadialItemStrokeThickness}"
                                      Style="{TemplateBinding ItemStyle}" Data="{TemplateBinding FigurePath2}"/>
                               
           <Ellipse Fill="{StaticResource DoughnutMaskBrush}" Height="{TemplateBinding ItemActualHeight}"
                                         Width="{TemplateBinding ItemActualWidth}" Clip="{TemplateBinding FigurePath3}"/>
                               
           <telerikCharting:SeriesItemLabel x:Name="PART_SeriesItemLabel"
                                                                 Style="{TemplateBinding SeriesItemLabelStyle}"
                                                                 Visibility="{TemplateBinding SeriesItemLabelVisibility}"
                                                                 Content="{TemplateBinding SeriesItemLabelText}"/>
          </Canvas>
         </ControlTemplate>
        </Setter.Value>
       </Setter>
      </Style>

    and Style apply to RadChart Like bellow
     <Grid x:Name="LayoutRoot">
            <StackPanel>
                <telerikChart:RadChart x:Name="RadChart1"  Style="{StaticResource DoughnutStyle1}">
                </telerikChart:RadChart>
            </StackPanel>
        </Grid>

    I Have Question in here,
    implement above source code, error occured. because Style is not matched Radchart.
    So I change Code in xaml Like this

    <Grid x:Name="LayoutRoot">
            <StackPanel>
                <telerikChart:RadChart  >
                   <telerikCharting:Doughnut x:Name="doChart" Style="{StaticResource DoughnutStyle1}"/>  -->
                </telerikChart:RadChart>
            </StackPanel>
        </Grid>
    this code Error too.

    So I had Changed Code
    <Grid x:Name="LayoutRoot">
            <StackPanel>
               <telerikCharting:Doughnut x:Name="doChart" Style="{StaticResource DoughnutStyle1}"/>  
            </StackPanel>
        </Grid>
    Error Too.

    What Can I do?!
    Please Help T.T

    p.s I have Bug report.
    If Many LineSeries is on One Chart, All of Theme expcept Office_Black is not Show Line Series!!! TooltipChart Too.
    frankly speaking Office_Black Theme is not pretty. I want Windows7 Theme.


  2. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 25 Nov 2009 Link to this post

    Hello Minseok Bang,

    The easiest way to achieve the desired effect would be like this:

    XAML
    <UserControl x:Class="SilverlightApplication1.MainPage"
        xmlns:control="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Charting"
        xmlns:chart="clr-namespace:Telerik.Windows.Controls.Charting;assembly=Telerik.Windows.Controls.Charting"
        xmlns:mscorlib="clr-namespace:System;assembly=mscorlib"
     
        <Grid x:Name="LayoutRoot">
            <Grid.Resources>
                <Style x:Name="CustomLabelStyle" TargetType="chart:SeriesItemLabel">
                    <Setter Property="FontSize" Value="30" />
                </Style>
            </Grid.Resources>
     
            <control:RadChart x:Name="RadChart1" />
     
        </Grid>
     
    </UserControl>

    C#
    RadChart1.DefaultSeriesDefinition = new PieSeriesDefinition() { SeriesItemLabelStyle = this.CustomLabelStyle };
    RadChart1.ItemsSource = new int[] { 1, 2, 3, 4 };


    As for the line series -- we are unable to reproduce the problem in our local tests. Make sure you have added reference to the Telerik.Windows.Themes.Windows7.dll in order to apply the theme correctly.


    Regards,
    Manuel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top