svenn Posted June 26, 2007 Share Posted June 26, 2007 Is there a way to add a label to the horizontal axis of a bar chart? You can use the "Value access label expression" to add one to the vertical axis but I cannot see the equivalent on the horizontal axis. For example my chart displays “Total distance†on the vertical axis and I want to display “Vehicle name†under all my vehicle points on the horizontal axis. Link to comment Share on other sites More sharing options...
jmurray Posted June 27, 2007 Share Posted June 27, 2007 In your Chart Properties - Data you have four items that you can set: Series Expression: set to "1" if you only have one data series, otherwise set to a series value (eg. $F{SalesPerson} ) Category Expression: the base value grouping (eg. $F{Month} ). These values are displayed on the category axis. It's a good thing to also set the "Category Axis Label Font" and "Category Axis Tick Label Font" chart properties. I use values of Arial 10 and Arial 5 respectively. Value Expression: the individual values (eg $F{SalesAmount} ). These values are displayed on the value axis. It's a good thing to also set the "Value Axis Label Font" and "Value Axis Tick Label Font" chart properties. I use values of Arial 10 and Arial 5 respectively. Label Expression: The text to display at the end of each bar (eg. new java.lang.Integer(new java.lang.Double($F{SalesAmount}.doubleValue()/1000000).intValue()).toString() + "M" will display sales amounts as millions). Labels are not displayed unless the "Show Labels" chart property is set to true. Also note that there appears to be an issue with the Category Series dialog box. It doesn't seem to update changes all the time. It's often simpler to edit the xml source. Link to comment Share on other sites More sharing options...
kelly Posted June 30, 2007 Share Posted June 30, 2007 i'm looking for the pattern forthe date format inside of the chart. i want the category expession to be date, but it will show "2007-06-28 00:00:00.0".that is too long for me, so that's why i want to change the format.http://www.jfree.org/jfreechart/images/DualAxisDemo1.pnglike the "category" on this chart. the best is to be diagonal, so it can show the whole date. i have no idea how to do it...any help? Link to comment Share on other sites More sharing options...
jmurray Posted July 2, 2007 Share Posted July 2, 2007 Kelly, this should be opened in a new thread. The simple answer is to use simpledateformat: new SimpleDateFormat("dd/MM/yyyy").format($F{yourdatefield}) or preformat the date as a string in your source query like this oracle example: select to_char(myDateField,'DD/MM/YYYY') as formattedDate ....Post edited by: jmurray, at: 2007/07/01 22:07 Link to comment Share on other sites More sharing options...
kelly Posted July 2, 2007 Share Posted July 2, 2007 jmurray, thank you very much! it looks very nice now. thanks a lot.Post edited by: kelly, at: 2007/07/02 19:18 Link to comment Share on other sites More sharing options...
kelly Posted July 10, 2007 Share Posted July 10, 2007 Hi, now i have a problem with crosstab. i'm using iReport.i can make a crosstab no problem, but it only show the result when there is only one record. if there are more than one record, it will show:Error filling print... Error incrementing crosstab datasetnet.sf.jasperreports.engine.JRRuntimeException: Error incrementing crosstab dataset at net.sf.jasperreports.engine.fill.JRFillCrosstab$JRFillCrosstabDataset.customIncrement(JRFillCrosstab.java:671) at net.sf.jasperreports.engine.fill.JRFillElementDataset.increment(JRFillElementDataset.java:169) at net.sf.jasperreports.engine.fill.JRCalculator.calculateVariables(JRCalculator.java:152) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:652) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:252) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:117) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:763) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:669) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:63) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:234) at it.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:942) at java.lang.Thread.run(Unknown Source) Caused by: net.sf.jasperreports.engine.JRException: Crosstab data has already been processed. at net.sf.jasperreports.crosstabs.fill.calculation.BucketingService.addData(BucketingService.java:295) at net.sf.jasperreports.engine.fill.JRFillCrosstab$JRFillCrosstabDataset.customIncrement(JRFillCrosstab.java:667) ... 12 more Print was not filled. Try using an EmptyDataSource... do you why this happened?thanks a lot.Post edited by: kelly, at: 2007/07/09 19:06 Link to comment Share on other sites More sharing options...
kelly Posted July 10, 2007 Share Posted July 10, 2007 Hi, now i have a problem with crosstab. i'm using iReport.i can make a crosstab no problem, but it only show the result when there is only one record. if there are more than one record, it will show:"Error filling print... Error incrementing crosstab dataset""Caused by: net.sf.jasperreports.engine.JRException: Crosstab data has already been processed. at net.sf.jasperreports.corsstabs.fill.calculation.BucketingService.addData(BucketingService.java:295).....Print was not filled." do you why this happened?thanks a lot. 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