Jump to content

Axis Replacement With ChartCustomizer


jzeitler

Recommended Posts

I have a requirement that users are to be able to select whether or not the range axis of a plot is to be displayed in linear or logarithmic scale.  To this end I have created a chart customizer as detailed below.  When it comes time to retrieve the pages from the filled JasperPrint object (to append to a full report, for example), however, the application hangs with no errors and starts chewing through all available memory.

It's notable that if I don't make any changes to the LogAxis object created, the page renders quickly without hanging, but the range axis is blank.  This leads me to believe I'm doing something wrong with setting up the LogAxis object or setting it into the Plot object.  What, if anything, is the cause and what can I do to solve this?  More importantly, if this is going to be part of a MultiAxisPlot, is there anything else I need to be aware of?

Code:
public class LogChartCustomizer extends JRAbstractChartCustomizer {@Overridepublic void customize(JFreeChart jFreeChart, JRChart jasperChart) {  CategoryPlot thePlot = (CategoryPlot) jFreeChart.getPlot();  NumberAxis theNumberAxis = (NumberAxis) thePlot.getRangeAxis(0);  LogAxis theLogAxis = new LogAxis();  theLogAxis.setRange(theNumberAxis.getRange());  theLogAxis.setLabel(theNumberAxis.getLabel());  thePlot.setRangeAxis(0, theLogAxis);}}
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

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