bluecool_2003 Posted March 24, 2011 Share Posted March 24, 2011 hello, i am currently using ireport 3.0 and i am created a XY Line chart type.I have 2 fields lets said $F{DATE} and $F{SALES}. The $F{DATE} i put under X axis and the $F{SALES} i put under Y axis.When i view the report it give me value under X axis (date) under integer value and 0.25 interval(1 ; 1.25; 1.5 ; 1.75; 2; 2.25, 2.5, 2.75, 3, ....) like picture2.I need the report to show me the date in integer for ex 1, 2, 3, ... for the date in X axis like picture 1. Anyone know how to set the value for the X axis? how to change the interval value? Thank you... Post Edited by bluecool_2003 at 03/24/2011 07:33 Link to comment Share on other sites More sharing options...
jpauze Posted April 15, 2011 Share Posted April 15, 2011 If i recall the default ranges used are based on the actual data in the dataset so if you want to adjust the chart axis limits for min and max those should be available as part of the chart properties, I think they are called range and domain and you can set the min and the max values. Also, there is a chart property which you can add net.sf.jasperreports.chart.range.axis.tick.interval = value This will control the interval to step up from min to max, for instance, min 0 max 2, interval .1 which will go 0., .1, .2, .3 etc up to max 2 Hope this helped. Link to comment Share on other sites More sharing options...
mdahlman Posted April 19, 2011 Share Posted April 19, 2011 Interesting timing.If you know that your axis will only run to 3, then jpauze's suggestion is by far the simplest. Set the tick interval to 1 and you're all set.On the other hand, if your chart has the potential to go to a much higher value, then that doesn't work as nicely. In that case you'll need a chart customizer. I posted a sample chart customizer that does that forces the ticks to be integers (for the range axis) in this article. It still keeps the flexibility to dynamically set the tick values, so it handles large values as well as small ones.I had only considered bar charts and line charts, so I didn't do anything for the domain axis in XY charts. All of the same concepts will apply, but you wouldn't be able to use my chart customizer unmodified in this case.Good luck,Matt Link to comment Share on other sites More sharing options...
jpauze Posted April 20, 2011 Share Posted April 20, 2011 Chart customizers ROCK!!! I have used them for doing to customizatization to all kinds of things. I wish I would have checked out this forum first thought, had to figure it out myself and having your article would have saved me a bunch of time... 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