2004 IR Help Posted August 23, 2006 Share Posted August 23, 2006 By: hacinn - hacinn Legend Position by xml file? 2005-08-25 12:43 Hi How can I determine the legend position in my xml file? I am not using java code to make the chart, I am using the xml file only. I'd like the legend stay of the right side of the chart instead in botton area. I am using the following tags in my xml: <pie3DChart> <chart evaluationTime="Group" evaluationGroup="City"> <reportElement x="0" y="40" width="500" height="200"/> </chart> <pieDataset> <dataset incrementType="None" incrementGroup="" resetType="Group" resetGroup="City"/> <keyExpression>$F{address}</keyExpression> <valueExpression>$F{nrpeople}</valueExpression> <labelExpression> </labelExpression> </pieDataset> <pie3DPlot> <plot/> </pie3DPlot> </pie3DChart> Thanks by help By: hacinn - hacinn RE: Legend Position by xml file? 2005-08-30 06:24 Hi all, I don't resolve this question yet. Please, someone can help me? Thanks in advance Hacinn By: hacinn - hacinn RE: Legend Position by xml file? 2005-09-05 06:01 Please teodord, help me.... Thanks in advance. By: Teodor Danciu - teodord RE: Legend Position by xml file? 2005-09-06 06:52 Hi, There is no tag or attribute inside JRXML for specifying the legend position. We could add this in the future, but have not yet figured out how this can be achieved with the JFreeChart API. Thank you, Teodor By: hacinn - hacinn RE: Legend Position by xml file? 2005-09-06 13:12 Hi Teodor, Thank you very much by your help. I change the legend position by java code into my scriptlet.class. But i don't want to use the scriptlet file to make my charts, I am using xml tags only. How this feature is not present in current version the jasper, I will wait the new jasper versions. Thanks again by answer. Hacinn By: Teodor Danciu - teodord RE: Legend Position by xml file? 2005-09-07 01:49 Hi, If you say you already altered the legend position by program, can you provide us with the required JFreeChart API calls so that we can have this in a future version? Note that it is not required for you to use a scriptlet class, but rather a "chart customizer" implementation like shown in one of the reports inside the "charts" sample. Thank you, Teodor By: hacinn - hacinn RE: Legend Position by xml file? 2005-09-08 05:08 Hi teodor, When I used one scriptlet, I was using the following code: JFreeChart chart = ChartFactory.createPieChart3D( "", dataset, true, false, false ); LegendTitle legend = chart.getLegend(); legend.setPosition(RectangleEdge.RIGHT); But, is this case, I didn't use the tags in xml file. My chart was fully make in scriptlet.class file, including dataset, plot customization, etc. I don't understand your "Note" in previous post. I saw the examples in charts example folder, but there, all charts is with the legend in botton area and I want to put the legend in right side. Thank you, Hacinn By: Ionut Nedelcu - ionutned RE: Legend Position by xml file? 2005-09-08 08:04 Hello, Since the JFreeChart API is very complex, we cannot expose its full functionality in JasperReports. Some more delicate customizations can only be done by using the JFreeChart API. We created a chart customizer that gives users direct access to the JFreeChart object, so they can do whatever they want with it. Using it is very simple and is illustrated in the charts sample, where we used a customizer to change the bar colors for the BarChartReport. Ionut By: hacinn - hacinn RE: Legend Position by xml file? 2005-09-08 11:19 Hi, Sorry, but I don't find the example. Where is it? I find one barchartreport.jrxml in the path: jasperreports1.0projectjasperreports-1.0.0demosamplescharts The customization in this file will be the tags: <categorySeries> <seriesExpression>"Freight"</seriesExpression> <categoryExpression>$F{ShipCountry}</categoryExpression> <valueExpression>$V{FreightSumCountryGroup}</valueExpression> </categorySeries> How can I to access JFreeChart object? Thanks by help Hacinn 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 filesize=150C:Documents and SettingsAtanuMy Documentsgraph.jpeg[/img]Now 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 isLclsize=150C:Documents and SettingsAtanuMy Documentsdata.jpeg[/img] Actually I have got a information that for that I have to write a customizer class for chart. Also I have write it . Code:import net.sf.jasperreports.engine.*;import net.sf.jasperreports.view.JasperViewer;import net.sf.jasperreports.engine.JREmptyDataSource;import java.util.*;import java.sql.DriverManager;import java.sql.Connection;import java.sql.SQLException;import net.sf.jasperreports.engine.JRAbstractChartCustomizer;import javax.sql.*;import org.jfree.chart.axis.CategoryAxis;import org.jfree.chart.plot.CategoryPlot;import org.jfree.chart.renderer.category.*;import org.jfree.chart.renderer.*;import org.jfree.chart.ChartRenderingInfo;import org.jfree.chart.renderer.category.BarRenderer;import org.jfree.chart.renderer.category.LevelRenderer;import org.jfree.chart.renderer.category.LayeredBarRenderer;import java.sql.DriverManager;import java.sql.SQLException;import java.sql.Connection;import java.util.HashMap;import java.util.Map;import java.lang.String;import net.sf.jasperreports.engine.JRException;import net.sf.jasperreports.engine.JasperExportManager;import net.sf.jasperreports.view.JasperViewer;import net.sf.jasperreports.engine.xml.JRXmlLoader;import net.sf.jasperreports.engine.JasperCompileManager;import net.sf.jasperreports.engine.JasperFillManager;import net.sf.jasperreports.engine.JasperPrint;import net.sf.jasperreports.engine.design.JasperDesign;import net.sf.jasperreports.engine.JasperReport;import net.sf.jasperreports.engine.JRChartDataset; import net.sf.jasperreports.engine.JRChartPlot; import org.jfree.chart.renderer.category.BarRenderer3D; import org.jfree.chart.renderer.category.LineAndShapeRenderer;import org.jfree.chart.axis.CategoryLabelPositions;import org.jfree.chart.renderer.category.LineRenderer3D;import java.awt.*;import net.sf.jasperreports.engine.JRChart;import net.sf.jasperreports.engine.JRChartCustomizer;import org.jfree.chart.JFreeChart;import net.sf.jasperreports.engine.*;import java.awt.Color;import net.sf.jasperreports.engine.JRChart;import net.sf.jasperreports.engine.JRChartCustomizer;import org.jfree.chart.JFreeChart;import org.jfree.chart.axis.CategoryAxis;import org.jfree.chart.axis.CategoryLabelPositions;import org.jfree.chart.plot.CategoryPlot;import org.jfree.chart.renderer.category.BarRenderer3D;import java.lang.Object; public class LineChartCustomizer extends JRAbstractChartCustomizer { public void customize(JFreeChart chart, JRChart jasperChart) { LineAndShapeRenderer renderer = (LineAndShapeRenderer) chart.getCategoryPlot().getRenderer(); renderer.setSeriesPaint(1, Color.green); renderer.setSeriesPaint(4, Color.orange); chart.setTitle("Setting the title "«»); } }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] [file name=query-18f0b8f76d25f348849a7a8978b5140e.doc size=49152]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/query-18f0b8f76d25f348849a7a8978b5140e.doc[/file] 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