mkhan523 Posted March 7, 2011 Share Posted March 7, 2011 Can anyone please tell me how to reduce the space between two series of a bar chart........ I have two series in my bar chart......... i dont wnt any space between them.......... Just check out the attachment to know the exact requirement Link to comment Share on other sites More sharing options...
szaharia Posted March 7, 2011 Share Posted March 7, 2011 Hi,Use a chart customizer.Hope this helps,sandaCode:public void customize(JFreeChart chart, JRChart jasperChart){ CategoryPlot categoryPlot = (CategoryPlot)chart.getPlot(); categoryPlot.getDomainAxis().setCategoryMargin(0);} Link to comment Share on other sites More sharing options...
mkhan523 Posted March 8, 2011 Author Share Posted March 8, 2011 Thanks Sanda for you help..............But i am facing a little problem.........this is the chart customizer i am usingimport net.sf.jasperreports.engine.JRChart;import net.sf.jasperreports.engine.JRChartCustomizer;import org.jfree.chart.JFreeChart;import org.jfree.chart.plot.CategoryPlot;public class BarChartCustomizer implements JRChartCustomizer{ public void customize(JFreeChart chart, JRChart jasperChart) { CategoryPlot categoryPlot = (CategoryPlot)chart.getPlot(); categoryPlot.getDomainAxis().setCategoryMargin(0); }}But the problem here is the space between two different category axis values is set to zero......... not... the distance between two series..............PLEASE CHECK OUT THE IMAGE ATTACHED...... Link to comment Share on other sites More sharing options...
szaharia Posted March 8, 2011 Share Posted March 8, 2011 Hi,The other possibility is to remove space between series in a category (you could change BarRenderer with BarRenderer3D if necessary):BarRenderer renderer = (BarRenderer)categoryPlot.getRenderer();renderer.setItemMargin(0d);If this doesn't work, I've no more clues. But you could find by yourself a better solution in JFreeChart library, like I suggested in another post.Best regards,sanda Link to comment Share on other sites More sharing options...
mkhan523 Posted March 8, 2011 Author Share Posted March 8, 2011 Thanks Sanda....... Thank you so so so much.......... it Works:):):) One more doubt.......... i am using printwhenExpression tag in my reports..... its working fine in ireports but raising an exception when m compiling it manually using java class....... this is the expression: <printWhenExpression><![CDATA[(($F{participantName}!=null)?$V{CommitteeGroup_COUNT}:0)!=0]]></printWhenExpression> where particpant name is a field <field name="participantName" class="java.lang.String"> <fieldDescription><![CDATA[participantName]]></fieldDescription> </field> this is the exception........ 1. Incompatible conditional operand types Integer and int value = (java.lang.Boolean)(((((java.lang.String)field_participantName.getValue())!=null)?((java.lang.Integer)variable_CommitteeGroup_COUNT.getValue()):0)!=0); //$JR_EXPR_ID=13$ <----------------------------------------------------------------------------------------------------------------------------> 2. Incompatible conditional operand types Integer and int value = (java.lang.Boolean)(((((java.lang.String)field_participantName.getValue())!=null)?((java.lang.Integer)variable_CommitteeGroup_COUNT.getValue()):0)!=0); //$JR_EXPR_ID=14$ <----------------------------------------------------------------------------------------------------------------------------> 3. Incompatible conditional operand types Integer and int value = (java.lang.Boolean)(((((java.lang.String)field_participantName.getValue())!=null)?((java.lang.Integer)variable_CommitteeGroup_COUNT.getValue()):0)==0); //$JR_EXPR_ID=25$ <----------------------------------------------------------------------------------------------------------------------------> 4. Incompatible conditional operand types Integer and int value = (java.lang.Boolean)(((((java.lang.String)field_participantName.getOldValue())!=null)?((java.lang.Integer)variable_CommitteeGroup_COUNT.getOldValue()):0)!=0); //$JR_EXPR_ID=13$ <----------------------------------------------------------------------------------------------------------------------------------> 5. Incompatible conditional operand types Integer and int value = (java.lang.Boolean)(((((java.lang.String)field_participantName.getOldValue())!=null)?((java.lang.Integer)variable_CommitteeGroup_COUNT.getOldValue()):0)!=0); //$JR_EXPR_ID=14$ <----------------------------------------------------------------------------------------------------------------------------------> 6. Incompatible conditional operand types Integer and int value = (java.lang.Boolean)(((((java.lang.String)field_participantName.getOldValue())!=null)?((java.lang.Integer)variable_CommitteeGroup_COUNT.getOldValue()):0)==0); //$JR_EXPR_ID=25$ <----------------------------------------------------------------------------------------------------------------------------------> 7. Incompatible conditional operand types Integer and int value = (java.lang.Boolean)(((((java.lang.String)field_participantName.getValue())!=null)?((java.lang.Integer)variable_CommitteeGroup_COUNT.getEstimatedValue()):0)!=0); //$JR_EXPR_ID=13$ <-------------------------------------------------------------------------------------------------------------------------------------> 8. Incompatible conditional operand types Integer and int value = (java.lang.Boolean)(((((java.lang.String)field_participantName.getValue())!=null)?((java.lang.Integer)variable_CommitteeGroup_COUNT.getEstimatedValue()):0)!=0); //$JR_EXPR_ID=14$ <-------------------------------------------------------------------------------------------------------------------------------------> 9. Incompatible conditional operand types Integer and int value = (java.lang.Boolean)(((((java.lang.String)field_participantName.getValue())!=null)?((java.lang.Integer)variable_CommitteeGroup_COUNT.getEstimatedValue()):0)==0); //$JR_EXPR_ID=25$ Link to comment Share on other sites More sharing options...
szaharia Posted March 8, 2011 Share Posted March 8, 2011 Probably you are compiling the report using jdk 1.4 or earlier. To see which java version is used, type java -version in a command line.In jdk 1.4 or earlier, Integer and int are incompatible types, so you have to call the intValue() method on all your Integer fields, parameters and/or variables.Hope this helps,sandaPost Edited by shertage at 03/08/2011 12:50 Link to comment Share on other sites More sharing options...
mkhan523 Posted March 9, 2011 Author Share Posted March 9, 2011 M Using JDK 1.5.0.......... But still facing the same problem:(:(: Link to comment Share on other sites More sharing options...
szaharia Posted March 9, 2011 Share Posted March 9, 2011 Hi,This kind of errors still remain related to an older java compiler existing in the classpath. There are multiple ways to manually compile a report. Did you compiled it in Eclipse? Did you compiled it from scratch in a command line? Or did you use an ant build file?If you used compiling tools (ant or Eclipse), make sure that the compiler compliance level is set to 1.5.Also check if the JAVA_HOME env variable, if exists, is pointing to jdk 1.5.Hope this helps,sanda Link to comment Share on other sites More sharing options...
mkhan523 Posted March 10, 2011 Author Share Posted March 10, 2011 Hi Sanda, Thanks for your Help......... I changed the condition ....... m using Boolean.FALSE instead of 0 and its working fine............ Thanks :):):) 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