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. Can I use JFreeChart in a commercial (closed source) application? Do I need to pay a fee?
  3. Does JFreeChart support real-time charting?
  4. I want to set my own colors for each series in my chart. How do I do that?
  5. The y-axis on my chart shows decimal fractions, but I only want it to display integral values. Does JFreeChart support this?
  6. I am using Unicode characters in my chart title, but they aren't being displayed properly. What is going wrong?
  7. I see that JFreeChart can export to JPEG and PNG format - which is better?
  8. 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?
  9. I've found a bug, where do I report it?
  10. 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?
  11. 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. 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.

3. Does JFreeChart support real-time charting?

Yes, but probably not in the most ideal way. JFreeChart includes an event-notification mechanism that ensures that charts are updated whenever the data for the chart is changed. 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.

4. 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...

5. 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());

6. 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:

7. 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.

8. 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 Oracle's website:

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

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

You can use the issue tracker on the JFreeChart project page at GitHub:

10. I've made some changes to the JFreeChart source code, and I'd like to contribute these back to the project. How can I do this?

Please submit a pull request via GitHub:

11. Are there other open source chart libraries for Java?

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

Some of the listed projects may not be active anymore. If you know of a library that should be added to this list, please let us know.

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!