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

How to change the format of pie chart labels

4 Answers 483 Views
Chart for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Robert
Top achievements
Rank 1
Robert asked on 26 Sep 2012, 06:54 PM
I have a pie chart and it displays correctly but the label font is very small. How do I change the formatting of a label? For example, change the font family, the font size, the color of the label, etc?



Robert

4 Answers, 1 is accepted

Sort by
0
Tsvyatko
Telerik team
answered on 27 Sep 2012, 07:58 AM
Hello Robert,

 You can control the label appearance though label definitions default visual style. For e.g. to change the FontSize you can use this Xaml:

<telerik:PieSeries.LabelDefinitions>
    <telerik:ChartSeriesLabelDefinition>
        <telerik:ChartSeriesLabelDefinition.DefaultVisualStyle>
            <Style TargetType="TextBlock">
                <Setter Property="FontSize" Value="20"/>
            </Style>
        </telerik:ChartSeriesLabelDefinition.DefaultVisualStyle>
    </telerik:ChartSeriesLabelDefinition>
</telerik:PieSeries.LabelDefinitions>

Let us know if you have any further question regarding this functionality.Regards,
Tsvyatko
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Robert
Top achievements
Rank 1
answered on 27 Sep 2012, 04:17 PM
Hello Tsvyatko,



I tried that, but the labels are still the same small size. Here is my Xaml:

<telerik:RadPieChart x:Name="ExpensePieChart" Margin="50,0,0,0"

                     PaletteName="DefaultLight" Width="900" Height="500">

  <telerik:PieSeries ItemsSource="{Binding Source={StaticResource GroupedExpenseItemsViewSource}}">

    <telerik:PieSeries.ValueBinding>

       <telerik:PropertyNameDataPointBinding PropertyName="Amount"/>

     </telerik:PieSeries.ValueBinding>

     <telerik:PieSeries.LabelDefinitions>

       <telerik:ChartSeriesLabelDefinition Margin="-15" Strategy="{StaticResource Strategy}">

         <telerik:ChartSeriesLabelDefinition.DefaultVisualStyle>

           <Style TargetType="TextBlock">

             <Setter Property="FontSize" Value="48"/>

           </Style>

         </telerik:ChartSeriesLabelDefinition.DefaultVisualStyle>

       </telerik:ChartSeriesLabelDefinition>

     </telerik:PieSeries.LabelDefinitions>

   </telerik:PieSeries>

</telerik:RadPieChart>

0
Georgi
Telerik team
answered on 01 Oct 2012, 10:40 AM
Hi Robert,

Thanks for getting back to us.

If I remember correctly your custom label strategy provides an override for the DefaultVisual routine and it returns a new TextBlock instance that does not honor the DefaultVisualStyle specified. You can have only the Content strategy flag specified and leave the default visual creation to the underlying framework. Or you can assign the DefaultVisualStyle property to the TextBlock that the strategy creates.

I hope this helps. Let me know if you experience some other issues with the component.

Greetings,
Georgi
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Robert
Top achievements
Rank 1
answered on 01 Oct 2012, 07:45 PM
Georgi,



That helps. Now the pie chart looks like I want.



Thanks!



Robert
Tags
Chart for XAML
Asked by
Robert
Top achievements
Rank 1
Answers by
Tsvyatko
Telerik team
Robert
Top achievements
Rank 1
Georgi
Telerik team
Share this question
or