Source for file Chart.php
Documentation is available at Chart.php
* Description: Chart contents
* @copyright (c) 1995-2010 by Steema Software SL. All Rights Reserved. <info@steema.com>
* @link http://www.steema.com
private $autoRepaint= false;
private $listeners; // TeeEventListeners
private $savedScales; // AllAxisSavedScales
private $header, $subHeader;
private $footer, $subFooter;
private $tools; // ToolsCollection
private $animations; // AnimationsCollection
private $panning; // Scroll
protected $series; // SeriesCollection
function __get( $property ) {
$method = "get{$property}";
function __set ( $property,$value ) {
$method = "set{$property}";
return $this->$method($value);
function Chart($parent= null, $cursor= null) {
TChart::$controlName = ' Chart_';
// Apply Gradient temp..until Themes...
//$this->getPanel()->getGradient()->setVisible(true);
private function initFields() {
$this->series = new SeriesCollection($this);
$this->header = new Header($this);
$this->header->defaultText = "TeeChart";
$this->header->setText($this->header->defaultText);
$this->subHeader = new Header($this);
$this->footer = new Footer($this);
$this->subFooter = new Footer($this);
$this->walls = new Walls($this);
$this->export = new Exports($this);
$this->imports = new Imports($this);
// TODO $this->printer = new Printer($this);
* Main drawing procedure. Paints all Chart contents.
private function internalDraw($g) {
$this->seriesBeforeDraw();
$this->chartRect = $this->drawTitlesAndLegend($g, $rect, true);
$this->setSeriesZOrder();
$rect = $this->calcWallsRect($rect);
$this->setSeriesZPositions();
TChart::$controlName = 'Chart_';
if ($this->series->activeUseAxis() && ($this->walls->getVisible())) {
TChart::$controlName .= 'Walls_';
$this->walls->paint($g,$rect);
TChart::$controlName = 'Chart_';
if ($this->axes->getDrawBehind()) {
TChart::$controlName .= 'Axes_';
TChart::$controlName = 'Chart_';
$tmpChartDrawEvent = new ChartDrawEvent($this, ChartDrawEvent::$PAINTING,
$this->parent->doBeforeDrawSeries();
$oldStrAlign = $g->getTextAlign();
TChart::$controlName = 'Chart_';
if ($this->axes->getDepth()->getInverted()) {
for ($t = sizeof($this->series) - 1; $t >= 0; $t-- ) {
$s = $this->series->getSeries($t);
TChart::$controlName .= 'Series' . $t . '_';
for ($t = 0; $t < sizeof($this->series); $t++ ) {
$s = $this->series->getSeries($t);
TChart::$controlName .= 'Series' . $t . '_';
$g->setTextAlign($oldStrAlign);
if ($this->parent != null) {
$this->parent->doAfterDrawSeries();
TChart::$controlName = 'Chart_';
if (!$this->axes->getDrawBehind()) {
TChart::$controlName .= 'Axes_';
TChart::$controlName = 'Chart_';
$rect = $this->drawTitlesAndLegend($g, $rect, false);
// UTILS g.textOut(0, 0, 0, Integer.toString(numRedraws++));
private function readObject($in)
$in->defaultReadObject();
$this->aspect->setChart($this);
$this->panel->setChart($this);
$this->legend->setChart($this);
$this->header->setChart($this);
$this->subHeader->setChart($this);
$this->footer->setChart($this);
$this->subFooter->setChart($this);
$this->walls->setChart($this);
$this->axes->setChart($this);
$this->page->setChart($this);
$this->export->setChart($this);
$this->imports->setChart($this);
// TODO $this->printer->setChart($this);
$this->series->setChart($this);
$this->tools->setChart($this);
$parent->checkGraphics();
$this->graphics3D->setXCenter(($r->x + $r->getRight()) / 2);
$this->graphics3D->setYCenter(($r->y + $r->getBottom()) / 2);
$stream = new ByteArrayOutputStream();
$this->getExport()->getTemplate()->toStream($stream);
} catch (Exception $ex) {
$inputStream = new ByteArrayInputStream($stream->toByteArray());
$c = $c->getImport()->getTemplate()->fromStream($inputStream);
} catch (Exception $ex) {
public function image($width, $height) {
return $this->getExport()->getImage()->image($width, $height);
* (Read only) Used to get the four sides of the Chart (Left, Top,
* Sets the four sides of the Chart (Left, Top,
* The Chart width in pixels.
* Sets the Chart width in pixels.
* The Chart Height in pixels.
* Sets the Chart Height in pixels.
* Determines when Chart is being printed.
* Determines when Chart is being printed.
$tmpFunction = $series->getFunction();
static public function changeAllSeriesType($chart, $newClass) {
List $tmpList = new ArrayList(chart.getSeries());
Iterator it = tmpList.iterator();
Series s = (Series) it.next();
changeSeriesType(s, newClass);
$this->axes->getCustom()->clear();
* Returns array list of objects that implement the
* TeeEventListener interface.
* @return TeeEventListeners
if ($this->listeners == null) {
$this->listeners = new TeeEventListeners();
if ($this->listeners != null) {
$this->listeners->remove($sender);
$result = (($s != $source) && ($source instanceof Series) &&
(s.isValidSourceOf((Series) source)));
result = DataSeriesSource::isValidSource(source);
private function calcNumPages($a) {
// By default, one single page.
// Calc max number of points for all active series associated to "a" axis.
for ($t = 0; $t < $this->series->count(); $t++ ) {
$s = $this->series->getSeries($t);
if ($s->getActive() && $s->associatedToAxis($a)) {
if ($firstTime || ($s->getCount() > $tmp)) {
// If there are points... divide into pages... }
$result = $tmp / $this->page->getMaxPointsPerPage();
// Extra page for remaining points...
if (($tmp % $this->page->getMaxPointsPerPage()) > 0) {
// restore the "remembered" axis scales when unzooming
static private function restoreAxisScales($a= null, $tmp= null) {
if(($a== null) && ($tmp== null)) {
$this->restoreScales($this->savedScales);
$a->setAutomatic($tmp->auto);
$a->setAutomaticMinimum($tmp->autoMin);
$a->setAutomaticMaximum($tmp->autoMax);
if (!$a->getAutomatic()) {
$a->setMinMax($tmp->min, $tmp->max);
if (($this->page->getMaxPointsPerPage() > 0) && ($this->getSeries()->count() > 0)) {
if ($this->getSeries()->getSeries(0)->getYMandatory()) {
return max($this->calcNumPages($this->axes->getTop()),
$this->calcNumPages($this->axes->getBottom()));
return max($this->calcNumPages($this->axes->getLeft()),
$this->calcNumPages($this->axes->getRight()));
* Displays a text box at the cursor.
if ($this->toolTip == null) {
$this->toolTip = new ToolTip($this);
* Returns the Active series (visible) that corresponds to the
* ItemIndex position in the Legend.<br>
* When the Legend style is "Series", returns the series that corresponds
* to the Legend "ItemIndex" position. The "OnlyActive" parameter, when
* false takes into account all series, visibly active or not.
* @return Series that corresponds to the ItemIndex position in the Legend
* Returns the Series.Title string.
* @param onlyActive boolean
return ($tmpSeries != null) ? $tmpSeries->toString() : "";
private function seriesBeforeDraw() {
$s = $this->series->getSeries($t);
* Accesses the Zoom characteristics of the Chart.
if ($this->zoom == null) {
* Sets the scrolling direction or denies scrolling.
if ($this->panning == null) {
$this->panning = new Scroll($this);
$this->panning = $panning;
private function calcSize3DWalls() {
if ($this->aspect->getView3D()) {
$tmp = 0.001 * $this->aspect->getChart3DPercent();
if (!$this->aspect->getOrthogonal()) {
if ($this->aspect->getOrthogonal()) {
$tmpSin = sin($this->aspect->getOrthoAngle() *
$tmpCos = cos($this->aspect->getOrthoAngle() *
$tmp = $tmpSin / $tmpCos;
$tmpNumSeries = $this->aspect->getApplyZOrder() ?
return $this->series->indexOf($value);
* Collection of Series contained in this Chart.
* @return SeriesCollection
* Returns the Series at seriesIndex
* @param int $seriesIndex
return $this->series->getSeries($seriesIndex);
private function checkTitle($t, $e, $c) {
$this->parent->checkTitle($t, $e, $c);
// "remember" the axis scales when zooming, to restore if unzooming.
static private function saveAxisScales($a) {
$result->auto = $a->getAutomatic();
$result->autoMin = $a->getAutomaticMinimum();
$result->autoMax = $a->getAutomaticMaximum();
$result->min = $a->getMinimum();
$result->max = $a->getMaximum();
private function saveScales() {
$result->top = self::saveAxisScales($this->getAxes()->getTop());
$result->bottom = self::saveAxisScales($this->getAxes()->getBottom());
$result->left = self::saveAxisScales($this->getAxes()->getLeft());
$result->right = self::saveAxisScales($this->getAxes()->getRight());
private function restoreScales($s) {
$this->restoreAxisScales($this->getAxes()->getTop(), $s->top);
$this->restoreAxisScales($this->getAxes()->getBottom(), $s->bottom);
$this->restoreAxisScales($this->getAxes()->getLeft(), $s->left);
$this->restoreAxisScales($this->getAxes()->getRight(), $s->right);
public function doZoom($topx, $topy, $bottomx, $bottomy, $leftx, $lefty, $rightx, $righty) {
$this->savedScales = $this->saveScales();
/* TODO not support for animation
if ($this->getZoom()->getAnimated()) {
$this->doZoomAnimated(top.x, top.y, bot.x, bot.y, lef.x, lef.y, rig.x,
$this->getAxes()->getLeft()->setMinMax($lef->x, $lef->y);
$this->getAxes()->getRight()->setMinMax($rig->x, $rig->y);
$this->getAxes()->getTop()->setMinMax($top->x, $top->y);
$this->getAxes()->getBottom()->setMinMax($bot->x, $bot->y);
$this->parent->doZoomed($this);
* Obsolete.Please use tChart1.<!-- -->Zoom.<!-- -->Undo method.
private function activeSeriesUseAxis() {
$s = $this->series->getSeries($t);
if ($s->getActive() && $s->getUseAxis()) {
// if ((!aBrush.Solid) && (AColor==aBackColor))
// if (aBackColor==Color.black) aColor=Color.WHITE; else aColor=Color.black;
$this->graphics3D->getBrush()->setColor($aColor); ////#1482 ColorEach
* Returns the number of active (visible) series.<br>
* CanClip returns if the Chart Drawing Canvas has the capability of
* "clipping" lines and polygons.<br>
* "Clipping" means the feature that allows hiding drawing outside the
* rectangle or polygon specifed by the developer.<br>
* CanClip returns false when the Chart is displayed in OpenGL 3D, or when
* the Chart is printed and the TeeClipWhenPrinting constant is true, or
* when the Chart is converted to a metafile image and the
* TeeClipWhenMetafiling constant is true. <br>
* By default all display drivers and printers support clipping. You can
* turn off the clipping constants in case the printer or display driver
* has a bug related to clipping. <br>
* ClipPoints, TeeClipWhenPrinting, TeeClipWhenMetafiling, ClipCanvas,
* UnClipCanvas, ClipRoundRectangle and ClipPolygon.
return (!$this->graphics3D->getSupportsFullRotation()) &&
private function calcWallsRect($r) {
$this->calcSize3DWalls();
if ($this->aspect->getView3D() && $this->aspect->getOrthogonal()) {
if ($this->activeSeriesUseAxis()) {
$tmp = $this->getWalls()->getBack()->getSize();
$r->width -= abs($this->aspect->width3D) + $tmp;
if ($this->getWalls()->getRight()->getVisible()) {
$r->width -= $this->getWalls()->getRight()->getSize() + 1;
* Returns if no series are active (visible) and associated to the
private function noActiveSeries($a) {
for ($t = 0; $t < $this->series->count(); $t++ ) {
$s = $this->series->getSeries($t);
if ($s->getActive() && $s->associatedToAxis($a)) {
* Returns the first Series that depends on the specified Axis.<br>
* If no Series depends on Axis, the null value is returned.
if (($s->getActive() || $this->noActiveSeries($axis)) &&
$s->associatedToAxis($axis)) {
if ($aAxis->isDepthAxis) {
for ($t = 0; $t < $this->series->count(); $t++ ) {
$s = $this->series->getSeries($t);
$tmp = $isMin ? $s->getMinZValue() : $s->getMaxZValue();
if ($firstTime || (isMin && (tmp < tmpResult)) ||
((!$isMin) && ($tmp > $tmpResult))) {
$tmpResult = $isMin ? - 0.5 : $this->maxZOrder + 0.5;
$tmpPagingAxis = ($tmpSeries != null) ?
$tmpSeries->getYMandatory() ?
if (($this->page->getMaxPointsPerPage() > 0) && $tmpPagingAxis) {
if (($tmpSeries != null) && ($tmpSeries->getCount() > 0)) {
$tmpList = $isX ? $tmpSeries->getXValues() :
$tmpSeries->getYValues();
$tmpFirstPoint = ($this->page->getCurrent() - 1) *
$this->page->getMaxPointsPerPage();
$tmpCount = $tmpSeries->getCount();
if ($tmpCount <= $tmpFirstPoint) {
$tmpFirstPoint = (max(0,($tmpCount /
$this->page->getMaxPointsPerPage()) - 1) *
$this->page->getMaxPointsPerPage());
$tmpLastPoint = $tmpFirstPoint +
$this->page->getMaxPointsPerPage() - 1;
if ($tmpCount <= $tmpLastPoint) {
$tmpLastPoint = $tmpFirstPoint +
$this->page->getMaxPointsPerPage()) - 1;
$tmpResult = $tmpList->value[$tmpFirstPoint];
$tmpResult = $tmpList->value[$tmpLastPoint];
if (!$this->page->getScaleLastPage()) {
$tmpNumPoints = $tmpLastPoint - $tmpFirstPoint + 1;
if ($tmpNumPoints < $this->page->getMaxPointsPerPage()) {
$tmp = $tmpList->value[$tmpFirstPoint];
$this->page->getMaxPointsPerPage() *
$s = $this->series->getSeries($t);
if (($s->getActive() || $this->noActiveSeries($aAxis)) &&
($s->getHorizAxis() === $aAxis))) ||
(($s->getVerticalAxis() == VerticalAxis::$BOTH) ||
($s->getVertAxis() === $aAxis)))) {
$tmp = $isX ? $s->getMinXValue() :
$tmp = $isX ? $s->getMaxXValue() :
if ($firstTime || ($isMin && ($tmp < $tmpResult)) ||
((!$isMin) && ($tmp > $tmpResult))) {
* Returns the Maximum width in pixels of all Series Labels, whether
* This applies only to Series which have Labels.
$s = $this->series->getSeries($t);
for ($tt = 0; $tt < $s->getCount(); $tt++ ) {
$tmpResult = max($tmpResult,
* Returns the Maximum width of the Active Series Marks.<br>
* Series Marks must be Visible. This can be used to adjust the Chart
* Margins in order to accomodate the biggest Series Mark.
for ($t = 0; $t < $this->series->count(); $t++ ) {
$s = $this->series->getSeries($t);
$tmpResult = max($tmpResult, $s->maxMarkWidth());
private function calcString($result, $st) {
$result->tmpResult = max($result->tmpResult,
// Note our use of ===. Simply == would not work as expected
// because the position of 'a' was the 0th (first) character.
$result->width = $this->graphics3D->textWidth($s);
$r = $this->calcString($r, $s->substring(0, $i + 1));
$tmpResult = $r->tmpResult;
$s = $s->substring($i + 1);
$result->count = $r->numLines;
$result->width = $r->tmpResult;
$result->width = max($tmpResult, $this->graphics3D->textWidth($s));
* Returns the Maximum Value of the Series X Values List.
* Returns the highest of all the current Series Y point values.
* Returns the Minimum Value of the Series X Values List.
* Returns the Minimum Value of the Series Y Values List.
* Returns whether the AColor parameter is used by any Series or not.
* @param checkBackground boolean When true, uses current Chart background
$isUsed = ($checkBackground &&
(($color == $this->panel->getColor()) ||
($color == $this->walls->getBack()->getColor())));
for ($t = 0; $t < $this->series->count(); $t++ ) {
$s = $this->series->getSeries($t);
if (($s->getColor() == $color) || $isUsed) {
* Returns a color from the default color palette not used by any Series.
* The CheckBackGround parameter controls if the returned color should
* or shouldn't be the Chart BackColor color. This function returns a
* Color which is not used by any Series in the Chart.
* @param checkBackground boolean
return new Color(255,255,255);
$result = $g->getDefaultColor($t);
} while ($t < $g->getColorPaletteLength());
return $g->getDefaultColor(0);
* Default indexer.<br><br>
* Example:<pre><font face="Courier" size="4">
* tChart1[0].Color=Color.Blue;
* tChart1.Series[0].Color=Color.Blue;
return $this->series->getSeries($index);
public function setItem($index, $value) {
$this->series->setSeries($index, $value);
// Steps to determine if an axis is Visible:
// 1) The global Chart.AxisVisible property is True... and...
// 2) The Axis Visible property is True... and...
// 3) At least there is a Series Active and associated to the axis and
// the Series has the "UseAxis" property True.
$result = ($this->axes->getVisible() && $a->getVisible());
if ($result) { // if still visible...
return $this->aspect->getView3D();
$s = $this->series->getSeries($t);
$result = $s->associatedToAxis($a);
* Returns first active (visible) series.
for ($t = 0; $t < $this->series->count(); $t++ ) {
$s = $this->series->getSeries($t);
private function axisRect($a, $r) {
if($a != $a->getChart()->getAxes()->getDepthTop())
$a->calcRect($oldR,true);
$a->calcRect($oldR,false);
private function calcAxisRect() {
$this->axes->adjustMaxMin();
$this->axes->internalCalcPositions();
$tmpR = $this->axisRect($this->axes->getLeft(), $tmpR);
$tmpR = $this->axisRect($this->axes->getTop(), $tmpR);
$tmpR = $this->axisRect($this->axes->getRight(), $tmpR);
$tmpR = $this->axisRect($this->axes->getBottom(), $tmpR);
$tmpR = $this->axisRect($this->axes->getDepth(), $tmpR);
$tmpR = $this->axisRect($this->axes->getDepthTop(), $tmpR);
for ($t = 0; $t < sizeof($this->axes->getCustom()); $t++ ) {
$a = $this->axes->getCustom()->getAxis($t);
$tmpR = $a->calcRect($tmpR, false); // <-- inflate only for first 4 axes
$this->axes->internalCalcPositions(); // recalc again
private function setSeriesZOrder() {
$ok = ($this->aspect->getApplyZOrder() && $this->aspect->getView3D());
$s = $this->series->getSeries($t);
if (!$this->axes->getDepth()->getInverted()) { // 6.01
$s = $this->series->getSeries($t);
$s->iZOrder = $ok ? $this->maxZOrder - $s->getZOrder() : 0;
* Returns the String to display at Legend for a given series and point
* In other words it returns the string representation of a Series
* Point value just as it would appear in Chart.Legend. The ValueIndex
* parameter is the point index. Legend.TextStyle and all other
* TChartLegend methods are used to create the resulting string.
return ($aSeries != null) ?
$this->legend->formattedValue($aSeries, $valueIndex) :
private function setSeriesZPositions() {
$s = $this->series->getSeries($t);
private function calcSeriesAxisRect($axis) {
$tmpSeries = $this->series->getSeries($t);
if ($tmpSeries->getActive()) {
if ($tmpSeries->associatedToAxis($axis)) {
if ($axis->getHorizontal()) {
$tmpSeries->calcHorizMargins($margins);
if ($axis->getAutomaticMinimum()) {
$tmpLeft = max($tmpLeft, $margins->min);
if ($axis->getAutomaticMaximum()) {
$tmpRight = max($tmpRight, $margins->max);
$tmpSeries->calcVerticalMargins($margins);
if ($axis->getAutomaticMaximum()) {
$tmpTop = max($tmpTop, $margins->min);
if ($axis->getAutomaticMinimum()) {
$tmpBottom = max($tmpBottom, $margins->max);
// Apply offsets in pixels
if ($axis->getHorizontal()) {
$tmpLeft += $axis->getMinimumOffset();
$tmpRight += $axis->getMaximumOffset();
$tmpTop += $axis->getMaximumOffset();
$tmpBottom += $axis->getMinimumOffset();
private function calcSeriesRect() {
for ($i = 0; $i < $this->axes->getCount(); $i++ ) {
$this->calcSeriesAxisRect($this->axes->getAxis($i));
private function drawTitleFoot($g, $rect, $customOnly) {
$rect = $this->header->doDraw($g, $rect, $customOnly);
$rect = $this->subHeader->doDraw($g, $rect, $customOnly);
$rect = $this->footer->doDraw($g, $rect, $customOnly);
$rect = $this->subFooter->doDraw($g, $rect, $customOnly);
private function shouldDrawLegend() {
return $this->legend->getVisible() &&
if ($this->legend->getVisible()) {
$this->legend->paint($g, $tmp);
if ($this->legend->getLastValue() >= $this->legend->getFirstValue()) {
$tmp = $this->legend->resizeChartRect($tmp);
private function drawRightWallAfter() {
$this->walls->calcWallSize($this->axes->getBottom()),
$this->walls->getBack()->getSize());
private function drawTitlesAndLegend($g, $tmp, $beforeSeries) {
// draw titles and legend before series
if ((!$this->legend->getCustomPosition()) && $this->shouldDrawLegend()) {
if ($this->legend->getVertical()) {
$tmp = $this->drawTitleFoot($g, $tmp, false);
$tmp = $this->drawTitleFoot($g, $tmp, false);
$tmp = $this->drawTitleFoot($g, $tmp, false);
if ($this->legend->getCustomPosition() && $this->shouldDrawLegend()) {
$tmp = $this->drawTitleFoot($g, $tmp, true);
if ($this->activeSeriesUseAxis()) {
if ($this->getAspect()->getView3D() && $this->walls->getView3D()) {
if ($this->walls->getRight()->getVisible() && $this->drawRightWallAfter()) {
$this->walls->getRight()->paint($g, $tmp);
if ($this->walls->getLeft()->getVisible() &&
($this->getAspect()->getRotation() < 270))) {
$this->walls->getLeft()->paint($g, $tmp);
$this->axes->getLeft()->hideBackGrid = true;
$this->axes->getLeft()->draw($g, false);
$this->axes->getLeft()->hideBackGrid = false;
* Returns the number of active (visible) series.<br>
* In other words it is a count of Series in Chart that have their Active
* @return int Number of Active (visible) Series.
for ($t = 0; $t < $this->series->count(); $t++ ) {
$s = $this->series->getSeries($t);
return $this->axes->getCustom()->indexOf($axis) != - 1;
* Returns the series that corresponds to the Legend "ItemIndex" position,
* when the Legend style is "Series".<br>
* The "OnlyActive" parameter, when false, takes into account all series,
* @param onlyActive boolean
for ($t = 0; $t < $this->series->count(); $t++ ) {
$s = $this->series->getSeries($t);
if ($s->getShowInLegend() && ((!$onlyActive) || $s->getActive())) {
if ($tmp == $itemIndex) {
* Returns the text string corresponding to a Legend position.<br>
* The Legend position depends on Legend.LegendStyle.<br>
* If LegendStyle is lsSeries, then the text string will be the
* SeriesOrValueIndexth Active Series Title.<br>
* If LegendStyle is lsValues, then the text string will be the formatted
* SeriesOrValueIndexth value of the first Active Series in the Chart.<br>
* If LegendStyle is lsAuto and only one Active Series exists in the Chart,
* then the LegendStyle is considered to be lsValues.<br>
* If there's more than one Active Series then LegendStyle will be lsSeries.
* @param seriesOrValueIndex int
$tmp = $this->legend->formattedLegend($seriesOrValueIndex);
if ($this->parent != null) {
$tmp = $this->parent->getLegendResolver()->getItemText(
$this->legend->iLegendStyle,
for ($t = 0; $t < $this->series->count(); $t++ ) {
$s = $this->series->getSeries($t);
if ($s->getActive() && ($firstTime || ($s->getCount() > $result))) {
$result = $s->getCount();
* Accesses all visible Background attributes..
$this->panel->setChart($this);
* Sets instance that implements the IChart interface.
* Printing related attributes.
$this->printer->setChart($this);
* Accesses multiple page characteristics of the Chart.
$this->page->setChart($this);
* Determines the Legend characteristics.<br>
* Legend determines the text and drawing attributes of Chart's textual
* representation of Series and Series values. <br>
* The Legend class draws a rectangle and for each Series in a Chart (or
* for each point in a Series) outputs a text representation of that
* Series (or that point). You can use the Legend.LegendStyle and
* Legend.TextStyle to control the text used to draw the legend. <br>
* The Legend can be positioned at Left, Right, Top and Bottom chart sides
* using Legend.Alignment. <br>
* Use Legend.Visible to show / hide the Legend. <br>
* Inverted makes Legend draw text starting from bottom.<br>
* Frame, Font and Color allow you to change the Legend appearance.<br>
* Legend.ColorWidth determines the percent width of each item's "colored"
* Legend.FirstValue controls which Series (or Series point) will be
* used to draw first Legend item.
$this->legend->setChart($this);
* Defines the Text and formatting attributes to be drawn at the top of
* Use Text to enter the desired Header lines, set Visible to true and
* change Font, Frame and Brush. Use Alignment to control text output
$this->header->setChart($this);
* Obsolete. Please use Header instead.
* Obsolete. Please use SubHeader instead.
* Defines the Text and formatting attributes to be drawn at the top of
* the Chart, just below the Header text.<br>
* Use Text to enter the desired SubHeader lines, set Visible to true and
* change Font, Frame and Brush.<br>
* Use Alignment to control text output position.
$this->subHeader = $value;
$this->subHeader->setChart($this);
* Defines the Text and formatting attributes to be drawn at the bottom of
* Use Text to enter the desired Footer lines, set Visible to true and
* change Font, Frame and Brush.<br>
* Use Alignment to control text output position.
$this->footer->setChart($this);
* Defines the Text and formatting attributes to be drawn at the bottom of
* the Chart, just above the Footer text.<br>
* Use Text to enter the desired SubFooter lines, set Visible to true and
* change Font, Frame and Brush.<br>
* Use Alignment to control text output position.
$this->subFooter = $value;
$this->subFooter->setChart($this);
$this->aspect->setChart($this);
* Accesses TeeChart Draw attributes.
* Gets the index'th tool in getTools() collection
return $this->tools->getTool($index);
* Collection of Tool components contained in this Chart.
* @return ToolsCollection
$this->tools->chart = $this;
* Gets the index'th animation in getAnimations() collection
return $this->animations->getAnimation($index);
* Collection of Animation components contained in this Chart.
* @return AnimationsCollection
return $this->animations;
$this->animations = $value;
$this->animations->chart = $this;
* Accesses left, bottom and back wall characteristics of the Chart.
$this->walls->setChart($this);
* Accesses the five axes, Top, Left, Right, Bottom and z depthas well as
$this->axes->setChart($this);
* Accesses Chart export attributes.
$this->export->setChart($this);
* Accesses Chart import attributes.
$this->imports->setChart($this);
$this->series->moveTo($value, $newIndex);
* Removes a Series from the Chart series list, without disposing it.
$this->series->remove($value);
$result = $this->series->indexOf($value);
$result = $this->series->count() - 1;
* Returns if the Chart should automatically repaint itself when a
* property has been changed.
return $this->autoRepaint;
* Sets if this Chart should automatically repaint after a property change.
$this->autoRepaint = $value;
* Returns the rectangle that contains the four main Chart axes.
* Sets the rectangle to contain the four main Chart axes.
* Returns the number of Series associated to this Chart.
public function tools() {
public function paint() {
* Paints the Chart in your preferred Canvas and region.
public function _paint($g, $rect) {
TChart::$controlName = 'Chart_';
$this->autoRepaint = false;
// TODO $this->parent->doBeforeDraw();
if ((!getPrinter().isPrinting) ||
((getPrinter().isPrinting) &&
(getPrinter().getPrintPanelBackground()))) {*/
$this->parent->doDrawImage($g);
if (($this->zoom != null) && $this->zoom->getActive()) {
$this->parent->doAfterDraw();
for ($t = 0; $t < sizeof($this->tools); $t++ ) {
$s = $this->tools->getTool($t);
|