JFreeChart to file?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Valentino_FBI
Posts: 5
Joined: Mon May 19, 2008 1:34 pm
Location: Bulgaria
Contact:

JFreeChart to file?

Post by Valentino_FBI » Fri Sep 05, 2008 6:53 pm

Hello,

Is it possible to save a JFreeChart (including all maded changes over the chart or plot , like colors, titles and so on) to a file? And how to do that?
The goal is at some time to read the file and to see the same Chart as before (when i saved it)

Thanks a lot

RugWarrior
Posts: 17
Joined: Wed Jul 30, 2008 11:54 am

Save as image

Post by RugWarrior » Fri Sep 05, 2008 9:58 pm

Hi,

you can save your chart as image (png or jpg).

Regards,
Sol

Valentino_FBI
Posts: 5
Joined: Mon May 19, 2008 1:34 pm
Location: Bulgaria
Contact:

Picture, I don't think so

Post by Valentino_FBI » Sat Sep 06, 2008 8:00 am

I know that but this don't match the main goal!
When i read the chart i want to be able to change its properties. If it is a picture (jpeg or png) i would not be able to do whatever changes i would like to, right?

So , i'm still waiting for any solutions
thanks

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Post by skunk » Sat Sep 06, 2008 1:30 pm

All components implement Serializable, so you should be able to simply use the standard java serialization API.

http://java.sun.com/developer/technical ... alization/

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Sat Sep 06, 2008 5:38 pm

skunk wrote:All components implement Serializable, so you should be able to simply use the standard java serialization API./
Agreed, but with a couple of provisos:

(1) I've no idea if we've maintained serialization compatibility between the versions in the 1.0.x series. If you're going to rely on it, then consider helping out to create a suite of tests to ensure that compatibility is preserved;

(2) There may still be subtle bugs in the serialization - I don't know if this feature of the code sees a lot of use, so test, test, test.

You might also want to look at the xstream project, which will serialize the charts in XML format (if you like XML).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Valentino_FBI
Posts: 5
Joined: Mon May 19, 2008 1:34 pm
Location: Bulgaria
Contact:

Post by Valentino_FBI » Sat Sep 06, 2008 5:51 pm

As i see that is the way... so thanks all of you again
As david.gilbert says, I'm going to test it.. and test it :D

Locked