Source for file Exports.php
Documentation is available at Exports.php
* @copyright (c) 1995-2008 by Steema Software SL. All Rights Reserved. <info@steema.com>
* @link http://www.steema.com
function __get( $property ) {
$method = "get{$property}";
function __set ( $property,$value ) {
$method = "set{$property}";
return $this->$method($value);
* Gets a class instance with methods to export chart Series data.
if ($this->data == null) {
* Gets a class instance with methods to create images from chart.
if ($this->image == null) {
* Gets a class instance with methods to store the chart to a file or
* stream using Java standard serialization and XMLEncoder mechanisms.
* <pre><font face="Courier" size="4">
* myChart.getExport().getTemplate().toXML(tmpName);
* showSavedFile(tmpName);
if ($this->template == null) {
* @copyright (c) 1995-2008 by Steema Software SL. All Rights Reserved. <info@steema.com>
* @link http://www.steema.com
* Export Chart to XML data format
if ($this->xmlFormat == null) {
$this->xmlFormat = new XMLFormat($this->chart);
* <pre><font face="Courier" size="4">
* myChart.getExport().getData().getText().save(tmpName);
if ($this->txtFormat == null) {
* Export Chart as HTML table
if ($this->htmlFormat == null) {
$this->htmlFormat = new HTMLFormat($this->chart);
return $this->htmlFormat;
* Export Chart as Excel spreadsheet
if ($this->excelFormat == null) {
$this->excelFormat = new ExcelFormat($this->chart);
return $this->excelFormat;
//parent::DefaultPersistenceDelegate($constructorPropertyNames);
protected function mutatesTo($oldInstance, $newInstance) {
return $oldInstance->equals($newInstance);
* Writes a TChart oboject with all of its settings by cycling to a file using serialization mechanism.
public function toFile($fileName) {
die("Unable to create file");
private function getProperties($value) {
return $this->Introspector->getBeanInfo($value)->
$this->getPropertyDescriptors();
} catch ( Excepction $ex) {
* Returns all properties in "value" Object that are different from their
* default values, in XML text format.
public function getXML($value= null) {
$value = $this->getChart();
$stream = new ByteArrayOutputStream();
$this->toXML($value, $stream);
return new String($stream->toByteArray());
* Stores all chart properties to a file in XML format using Java
* @throws FileNotFoundException
public function toXML($file) /* TODO throws FileNotFoundException*/ {
$this->toXML($file->getPath());
* Stores all chart properties to a file in XML format using Java
* @throws FileNotFoundException
/*public function toXML($fileName) TODO throws FileNotFoundException {
$this->toXML(new BufferedOutputStream(
new FileOutputStream($fileName)));
* Stores all chart properties to stream, in XML text format using
* @param stream OutputStream
public function toXML($stream) {
$this->toXML($this->getChart(), $stream);
private function prepareTransients() {
$this->PropertyDescriptor[] $this->propertyDescriptors = $this->getProperties($this->Chart->class);
for ( $i = 0; $i < $this->propertyDescriptors->length; ++$i) {
$pd = $this->propertyDescriptors[$i];
if ($pd->getName()->equals("graphics3D")) {
$tmpBoolean = new Boolean();
$pd->setValue("/*transient*//*", $tmpBoolean->TRUE);
$this->PropertyDescriptor[] $this->propertyDescriptors2 = $this->getProperties($this->TeeBase->class);
for ( $i = 0; $i < $propertyDescriptors2->length; ++$i) {
$pd = $propertyDescriptors2[$i];
if ($pd->getName()->equals("chart")) {
$pd->setValue("/*transient", $tmpBoolean->TRUE);
$this->PropertyDescriptor[] $this->propertyDescriptors3 = $this->getProperties($this->Series->class);
for ( $i = 0; $i < $propertyDescriptors3->length; ++$i) {
$pd = $propertyDescriptors3[$i];
if (($pd->getName()->equals("endZ")) ||
($this->pd->getName()->equals("middleZ")) ||
($this->pd->getName()->equals("startZ"))) {
$pd->setValue("/*transient", $tmpBoolean->TRUE);
* Stores value object properties to stream, in XML text format using
* @param stream OutputStream
/* TODO public function toXML($value, $stream) {
$xe = new XMLEncoder($stream);
$xe->setExceptionListener(new ExceptionListener() {
public function exceptionThrown($exception) {
$exception->printStackTrace();
$this->prepareTransients();
$colorDel = new ColorPersistenceDelegate(
new String[] {"Red", "Green", "Blue", "Alpha"});
$this->xe->setPersistenceDelegate($this->Color->class, $colorDel);
$this->xe->writeObject($this->value);
* Writes all non-transient chart fields to a stream using Java standard
* serialization mechanism.
* @param stream OutputStream
/* public function toStream($stream) todo throws IOException {
$out = new ObjectOutputStream($stream);
$this->prepareTransients();
$out->writeObject($this->chart);
|