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

Pie chart with Total value in legend

1 Answer 639 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Su
Top achievements
Rank 1
Su asked on 22 Jul 2020, 03:07 PM

Hi,

I am creating the Pie chart and I would like to show additional value, percentage and total in legend.

I tried to add the value and percentage in the label expression in Legend Item Value property as a string. But the value fields are not able to Right align.

How to add the total field in legend and how to format the label field in legend.

Any help will be highly appreciated.

 

Thanks.

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 27 Jul 2020, 12:14 PM

Hello Su,

Because we don't provide an option to display a total in the legend out of the box, I would suggest the following workaround:

1. I created a report with CSV DataSource which looks as follows:

Item,Value
Item1,42
Item2,12
Item3,32
Item,0

We will use the last item with value 0 to display the total.

2) Add a report parameter whose value will be the total of all values:

3) Add the Pie chart.

4) Click on the barSeries and expand the LegendItem.

5) Set the MarkConditionalFormatting property as follows:

Expression: =Fields.Value

Operator: =

Value: =0

Then the Style: Layout -> unmark Visible

We do this to remove the color of the box in the legend of the empty item;

6) Set the Value property of the LegendItem

= IIF (Fields.Item = "Item", "Total is " + Parameters.TotalParameter.Value, Fields.Item)

Please, check the attached report and let me know if it satisfies your needs.

Regards,
Neli
Progress Telerik

Tags
Report Designer (standalone)
Asked by
Su
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or