How to create an SVG with JFreeChart?

super_ernie77 picture super_ernie77 · Mar 1, 2012 · Viewed 9.3k times · Source

On the JFreeChart web site it says that the library can output the chart in vector format.

From the JFreeChart site:

  • support for many output types, including Swing components, image files (including PNG and JPEG), and vector graphics file formats (including PDF, EPS and SVG);

But how can I actually output in SVG format?

There is a way using the Apache Batik library, but from the statement above I would think JFreeChart can do it without Batik.

I could figure out the output for PNG and JPG in the ChartUtilities class, but there seems to be no class for vector graphics output.

Answer

trashgod picture trashgod · Mar 1, 2012

No, JFreeChart supports SVG in the sense that it can be used in conjunction with Batik or JFreeSVG, which are required. Related resources include these:

Disclaimer: Not affiliated with Object Refinery Limited; just a satisfied customer and very minor contributor.