Serializing the Chart Object

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Hari

Serializing the Chart Object

Post by Hari » Wed Mar 05, 2003 10:27 am

Hi all!,

I'm using JFreeChart in a web environment and initially I'll show the user, a complete XY timeseries chart and let the user to choose a range.

If the user choose a range, I regenerate the graph reading the data and building the dataset again from the scratch and redisplay the new graph to the user.

I successfully did this, but would like to improve the performance of the range display, and hence I plan to serialize the initial chart object into a file. But it is surprise to know that the classes are not "Serializable". Is there any specific reason for being non-serializable? Can it be done?

Thanks,

Hari.

David Gilbert

Re: Serializing the Chart Object

Post by David Gilbert » Wed Mar 05, 2003 3:38 pm

Hi Hari,

This serialization has been mentioned by a few people lately. The only "specific reason" for JFreeChart being non-serializable is my ignorance about what is involved. I'll be reading up on it soon...

Regards,

Dave Gilbert

Hari

Re: Serializing the Chart Object

Post by Hari » Thu Mar 06, 2003 4:42 am

Dave,

Serialization involves just implementing the java.io.Serializable interface which is actually a dummy one. Just keep in mind that, the JFreeChart object and all *contained* objects should implements the Serializable interface.

I believe, you can simply implement "Serializable", merely in the Interface files defined for the JFreeChart library. Am I right?

Regards,

Hari.

Martin Rupp

Re: Serializing the Chart Object

Post by Martin Rupp » Fri Mar 07, 2003 12:23 pm

Hi Hari,

it is not so simple. The JFreeChart classes have got references to other
not serializable classes, for example Rectangle2D from SDK.

It is also necessary to implement writeObject and readObject methods
to recreate this objects.

Regards

Martin Rupp

sebastian

Re: Serializing the Chart Object

Post by sebastian » Fri Mar 07, 2003 1:10 pm

HI

but I think at least the datasets should be Serializeable.... that wouldn't be too difficult and you can easily regenerate charts from their datasets

regards

Sebastian

Martin Rupp

Re: Serializing the Chart Object

Post by Martin Rupp » Fri Mar 07, 2003 10:48 pm

Hi Sebastian,


that is right.

Regards

Martin Rupp

Locked