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
Jfreechart and jfreesvg compatibility
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Jfreechart and jfreesvg compatibility
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
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
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader
![Idea :idea:](./images/smilies/icon_idea.gif)
![Idea :idea:](./images/smilies/icon_idea.gif)
Re: Jfreechart and jfreesvg compatibility
Ok, thanks. Got it!