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.
Serializing the Chart Object
Re: Serializing the Chart Object
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
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
Re: Serializing the Chart Object
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.
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.
Re: Serializing the Chart Object
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
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
Re: Serializing the Chart Object
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
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