Source for file TextFormat.php
Documentation is available at TextFormat.php
* Description: Chart data export to Text
* @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);
return (string) $tmpResult;
private function headerSeriesTitle($aSeries) {
$tmpResult= $tmpResult . $aSeries->toString() . self::textDelimiter();
$tmpResult= $tmpResult . $aSeries->toString() . self::textDelimiter();
$tmpResult= $tmpResult . $aSeries->toString() . self::textDelimiter();
$tmpResult= $tmpResult . self::textDelimiter();
for ( $t = 2; $t < sizeof($aSeries->getValuesLists()); $t++ ) {
$tmpResult= $tmpResult . self::textDelimiter();
private function headerSeries($aSeries) {
$tmpResult= $tmpResult . self::textDelimiter();
$tmpResult= $tmpResult . $aSeries->getNotMandatory()->getName();
$tmpResult= $tmpResult . self::textDelimiter();
$tmpResult= $tmpResult . $aSeries->getMandatory()->getName();
for ( $t = 2; $t < sizeof($aSeries->getValuesLists()); $t++ ) {
$tmpResult= $tmpResult . (self::textDelimiter() . $aSeries->getValueList($t)->getName());
private function headerTitle() {
//CDI - each column should be headed by the name of the valuelist
//new header line with Series.ToString() added.
$tmpResult= $tmpResult . self::textDelimiter();
$tmpResult= $tmpResult . $this->headerSeriesTitle($this->series);
for ( $t = 0; $t < $this->chart->getSeriesCount(); $t++ ) {
$tmpResult= $tmpResult . $this->headerSeriesTitle($this->chart->getSeries($t));
$tmpResult= substr($tmpResult,0,$length- 1);
private function header() {
$tmpResult= $tmpResult . ($this->getIncludeIndex() ? /* TODO $this->Language->getString(*/"Index"/*)*/ : "");
if (strlen($tmpResult) != 0) {
$tmpResult= $tmpResult . self::textDelimiter();
$tmpResult= $tmpResult . $this->headerSeries($this->series);
if ($this->chart->getSeriesCount() > 0) {
$tmpResult= $tmpResult . $this->headerSeries($this->chart->getSeries(0));
for ( $t = 1; $t < $this->chart->getSeriesCount(); $t++ ) {
$tmpResult= $tmpResult . (self::textDelimiter() . $this->headerSeries($this->chart->getSeries($t)));
$result= $result . self::textDelimiter()+ $this->doSeries($index, $this->series);
for ( $t = 0; $t < $this->chart->getSeriesCount(); $t++ ) {
$result= $result . self::textDelimiter() . $this->doSeries($index, $this->chart->getSeries($t));
if(substr($result,0,strlen(self::textDelimiter()))== self::textDelimiter()) {
$result= str_replace(self::textDelimiter(), "",$result);
private function add($st, $result) {
return $result . self::textDelimiter() . $st;
private function doSeries($index, $aSeries) {
/* the point Label text, if exists */
if ( /*($this->tmpNum==1)&&*/($this->hasLabels)) { //$this->CDI $this->let' for $the $this->series
if ($aSeries->getCount() > $index) {
$labels= $aSeries->getLabels();
(string) $result= $this->add($labels[$index], $result);
(string) $result= $this->add("", $result);
/* the "X" point value, if exists */
//add(FloatToStr(ASeries.NotMandatoryValueList.Value[Index]));
if ($aSeries->getCount() > $index) {
(string) $result= $this->add($aSeries->getNotMandatory()->getValue($index),
(string) $result= $this->add("", $result);
/* the "Y" point value */
if ($aSeries->getCount() > $index) {
(string) $result= $this->add($aSeries->getMandatory()->getValue($index), $result);
(string) $result= $this->add("", $result);
/* write the rest of values (always) */
for ( $tt = 2; $tt < sizeof($aSeries->getValuesLists()); $tt++ ) {
if ($aSeries->getCount() > $index) {
$result = $result . self::textDelimiter() .
$aSeries->getValueList($tt)->getValue($index);
$result = $result . self::textDelimiter() . "";
if(substr($result,0,strlen(self::textDelimiter()))== self::textDelimiter()) {
$result= str_replace(self::textDelimiter(), "",$result);
|