Jfreechart and jfreesvg compatibility

A discussion forum for JFreeSVG (a fast, lightweight, SVG generator for the Java platform).

Jfreechart and jfreesvg compatibility

Postby Eugene_T » Thu Aug 06, 2015 10:13 am

Can I reuse the code created for generating jfreechart (via image) for generating svg files?
I want to use images in pdf reports and svg on the client, but it would be nice if I use the same data model - only change option image or svg
Thanks
Eugene_T
 
Posts: 6
Joined: Thu Aug 06, 2015 10:09 am

Re: Jfreechart and jfreesvg compatibility

Postby david.gilbert » Thu Aug 06, 2015 5:54 pm

Yes, that's exactly the point of JFreeSVG...it's an implementation of the Graphics2D API (that JFreeChart uses for rendering) that accumulates all drawing operations into SVG elements. Once you have configured a JFreeChart object instance, you can render it to the screen or PNG or JPEG or SVG or PDF just by changing the Graphics2D instance to an appropriate implementation (if you look in the draw() method for the JFreeChart class you'll see that it takes a Graphics2D argument).

You can see in this demo that the creation of the chart is separate from the output to SVG:

https://github.com/jfree/jfreesvg/blob/ ... Demo1.java
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: 11626
Joined: Fri Mar 14, 2003 10:29 am

Re: Jfreechart and jfreesvg compatibility

Postby Eugene_T » Tue Aug 25, 2015 9:24 am

Ok, thanks. Got it!
Eugene_T
 
Posts: 6
Joined: Thu Aug 06, 2015 10:09 am


Return to JFreeSVG

Who is online

Users browsing this forum: No registered users and 1 guest

cron