Hi, All!
I'm working with JasperReports and trying to produce some JFreeChart-based TimeSeries graphs with controlled Max and Min Range Axis values. So if data units are in percents then Min would be 0 and Max would 100. Rest of data should have initial auto-scaling.
What is working fine in designer - for TimeSeriesPlot I'm setting <rangeAxisMinValueExpression> to "$F{units}.equals("%") ? 0 : null" and <rangeAxisMinValueExpression> to "$F{units}.equals("%") ? 100 : null"
I get the desired result in Designer 5.6.0, but then I'm uploading this to JasperReports Server I got an error:
Errors were encountered when compiling report expressions class file: 1. Incompatible conditional operand types int and null value
((java.lang.String)field_units.getValue()).equals("%") ? 0 : null; //$JR_EXPR_ID=30$
2. Incompatible conditional operand types int and null value = ((java.lang.String)field_units.getValue()).equals("%") ? 100 : null; //$JR_EXPR_ID=31$
That is logical, but how to set that value to "nothing" then, please?
Setting Range Min and Max values on condition
-
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 pm
Re: Setting Range Min and Max values on condition
I do not know Jasper reports, but the best solution would be to skip that section if a special condition is met.
Re: Setting Range Min and Max values on condition
I can't skip required chart
I think question is JFreeCharts specific, what condition expression would work for Range Min and Max fields? by default those fields are unpopulated, means null or not set or?
Since int type is used there - what would be proper value?
I think question is JFreeCharts specific, what condition expression would work for Range Min and Max fields? by default those fields are unpopulated, means null or not set or?
Since int type is used there - what would be proper value?
-
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 pm
Re: Setting Range Min and Max values on condition
A ValueAxis always has a non-null value range. The upper and lower limit of this can either be set manually, or can be determined automatically based on the range of the dataset. If the values are set manually, the "auto range calculation mechanism" might be deactivated.
What I meant was if you do not have to set the ranges to a specific value, then do not set the ranges at all. To achieve that, you would need a way to check whether the section in your XML should be evaluated or not. I can't advise on how that could be achieved, because I do not know Jasper reports. Maybe you can ask in a Jasper forum.
What I meant was if you do not have to set the ranges to a specific value, then do not set the ranges at all. To achieve that, you would need a way to check whether the section in your XML should be evaluated or not. I can't advise on how that could be achieved, because I do not know Jasper reports. Maybe you can ask in a Jasper forum.