Jump to content
We've recently updated our Privacy Statement, available here ×

cho

Members
  • Posts

    10
  • Joined

  • Last visited

cho's Achievements

Apprentice

Apprentice (3/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Collaborator Rare

Recent Badges

0

Reputation

  1. //scriptlet.java import java.awt.Color; import java.awt.Font; import net.sf.jasperreports.engine.JRDefaultScriptlet; import net.sf.jasperreports.engine.JRScriptletException; import net.sf.jasperreports.renderers.JCommonDrawableRenderer; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.AxisLocation; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.plot.CategoryPlot; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.renderer.category.LineAndShapeRenderer; import org.jfree.chart.title.TextTitle; import org.jfree.data.category.DefaultCategoryDataset; import org.jfree.ui.HorizontalAlignment; import org.jfree.ui.RectangleEdge; public class retail_cvr_by_loc3Scriptlet extends it.businesslogic.ireport.IReportScriptlet { /** Creates a new instance of JRIreportDefaultScriptlet */ public retail_cvr_by_loc3Scriptlet() { } /** Begin EVENT_AFTER_COLUMN_INIT This line is generated by iReport. Don't modify or move please! */ public void afterColumnInit() throws JRScriptletException { super.beforeColumnInit(); } /** End EVENT_AFTER_COLUMN_INIT This line is generated by iReport. Don't modify or move please! */ /** Begin EVENT_AFTER_DETAIL_EVAL This line is generated by iReport. Don't modify or move please! */ public void afterDetailEval() throws JRScriptletException { super.afterDetailEval(); } /** End EVENT_AFTER_DETAIL_EVAL This line is generated by iReport. Don't modify or move please! */ /** Begin EVENT_AFTER_GROUP_INIT This line is generated by iReport. Don't modify or move please! */ public void afterGroupInit(String groupName) throws JRScriptletException { //super.afterGroupInit(groupName); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue((java.math.BigDecimal)getFieldValue("TRAFFIC"), "Traffic", (java.lang.String)getFieldValue("GRAPH_X_AXIS")); // create the chart... JFreeChart chart = ChartFactory.createLineChart( "Java Standard Class Library", // chart title (java.lang.String)getParameterValue("p_period"), // domain axis label "Traffic", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips false // urls ); chart.addSubtitle(new TextTitle("Number of Classes By Release")); TextTitle source = new TextTitle("Source: Java In A Nutshell (4th Edition) by David Flanagan (O’Reilly)"); source.setFont(new Font("SansSerif", Font.PLAIN, 10)); //source.setPosition(RectangleEdge.BOTTOM); //source.setHorizontalAlignment(HorizontalAlignment.RIGHT); chart.addSubtitle(source); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setRangeGridlinePaint(Color.white); // customise the range axis... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); NumberAxis axis2 = new NumberAxis("Conversion"); axis2.setRange(5, 500); plot.setRangeAxis(1, axis2); //plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT); // customise the renderer... LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setShapesVisible(true); renderer.setDrawOutlines(true); renderer.setUseFillPaint(true); renderer.setFillPaint(Color.white); this.setVariableValue("Chart", new JCommonDrawableRenderer(chart)); } /** End EVENT_AFTER_GROUP_INIT This line is generated by iReport. Don't modify or move please! */ /** Begin EVENT_AFTER_PAGE_INIT This line is generated by iReport. Don't modify or move please! */ public void afterPageInit() throws JRScriptletException { super.afterPageInit(); } /** End EVENT_AFTER_PAGE_INIT This line is generated by iReport. Don't modify or move please! */ /** Begin EVENT_AFTER_REPORT_INIT This line is generated by iReport. Don't modify or move please! */ public void afterReportInit() throws JRScriptletException { } /** End EVENT_AFTER_REPORT_INIT This line is generated by iReport. Don't modify or move please! */ /** Begin EVENT_BEFORE_COLUMN_INIT This line is generated by iReport. Don't modify or move please! */ public void beforeColumnInit() throws JRScriptletException { } /** End EVENT_BEFORE_COLUMN_INIT This line is generated by iReport. Don't modify or move please! */ /** Begin EVENT_BEFORE_DETAIL_EVAL This line is generated by iReport. Don't modify or move please! */ public void beforeDetailEval() throws JRScriptletException { } /** end EVENT_BEFORE_DETAIL_EVAL Please don't touch or move this comment*/ /** End EVENT_BEFORE_DETAIL_EVAL This line is generated by iReport. Don't modify or move please! */ /** Begin EVENT_BEFORE_GROUP_INIT This line is generated by iReport. Don't modify or move please! */ public void beforeGroupInit(String groupName) throws JRScriptletException { } /** End EVENT_BEFORE_GROUP_INIT This line is generated by iReport. Don't modify or move please! */ /** Begin EVENT_BEFORE_PAGE_INIT This line is generated by iReport. Don't modify or move please! */ public void beforePageInit() throws JRScriptletException { } /** End EVENT_BEFORE_PAGE_INIT This line is generated by iReport. Don't modify or move please! */ /** Begin EVENT_BEFORE_REPORT_INIT This line is generated by iReport. Don't modify or move please! */ public void beforeReportInit() throws JRScriptletException { } /** End EVENT_BEFORE_REPORT_INIT This line is generated by iReport. Don't modify or move please! */ }
  2. Thanks for the reply. We were trying to plot the dual Y axis graph writing a scriptlet. We successfully created dual Y axis, but we need to loop thru the data set to plot the Y values in the graph. Can you post the code how to loop thru the dataset and plot the graph using scriptlets? Attached is the sample report we need to generate. -For each ID the graph needs to be generated in new page based on the IDs data. -The X-Axis Category names need to be modified based on user parameter. For EX: If user selects day the X_axis values are 2/1,2/1.. If parameter is Quarter , the X_axis values are June2006, July2006...Right now, this is String data type in our report. Post edited by: cho, at: 2006/08/22 20:22 [file name=quarter.doc size=76288]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/quarter.doc[/file] Post edited by: cho, at: 2006/08/22 20:23
  3. Iam trying to create a line graph with 2 Y axis. Is it possible to do thru iReports? Can some one post the .jrxml how to achieve this?
  4. Can someone help me how to render graph in jasper reports please?
  5. I am trying to plot a graph using iReports1.2.5 with names on Xaxis and Age on Yaxis as a line graph. I wrote the query for that and the data is returning properly. But the graph is not showing any data. I entered $F{age} for series expression and category expression as $F{name} and value expression as $F{total_enters}. Can someone help me to identiy what iam missig here. This is very urgent for me. Thanks
  6. Can somebody help me to intialize the following parameters in iReports for Jasper reports? 1. Initialise string parameter(java.lang.String) Report had a parameter called P_IDS(String datatype) which passes a comma separated list. I would like to initialize this parameter to 9999. What should i give in "Default parameter expression" for this? I tried "9999", but it didnt work in the SQL query which has ...empid in ($P!{P_IDS}) .. If i give as 9999, i get the error 'Cannot convert from int to String) 2. Initialise a date parameter which is passed as String datataype I would like to initialise date field which is passed as string datatype to report query. How is this possible to intialise this parameter as "07/01/2006" How can i initialise a date parameter to beginning year start date (01/01/2006) which is passed as string datatype. Also i need to intialise the date parameter(java.util.Date) type as today date( without time stamp) Thanks for ur help.
  7. Thankyou. That worked for me. Previously i was placing the header and footer in dummy group and crosstab in summary band. I modified that as mentioned by u. Thanks, Cho
  8. Thanks for getting back quickly. I wanted the report in the format attached. I would like to show the count of rows(Employees) and count of columns(Days) at end of crosstab report. [file name=jasper_crosstab.doc size=26624]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/jasper_crosstab.doc[/file]
  9. I need to add the number of rows returned in last page of crosstab report. I tried various ways using the cross tab variables, but it is always returning the no. Of rows * no. columns. For ex. Columns are 30 Rows are 52 Report is returning 1560 instead of 52 at the end. This is very urgent. Can somebody help me?
  10. I am new user of Jasper reports. I created a crosstab report following the discussion forums and tutorials frm website. As mentioned, the crosstab need to be created in the summary band of report. I need to add title(on top) and page number(in footer). I followed the url to create fake title and footer band but, still i see the title and footer on first page, but not in all pages. Iam not sure if iam doing anything wrong in creating the fake report group. Iam using iReports interface. Can somebody help me on how to add the header and footer in crosstab report so that header and footer can display on all pages. Thanks in advance.
×
×
  • Create New...