FREQUENTLY ASKED QUESTIONS

A free public discussion forum for the JFreeChart class library.

FREQUENTLY ASKED QUESTIONS

Postby david.gilbert » Tue Apr 20, 2004 3:50 pm

I've compiled this list of frequently asked questions. Feedback is welcome.

Regards,

Dave Gilbert
JFreeChart Project Leader


Code: Select all
JFREECHART FREQUENTLY ASKED QUESTIONS (AND ANSWERS)
---------------------------------------------------

(C)opyright, 2004, by Object Refinery Limited.

Last updated 20 April 2004.

This FAQ is designed to answer some of the questions that get asked over
and over again in the support forum.  Please read it.  Note that there is
also some important information in the README.txt file that is included
in the JFreeChart distribution.  Please read that too.

-------------------------------------------------------------------------------

1.  I'm getting classpath errors (NoClassDefFoundException etc.), can you help
    me?

2.  I can't find the source code for classes in the org.jfree.ui package (for
    example, org.jfree.ui.RefineryUtilities).  Where are they?

3.  Can I use JFreeChart in an applet?

4.  Can I use JFreeChart in a commercial (closed source) application?  Do I
    need to pay a fee?

5.  Does JFreeChart support real-time charting?

6.  I want to set my own colors for each series in my chart.  How do I do that?

7.  The y-axis on my chart shows decimal fractions, but I only want it to
    display integral values.  Does JFreeChart support this?

8.  I am using Unicode characters in my chart title, but they aren't being
    displayed properly.  What is going wrong?

9.  I see that JFreeChart can export to JPEG and PNG format - which is better?

10. My web application runs fine on my Windows development machine, but when
    I deploy it to the Unix/Linux production server, it doesn't work.  What
    is the problem?

11.  I've found a bug, where do I report it?

12. I've made some changes to the JFreeChart source code, and I'd like to
    contribute these back to the project.  Where do I submit them?

-------------------------------------------------------------------------------

1.  I'm getting classpath errors (NoClassDefFoundException etc.), can you help
    me?

The usual causes of classpath problems are (in order of frequency):

(a) New users that don't really understand what the classpath is about, and
    how it works.  If this is you, find a good introductory book on Java and
    read up about the classpath until you understand it.  You won't get
    anywhere with Java until you understand how Java finds and loads classes.
   
(b) You have more than one copy of the JFreeChart and/or JCommon jar files
    on the current classpath.
   
(c) You have an out-of-date version of JCommon (this is not really a classpath
    issue, but users often report it as such).
   
(d) Very occasionally, a jar file can be corrupted for whatever reason.  If
    nothing else works for you, try downloading a fresh copy of the required
    jar file(s) (this goes for any jar file, not just the JFreeChart/JCommon
    jar files).

-------------------------------------------------------------------------------

2.  I can't find the source code for classes in the org.jfree.ui package (for
    example, org.jfree.ui.RefineryUtilities).  Where are they?

The org.jfree.ui package is part of the JCommon class library.  The runtime
jar file is included in the JFreeChart distribution, source code and
documentation is available separately from:

    http://www.jfree.org/jcommon/index.html

Like JFreeChart, JCommon is also licensed under the terms of the GNU LGPL.

-------------------------------------------------------------------------------

3.  Can I use JFreeChart in an applet?

Yes, there is a demo at http://www.object-refinery.com/jfreechart/applet.html.

There are some provisos though:

    -  you need a web browser that supports Java 2 (JDK 1.2.2 or higher).  To
       find out what version your browser supports, try the following web
       page: 
       
               http://javatester.org/version.html.
       
       Virtually all browsers support Java 2 EXCEPT for Microsoft Internet
       Explorer (MSIE).  You can install Sun's Java Plugin to get MSIE to
       work properly or, better still, download and install Mozilla.

    -  JFreeChart doesn't incorporate any special applet features.  For
       example, you can't pass data to the chart applet via HTML as you can
       in some charting packages.
       
    -  we haven't made any special effort to minimise the size of the
       JFreeChart jar files.  It is something that could be done, but really
       the demand for it is low, so it hasn't been done yet.

-------------------------------------------------------------------------------

4.  Can I use JFreeChart in a commercial (closed source) application?  Do I
    need to pay a fee?

Yes, the license (GNU LGPL) allows this.  There are no license fee to pay,
but you must adhere to the terms of the license.  There is more information
contained at the end of the jfreechart-<version>-install.pdf document.

-------------------------------------------------------------------------------

5.  Does JFreeChart support real-time charting?

Not really.  JFreeChart includes an event-notification mechanism that ensures
that charts are updated whenever the dataset is updated.  However, the chart
is completely repainted for each update, which limits the "frames per second"
rate that you can achieve with JFreeChart.  Typically, updating once per
second is fine, but updating multiple times per second involves a lot of CPU
load.  If you want to pursue this, do some testing for your own circumstances.

-------------------------------------------------------------------------------

6.  I want to set my own colors for each series in my chart.  How do I do that?

You can use the setSeriesPaint() method in the renderer.  For example, the
following code could be used for a bar chart:

    CategoryItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, Color.green);
    renderer.setSeriesPaint(1, Color.red);
    // and so on...

-------------------------------------------------------------------------------

7.  The y-axis on my chart shows decimal fractions, but I only want it to
    display integral values.  Does JFreeChart support this?

Yes, you can replace the collection of standard tick units for the axis
as follows:

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

-------------------------------------------------------------------------------

8.  I am using Unicode characters in my chart title, but they aren't being
    displayed properly.  What is going wrong?

Most often, the problem is that the font being used to display the
title doesn't have support for the Unicode characters being used.  Try
this link for more information about fonts that support Unicode:

    http://www.alanwood.net/unicode/fonts.html
   
-------------------------------------------------------------------------------

9.  I see that JFreeChart can export to JPEG and PNG format - which is better?

PNG by a long way.  JPEG is designed for compressing photographs where a small
loss in quality is usually acceptable (and not very noticeable).  For chart
images, where there are usually sharp distinctions between areas of color, the
artifacts introduced by the JPEG format are very noticeable.  Don't use JPEG
unless you absolutely have to.  The PNG format is "lossless", so chart images
are always reproduced perfectly.

-------------------------------------------------------------------------------
   
10. My web application runs fine on my Windows development machine, but when
    I deploy it to the Unix/Linux production server, it doesn't work.  What
    is the problem?

Most likely your server does not have X11 running.  This is a Java
(AWT/Java2D) issue, not something that is specific to JFreeChart.  There is
some more information at Sun's website:

    http://java.sun.com/products/java-media/2D/forDevelopers/java2dfaq.html#xvfb

In addition, the following thread in the JFreeChart forum contains some
useful information:

    http://www.jfree.org/phpBB2/viewtopic.php?t=1012

-------------------------------------------------------------------------------
   
11.  I've found a bug, where do I report it?

You can use the bug tracker on the JFreeChart project page at SourceForge:

    http://sourceforge.net/tracker/?group_id=15494&atid=115494

-------------------------------------------------------------------------------

12. I've made some changes to the JFreeChart source code, and I'd like to
    contribute these back to the project.  Where do I submit them?
     
You can use the patch manager on the JFreeChart project page at SourceForge:

    http://sourceforge.net/tracker/?group_id=15494&atid=315494
Last edited by david.gilbert on Mon May 22, 2006 3:44 pm, edited 1 time in total.
david.gilbert
JFreeChart Project Leader
 
Posts: 11381
Joined: Fri Mar 14, 2003 10:29 am

Postby uvoigt » Tue Jul 12, 2005 9:10 am

Hi David,

I propose to include the question about the PRException (e.g. see thread http://www.jfree.org/phpBB2/viewtopic.php?t=8706). This is one of the most asked questions.

Ulrich
uvoigt
 
Posts: 166
Joined: Mon Aug 23, 2004 10:50 am
Location: Germany

FREQUENTLY ASKED QUESTIONS

Postby poppins » Tue Oct 04, 2005 1:04 pm

Can we have a categorized FAQ. It will be easier to jump to a certain category of questions rather than browsing the whole list. It may have example links to previous posts as well.

regards,
poppins
 
Posts: 10
Joined: Thu Sep 01, 2005 12:17 pm
Location: India

a

Postby aa » Thu Dec 01, 2005 8:53 am

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aa
 

Help me out here pls..

Postby JavaIdiot » Fri Jan 13, 2006 2:46 am

Can someone teach me how to implement JChart onto wireless mobile/PDA, on the other hand is it J2ME compatible?
JavaIdiot
 

Re: Help me out here pls..

Postby david.gilbert » Fri Jan 13, 2006 11:40 am

JavaIdiot wrote:Can someone teach me how to implement JChart onto wireless mobile/PDA, on the other hand is it J2ME compatible?


JFreeChart requires Java2D, among other things, and since this isn't supported in J2ME, neither is JFreeChart.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
david.gilbert
JFreeChart Project Leader
 
Posts: 11381
Joined: Fri Mar 14, 2003 10:29 am

re FAQ 6) Setting colors per series.

Postby pelski » Thu Feb 23, 2006 2:09 am

This post is regarding the FAQ 6) above.

Could you please extend the example given to also show how
to not only set the color, but also set the seriesOutlinePaint
and the seriesFillPaint.

I am using a XYStepAreaRenderer, and everytime I call either of the above
methods, the default colors are used instead of the ones I provide.
It seems it is only possible to call setSeriesPaint(...) to customise colors. This does not go far enough if one wants to set the outline colors different to the fill colors.
pelski
 
Posts: 16
Joined: Thu Feb 23, 2006 2:02 am

About to give up

Postby simple » Fri Feb 24, 2006 6:23 am

Please tell me where I'm going wrong.

have latest J2EE 1.4 SDK installed on XP
with:-
CLASSPATH=.;c:/jfreechart-1.0.1/lib/jcommon-1.0.1.jar;c:/jfreechart-1.0.1/jfreechart-1.0.1.jar

PATH=C:\Sun\AppServer\jdk\bin

Installed presumably latest and uncorrupted jar files from:-
http://prdownloads.sourceforge.net/jfre ... p?download

http://prdownloads.sourceforge.net/jfre ... p?download

Installed ant and compiled javadocs.

managed to compile BarChartDemo1.java

But get following error running:-

Exception in thread "main" java.lang.NoClassDefFoundError: org/jfree/Chart/demo/
BarChartDemo1 (wrong name: org/jfree/chart/demo/BarChartDemo1)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
4)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

I know FAQs recomend reading up on java classpath but I must be reading the wrong book(s).

I'm not a newbie but would really appreciate a complete dummies guide to quick install.

Any help would be great,TIA.
simple
 
Posts: 4
Joined: Fri Feb 24, 2006 5:45 am

how to convert png images to tiff format for printing

Postby Rajinder Arora » Fri Feb 24, 2006 10:30 am

Need help...

we have a large number of PNG images (grabbed as stills from video) which we wish to use for printing of a book. However all these images are in 72 dpi resolution and look pixelated on screen. Can someone tell us how to increase the resolution so as the images do not pixelate and they are worthy of using in a printed book
thanks
rajinder arora

rajinder@ishtihaar.com
Rajinder Arora
 

Postby zhuzhuhoney » Mon May 15, 2006 9:48 am

Thank you very much for list this questions and solutions :) !
Everyday is a nice day!
zhuzhuhoney
 
Posts: 1
Joined: Mon May 15, 2006 9:21 am

Re: About to give up

Postby houlihan » Fri Nov 17, 2006 11:51 am

been wrestling with the same problem over the past few days - if you comment out the "package demo ;" line, the demo program should run - looks like demo files are written to be compiled into a single demo application rather than be run individually - if this is true then perhaps it should be mentioned in the readme file? - it might save relative newbies like myself some time -

__________________________________________________

Exception in thread "main" java.lang.NoClassDefFoundError: org/jfree/Chart/demo/
BarChartDemo1 (wrong name: org/jfree/chart/demo/BarChartDemo1)
beginner
houlihan
 
Posts: 1
Joined: Fri Nov 17, 2006 11:36 am

font quality / blur

Postby lucas luky » Wed Sep 12, 2007 10:29 pm

i think the font quality issue is a recurrent problem:
[www].jfree.org/phpBB2/viewtopic.php?t=2703

[www].jfree.org/phpBB2/viewtopic.php?t=16804&start=0&postdays=0&postorder=asc&highlight=&sid=2472da759434c4c4d671a33d5c86d94a

I'm passing through that right now, found others with the same trouble and no solution... :(
lucas luky
 
Posts: 14
Joined: Wed Sep 12, 2007 7:05 pm

Re: FREQUENTLY ASKED QUESTIONS

Postby clark24 » Wed Jul 31, 2013 7:58 am

Thank you so much for sharing nice information.
clark24
 
Posts: 2
Joined: Wed Jul 31, 2013 7:33 am


Return to JFreeChart - General

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 13 guests