2006 IR Open Dicussion Posted August 26, 2006 Share Posted August 26, 2006 By: Sergio22 - sergio22 x-axis labels  2006-01-11 05:00 Hi,ÂI have a bar chart with 48 bars on a landscape A4 page. Because of the many bars the x-axis labels are not readable anymore. Is there a way to rotate the labels by 90 degrees? By: Teodor Danciu - teodord RE: x-axis labels  2006-01-11 05:16 ÂHi,ÂÂThe JFreeChart library lets us rotate the itemÂlabels at an angle, but our chart component doesÂnot expose this setting.ÂÂSo you could solve your requirement by implementingÂthe chart customizer interface.ÂLook at the "charts" sample and see how one of the reports uses an extension of the JRAbstractChartCustomizer Âto change colors in a bar chart.ÂÂI hope this helps.ÂTeodor By: Sergio22 - sergio22 RE: x-axis labels  2006-01-11 07:49 Super thanks for you help the following modification helpedÂimport net.sf.jasperreports.engine.JRChartCustomizer;Âimport net.sf.jasperreports.engine.JRChartDataset;Âimport net.sf.jasperreports.engine.JRChartPlot;Âimport net.sf.jasperreports.engine.JRChart;Âimport org.jfree.chart.JFreeChart;Âimport org.jfree.chart.renderer.category.BarRenderer;Âimport org.jfree.chart.axis.CategoryLabelPositions;ÂÂimport java.awt.*;ÂÂpublic class BarChartCustomizer implements JRChartCustomizerÂ{ÂÂpublic void customize(JFreeChart chart, JRChart jasperChart)Â{ÂBarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer();Ârenderer.setSeriesPaint(0, Color.green);Ârenderer.setSeriesPaint(1, Color.orange);ÂÂchart.getCategoryPlot().getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_90);ÂSystem.out.println("getCategoryLabelPositionOffset : "+chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositionOffset());ÂSystem.out.println("getCategoryMargin : "+chart.getCategoryPlot().getDomainAxis().getCategoryMargin());ÂSystem.out.println("getLowerMargin : "+chart.getCategoryPlot().getDomainAxis().getLowerMargin());ÂSystem.out.println("getMaximumCategoryLabelLines : "+chart.getCategoryPlot().getDomainAxis().getMaximumCategoryLabelLines());ÂSystem.out.println("getMaximumCategoryLabelWidthRatio : "+chart.getCategoryPlot().getDomainAxis().getMaximumCategoryLabelWidthRatio());Â}Â} Link to comment Share on other sites More sharing options...
atanupanda Posted February 6, 2007 Share Posted February 6, 2007 HiThis is Atanu. I am very new in ireport and also in java environment. In the ireport I have designed a template .like this.please look on attach file size=150]C:Documents and SettingsAtanuMy Documentsgraph.jpegNow I want to plot a line graph on the basis of the each data like t1 t2 ---t5 and lcl, ucl, actual value for each row.That I have done. Now my problem is that I have to change the color of points of t1 t2 ---t5 on the basis of Lcl and Ucl . If the value of t1 ,or t2 or ----t5 are between Ucl and Lcl the color will be blue. And if it out side of Lcl and Ucl then it will be red..I want the following figure. Where the upper bold line is Ucl and lower bold line isLcl size=150]C:Documents and SettingsAtanuMy Documentsdata.jpeg Actually I have got a information that for that I have to write a customizer class for chart. Also I have write it . Code:Now this customize class ok running successfully with creating jar files.Now I want to create a logic to check the value of t1 t2 t3 t5 with respect to UCL and LCL. How can I fetch data from report.Or is there any other way to do this.Is there any way to pass value from iReport to customizer class ? What should I do. Please please help me. It’s urget for me. Any help would be greatly appreciated. Thanks in advance. [file name=query-37ab101e3a539a71be9c962f72749d92.doc size=49152]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/query-37ab101e3a539a71be9c962f72749d92.doc[/file] Post edited by: atanupanda, at: 2007/02/06 10:06 [file name=query-10b0405423ed738f0fcb200de55b103b.doc size=49152]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/query-10b0405423ed738f0fcb200de55b103b.doc[/file] size=159]http://www.jasperforge.org/components/com_joomlaboard/uploaded/images/graph-b9f6e4b9c5699f5e036e1a4fc4336297.JPG Link to comment Share on other sites More sharing options...
hayrich Posted November 6, 2011 Share Posted November 6, 2011 Why have you posted your question as a response to every question, get some forum etiquette!!!!! Link to comment Share on other sites More sharing options...
sanks Posted September 27, 2012 Share Posted September 27, 2012 Regarding the question, that how to rotate the x-axis labels, just go the properties of the chart and look for "Category axis Tick Label rotation" here you can fill any desired angle, you want to rotate your labels (ex. 90) it will rotate the horizontal labels to vertical...try this... 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