This section contains information about serializing and unserializing a PHPlot object.
Serializing a PHP variable, array, or object
with the PHP function serialize()
generates a string representation of the value which can be stored or
transmitted.
Unserialization with the PHP function
unserialize()
re-creates the variable, array, or
object from the string representation.
Starting with PHPlot-5.8.0, PHPlot objects can be serialized and unserialized, subject to these limitations:
A PHPlot object can only be serialized until DrawGraph
is used.
However, you can serialize the object, then call
DrawGraph
, if you want both the serialization and the
actual plot.
Serialization and unserialization will not work when an input file is specified in the PHPlot or PHPlot_truecolor constructors. Consider using SetBgImage instead.
You must serialize and unserialize with the exact same version of PHPlot.
Here is an example of serializing a PHPlot object:
require_once 'phplot.php'; $plot = new PHPlot(800, 600); ... // Configure the PHPlot object: Set plot type, data values, etc. // Do not use DrawGraph (yet) $str = serialize($plot);
The corresponding unserialization looks like this:
require_once 'phplot.php'; $newplot = unserialize($str); // You can do additional plot setup here if desired. $newplot->DrawGraph(); // Draw it
This version of the manual was produced for the
PHPlot Sourceforge project web service site, which requires the logo on each
page.
To download a logo-free copy of the manual, see the
PHPlot project downloads
area.