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

Can RadPieChart DoughnutSeries labels show raw values rather than percentages?

4 Answers 178 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 22 Oct 2019, 08:02 PM

Hello,

I've been playing around the the LabelFormat property of the DoughnutSeries and it seems like I can only express label data as a percentage:

 

 

4 Answers, 1 is accepted

Sort by
0
Thomas
Top achievements
Rank 1
answered on 22 Oct 2019, 08:06 PM
<telerik:RadPieChart Grid.Row="1" Background="{x:Null}" Palette="{StaticResource customPalette}" x:Name="chartViewHostStatus" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                        <telerik:RadPieChart.Series>
                        <telerik:DoughnutSeries ShowLabels="True" ItemsSource="{Binding StatusCount}" LabelFormat="n" ValueBinding="Quantity">
                            <telerik:DoughnutSeries.LegendSettings>
                                    <telerik:DataPointLegendSettings TitleBinding="Title"/>
                                </telerik:DoughnutSeries.LegendSettings>                       
                        </telerik:DoughnutSeries>
                        </telerik:RadPieChart.Series>

 

The above code yields something like the attached image. In this example, I was hoping to have 3 slices, one with a label of 4 making up 100% of the chart, and two with a label of 0 each accounting for 0% of the chart (in this example, with the present bound data).

Is it possible to do something like that?

 

Thanks,

Tom

 

 

0
Thomas
Top achievements
Rank 1
answered on 22 Oct 2019, 08:16 PM
public ChartDataPoint(string title, int quantity, HostState state)
        {
            Title = title;
            Quantity = quantity;
            State = state;
        }     
0
Thomas
Top achievements
Rank 1
answered on 22 Oct 2019, 08:19 PM
The bound StatusCount is simply a collection of type ChartDataPoint. There are always 3 of them, one for each "State", but it is often expected that one or two of the data points will have a quantity of 0. In this sense a label representing the quantity of the most common state is more useful than a value of 1.00 or 100%.
0
Martin Ivanov
Telerik team
answered on 25 Oct 2019, 02:07 PM

Hello Thomas,

To achieve your requirement, you can use the label definition feature of RadChartView. To do this, add a new instance of the ChartSeriesLabelDefinition class in the LabelDefinitions collection of the series. The ChartSeriesLabelDefinition allows you to set the label format via the Format property or the customize the label entirely by setting the Template property. Read more about this in the Label Definition article.

I hope that helps.

Regards,
Martin Ivanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Chart
Asked by
Thomas
Top achievements
Rank 1
Answers by
Thomas
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or