Jump to content
Changes to the Jaspersoft community edition download ×

How to reduce width of Legend Box using customizer?


Recommended Posts

I am working on a jasper report which contains Pie chart. And the chart is occupying entire summary band. When I run this report the chart is compressed and legend box is taking almost more than half of the space.
 
Chart looks like as shown in the image:
 
report(3).PNG.60d01cc86e5c57739d6fced9fa239c8a.PNG
Here is my customizer java class:
 
    public class DocumentUploadPieChart implements JRChartCustomizer {
 
@Override
public void customize(JFreeChart chart, JRChart jasperChart) {
Plot plot1 = chart.getPlot();
if (plot1 instanceof PiePlot) {
PiePlot piePlot = (PiePlot) plot1;
            Font font = new Font("Calibri", Font.PLAIN, 11);
            piePlot.setLabelFont(font);
            piePlot.setCircular(Boolean.TRUE);
            piePlot.setLabelOutlinePaint(null);
            piePlot.setLabelShadowPaint(null);
            chart.getLegend().setBackgroundPaint(null);
            chart.getLegend().setWidth(30);
    chart.getLegend().setBorder(0.0, 0.0, 0.0, 0.0);
    piePlot.setShadowPaint(null);
   
}
 
}
    }
 
I tried to adjust width of legend but its still giving same output. Can someone please help me to resolve this issue?

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Posted Images

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...