In this topic I am going to show you how to achieve the following custom formatting of data labels in a pie chart using Jaspersoft Studio.

1) How to Show Data Labels.

2) How to Show % Values using Jaspersoft Studio.

3) How to display % value using a Customizer

4) How to display the Labels within the slice using a Customizer

 

How to Show Data Labels.

In Jaspersoft Studio Default data labels can be enabled or disabled by the option “Chart Plot” under Chart Properties (As shown Below)

Show Labels (www.rajeshsirsikar.com)

This will enable only the default Data Labels provided as part of the Chart Theme in JasperSoft Studio.

How to Show % Values using Jaspersoft Studio.

If we want to have a completely different set of Data Labels (Ex : % Value in a pie Chart which is not present in the Default Theme) then we need to follow the below mentioned steps to achieve the same

Default Theme would give the Pie Chart as follows (Without % Value and the Data Labels are outside the slice)

Pie Chart (www.rajeshsirsikar.com)

If we use {2} as the Label Format we can Display % Value instead of the Label as Follows

a)      Label Format is empty and Hence the report display will be as below

Pie Chart1( www.rajeshsirsikar.com)

b)      Label Format is {2} and then the % Value Shows up

Pie Chart2( www.rajeshsirsikar.com)

c)      If we use the Label format as {0}{2} Then both Label and % Will show up

Pie Chart3( www.rajeshsirsikar.com)

By following these steps , we can modify the data display on the Data Labels of teh Pie Chart.

We can just use {0} to show the Data Key

{1} to show the Data Label

{2} to show the % Value

and we can use the Combination of these Three for different set of Customization to these data Labels.

If we want to show the % Values of the Pie Slices inside the Pie Chart, then we need to use Customizer Class to achieve the same. I will discuss Customizer Class, Its Implementation and Use in my next post. I will also explain how to display the Pie Chart Data Labels inside the Slice.