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

shaoen01

Members
  • Posts

    14
  • Joined

  • Last visited

shaoen01'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. Hi All, I seem to be having a problem with finding my customizer class when i try to run the jasper from my web application via jsp. However, if i use the ireport software it works perfectly fine. So i tried removing the reference to the chart customizer.class file and my report can show on jsp. I am thinking maybe the path is not right or could not be set properly in ireport as i believe it finds the customizer.class file in the same directory as the .jrxml file. So i am wondering if there is any attribute via xml that i can edit to determine what path to look for the customizer class? If anyone knows or have a clue do let me know! Thanks
  2. The .class file and the .jrxml file has to be in the same directory and folder for you to call it. Why don't you try this sample class below and build it to get the .class file. Then just create a sample barchart just for testing purposes. And then try it out and see how it goes. I don't understand why it can't be found because i faced exactly the same problem you had and solved it via this way. Code:/* * To change this template, choose Tools | Templates * and open the template in the editor. *//* * ============================================================================ * GNU Lesser General Public License * ============================================================================ * * JasperReports - Free Java report-generating library. * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * * JasperSoft Corporation * 303 Second Street, Suite 450 North * San Francisco, CA 94107 * http://www.jaspersoft.com */import net.sf.jasperreports.engine.JRChartCustomizer;import net.sf.jasperreports.engine.JRChart;import org.jfree.chart.JFreeChart;import org.jfree.chart.renderer.category.BarRenderer;import org.jfree.chart.plot.CategoryPlot;import org.jfree.chart.axis.NumberAxis;import java.awt.*;import org.jfree.chart.axis.CategoryAxis;/** * @author Teodor Danciu (teodord@users.sourceforge.net) * @version $Id:BarChartCustomizer.java 2317 2008-08-27 09:06:42Z teodord $ */public class BarChartCustomizer implements JRChartCustomizer{ private Number tickUnits=0; public void customize(JFreeChart chart, JRChart jasperChart) { BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer(); renderer.setSeriesPaint(0, Color.red); renderer.setSeriesPaint(1, Color.blue); renderer.setMaximumBarWidth(10); //renderer.set //renderer.setItemMargin(0.50); //myHorizontalAxis.setAutoTickUnits(false);//myHorizontalAxis.setTickUnits(new Double(10)); CategoryPlot plot = chart.getCategoryPlot();//NumberAxis myHorizontalAxis =//(NumberAxis) plot.getAxis(Plot.HORIZONTAL_AXIS);NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();//rangeAxis.setTickUnit(20);//rangeAxis.createIntegerTickUnits();rangeAxis.setStandardTickUnits(rangeAxis.createIntegerTickUnits());rangeAxis.setAutoRangeIncludesZero(true);//rangeAxis.setRange(100, plot.); //CategoryPlot plot = chart.getCategoryPlot();CategoryAxis axis = plot.getDomainAxis();//rangeAxis.set//renderer.setseriesaxis.setLowerMargin(0.02); // two percentaxis.setCategoryMargin(0.05); // ten percentaxis.setUpperMargin(0.02); // two percent//renderer.setbar }}
  3. Hi, Well, you actually don't even need to create a jar file if you are using the ".class" file. Did you use javac or other java compilers to get the customizer.class file? Once you have done that, did you manage to find the "Customizer class" in the chart properties? Also, are you sure that your coding for the custiomizer.java is correct?
  4. I am just wondering if i will be able to use a parameter to set the destination of the chart customizer class? Or must the customizer class be in the same directory as the ".jrxml" file? I tried to do use "$P{path}" and insert it into the customizer class in chart properties, but it doesn't seem to work. Any ideas?
  5. Hey golreich, I did face a similar problem and i have managed to overcome this classnotfound exception. Basically, you compile your java file (customizer.java) and get the ".class" file. Based on where the location of your jasper or jrxml file is residing, place the ".class" file generated above. Go to ireport and double click on your chart> edit chart properties> chart properties Under chart properties you will see a "Customizer class" under the COMMON. Enter the name of your ".class" file without including ".class". In the case of your submitted error, it should be "ChartCostumizer". This should be able to do the trick. If it still gives the class not found exception, try inputting "utility.ChartCostumizer", which i assume utility is your package name.
  6. Thanks! It works great! Just wondering why does the detail band repeat for every instance? What's the purpose of creating a band?
  7. When i export the chart to pdf, the pdf file itself will have 5 of the same charts generated with the same values.
  8. Hi, I am just wondering how do i upload or insert a customizer class for bar chart? Thanks
  9. Hi all, I seem to have 5 pages generated for the same results in my bar chart. Does anyone knows why? Thanks
  10. Hi all, I am just wondering how do i set the scale of my chart via iReport? Thanks
  11. I think you're right. I have tried date_format() for mysql and it should work i hope. Thanks!
  12. I tried it out with the datename(), but it gives me an error in my report query: SQL Problems:Function datename does not exist.
  13. Hey, I am trying to display a pie chart that shows the monthly sales from Jan to Dec for a particular year for example. I have no problem inputting the parameters and my pie chart can load. My problem is how do i label the pie chart based on the name of the months like Jan, Feb, etc? The query ain't so right yet as i am just testing iReport as i have never used it before. So based on the purchaseDate given say 16th june 2008, i want to take all the months in year 2008 and put the number of tickets sales in a pie chart categorized by months. Any clues or suggestions please? Thanks! Code:I created a variable and this is the expression value: "$F{ticket_PURCHASEDATE}.getMonth()".Query Code:SELECT count(ticket.`ID`), ticket.`PURCHASEDATE` AS ticket_PURCHASEDATEFROM `ticket` ticketWHERE ticket.`PURCHASEDATE` = $P{purchaseDate}GROUP BYticket_PURCHASEDATE
×
×
  • Create New...