Frequently Asked Questions (FAQ)

This page contains a list of frequently asked questions, along with answers of course:

  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 a patch?
  13. Are there other "open source" chart libraries?

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

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

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:

Like JFreeChart, JCommon is also licensed under the terms of the GNU Lesser General Public Licence.

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:

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

Yes, the licence (GNU LGPL) allows this. There is no licence fee to pay, but you must adhere to the terms of the licence. 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 results in high CPU load. If you want to pursue this, do some performance testing with your specific configuration and use cases.

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:

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:

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

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

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

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 a patch?

You can use the patch manager on the JFreeChart project page at SourceForge:

13. Are there other "open source" chart libraries?

Yes. If JFreeChart doesn't meet your requirements, try one of the following free/open source alternatives:

Some of the listed projects may not be active anymore.

Tip: The most comprehensive source of information about JFreeChart is the JFreeChart Developer Guide. You have to pay for this, but it will help you to get the most out of JFreeChart and it is an important source of funding for the ongoing development and maintenance of JFreeChart. Thanks for your support!