keth Posted October 7, 2009 Share Posted October 7, 2009 Hi,In my Current project i need to create a Line Graph. i am using Jasper 3.5.But the problem is i can not number my Y Axis continuously. after i define min and max values for Y axisit shows only the range of values instead of continous numbering though the Axis.(it shows 0,5,10,15 instead of 1,2,3,4,5,6,7,8...etc).Can any one help me to solve this? Can we use chart customizer to solve this? any help greatly appreciate Thanks,Keth Link to comment Share on other sites More sharing options...
dgrove Posted October 8, 2009 Share Posted October 8, 2009 I am also interested in the answer to this question.I am encountering the same issue. Thanks,D GrovePost Edited by dgrove at 10/08/2009 13:23 Link to comment Share on other sites More sharing options...
mdahlman Posted October 8, 2009 Share Posted October 8, 2009 Keth, JFreeChart has an algorithm to decide how many labels to show. Normally it's quite good, but in this case you want to override it. A chart customizer can definitely solve this. Likewise, a chart theme could solve it (since a chart theme is like a chart customizer but newer and more powerful). But the details aren't so easy to supply. It will require Java coding and knowledge of the JFreeChart API. There is a chart theme example that ships with JasperReports. There is a chart customizer example that is included with the sample reports in JasperServer Pro. These are good starting points. Regards,Matt Link to comment Share on other sites More sharing options...
keth Posted October 8, 2009 Author Share Posted October 8, 2009 Hi Matt,Thanks for the reply. i was able to solve the problem. i posting it here so others can refer it public class LineChartCustomizer extends JRAbstractChartCustomizer { public void customize(JFreeChart chart, JRChart jasperChart) { LineAndShapeRenderer renderer = (LineAndShapeRenderer) chart.getCategoryPlot().getRenderer(); renderer.setSeriesPaint(1, Color.green); renderer.setSeriesPaint(4, Color.orange); // get a reference to the plot for further customisation... final CategoryPlot plot = chart.getCategoryPlot(); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setTickUnit(new NumberTickUnit(1)); rangeAxis.setUpperBound(24); chart.setTitle("Setting the title "); } } Your blog post post was very helpful for achive this. Thanksketh Link to comment Share on other sites More sharing options...
dgrove Posted October 8, 2009 Share Posted October 8, 2009 Hello,Thank you for the replies.Keth, how and where did you apply that change ?I have checked through various files but cannot find where to put/modify this information. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now