Jump to content

How to display two decimal values in percentage of a normal pie chart


sct999.1

Recommended Posts

I already implemented the chart customizer suggested in this question: http://community.jaspersoft.com/questions/539659/how-show-percentage-decimal-value-pie-chart

I adapted it to use a normal pie chart:
 

import net.sf.jasperreports.engine.JRChart;import net.sf.jasperreports.engine.JRChartCustomizer;import org.jfree.chart.JFreeChart;import org.jfree.chart.labels.StandardPieSectionLabelGenerator;import org.jfree.chart.plot.PiePlot;public class PiePercentageCustomizer implements JRChartCustomizer{    @Override    public void customize(JFreeChart jFreeChart, JRChart jrChart) {        PiePlot piePlot = (PiePlot) jFreeChart.getPlot();        ((StandardPieSectionLabelGenerator)piePlot.getLabelGenerator()).getPercentFormat().setMaximumFractionDigits(2);    }    }[/code]

I generate a jar file and added it to my application classpath.

The problem is when I render my report I get the following exception:
 

Class
java.lang.ClassCastException
Message
net.sf.jasperreports.charts.util.PieLabelGenerator cannot be cast to org.jfree.chart.labels.StandardPieSectionLabelGenerator

My application is a grails 2.3.11 project using the jasper plugin 1.11.0

Any help will be appreciated
Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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...