Source for file AxisLabels.php
Documentation is available at AxisLabels.php
* Description: Axis Label characteristics
* @copyright (c) 1995-2008 by Steema Software SL. All Rights Reserved. <info@steema.com>
* @link http://www.steema.com
private $multiline= false;
private $exactDateTime = true;
private $roundfirstlabel = true;
private $labelsAlternate= false;
protected $axisvaluesformat; // = "DefValueFormat"; // $Language.getString("DefValueFormat");
public $axis; // protected before
function __get( $property ) {
$method = "get{$property}";
function __set ( $property,$value ) {
$method = "set{$property}";
return $this->$method($value);
* Accesses the Label characteristics of Axis Labels.
$this->align= AxisLabelAlign::$DEF;
self::$LOCALE = localeconv();
$this->valuesDecimal = $locale['decimal_point'];
// todo $this->valuesDecimal = new NumberFormat(); // TODO $this->Language->getString("DefValueFormat"));
* Determines whether Axis.Increment calculates Axis Labels in
* exact DateTime steps. <br>
* This is very useful when Axis.Increment is a DateTimeStep constant value.
* <br>When ExactDateTime is false (the default value), the OneMonth
* increment equals 30 days, and axis do not calculate how many days a
* The Series XValues or YValues properties should have DateTime = true.
* ( XValues for horizontal Axis and YValues for vertical Axis).
return $this->exactDateTime;
* Determines whether Axis.Increment calculates Axis Labels in
* exact DateTime steps. <br>
* Defines the rotation degree applied to each Axis Label. Valid angle
* in degrees are 0, 90, 180, 270 and 360. <br>
* Please note that some printers and video drivers fail when drawing
* rotated fonts or calculating the rotated font dimensions.
* Metafile Charts containing rotated fonts sometimes place text
* at sligthly different coordinates.
* Defines the rotation degree applied to each Axis Label.<br>
* Determines whether the Labels at Axis Minimum and Maximum positions
* will be shown or not.<br>
* Shows the Labels at Axis Minimum and Maximum positions when true.<br>
* Specifies the minimum distance between Axis Labels as a percentage.
* Setting it to "0" zero makes Axis skip calculating overlapping labels.
* (No clipping is performed). Labels visibility depends also on
* Labels.Font size, Labels.Angle and Axis.Increment properties. <br>
* Specifies the minimum distance between Axis Labels as a percentage.<br>
* Changes the spacing occupied by the axis labels between the Ticks and
return $this->customSize;
* Changes the spacing occupied by the axis labels between the Ticks and
* The style of the labels. Setting Axis.Label.Style to talAuto will
* force the Axis to guess what labels will be drawn. For each Active
* associated Series, if the Series have XLabels then the Label.Style
* will be talText. If no Series have XLabels, then Label.Style will be
* talValue. If no Active Series are associated with the Axis,
* then Label.Style will be talNone. <br>
* Default value: AxisLabelStyle.Auto
* Sets the style of the labels.<br>
* Default value: AxisLabelStyle.Auto
* @param value AxisLabelStyle
if ($this->iStyle != $value) {
* Controls if Axis labels will be automatically "rounded" to the nearest
* magnitude. Run-time only. This applies both to DateTime and non-DateTime
* axis values. When false, Axis labels will start at Maximum Axis value.<br>
return $this->roundfirstlabel;
* Axis labels will be automatically "rounded" to the nearest magnitude when
* Standard DateTime formatting string specifier used to draw the
* Standard DateTime formatting string specifier used to draw the
* Specifies the desired formatting string to be applied to Axis Labels.
* It has effect when Axis associated Series have their XValues.DateTime
* or YValues.DateTime property set to false.<br>
* For DateTime Axis labels use the AxisLabels.DateTimeFormat property.<br>
* ValueFormat is a standard formatting string specifier. Chart Axis uses
* it to draw the axis labels. Chart Series uses it to draw the Marks. <br>
* Default value: '#,##0.###'
* @return formatting String to be applied to Axis Labels.
* Specifies the desired formatting string to be applied to Axis Labels.<br>
* Default value: '#,##0.###'
// todo $this->valuesDecimal = new NumberFormat($this->axisvaluesformat);
* Automatically breaks DateTime Labels on occurence of a space " ".
* Use '\n' in other label types to break a line or use SplitInLines in
* the OnGetAxisLabel event. <br>
* Automatically breaks DateTime Labels on occurence of a space " ".<br>
* Sets Separator String to invoke 'new line' in String St. Replaces input
* string St with separator to be used to break lines at each occurrence
* @param separator String to be used for new line
$loc = $s->indexOf($separator, 0);
* Enables/disables the display of Axis Labels in exponent format with
* super-script fonts.<br>
* Enables/disables the display of Axis Labels in exponent format with
* super-script fonts.<br>
* The position of Labels on an Axis.<br>
* The default position of an AxisLabel will depend on the Axis with which
* it is associated. A Bottom Axis will place Labels below the Axis by
* default. A Top Axis will place the Labels above the Axis.<br>
* Default value: Default position <br>
* Opposite: Labels positioned on the opposite side to the default position.
* Sets the position of Labels on an Axis.<br>
* Default value: Default position
* @param value AxisLabelAlign
if ($this->align != $value) {
* Contains the custom labels.
* @return AxisLabelsItems
private function internalLabelSize($value, $isWidth) {
$tmpMulti = ($this->iAngle == 90) || ($this->iAngle == 270);
$result = $this->chart->getGraphics3D()->getFontHeight() * $tmp;
* returns the Axis Label width of the Value parameter. It uses the Axis
* formatting specifiers, the Axis Labels Font and the Labels rotation
* @param value double Axis value
* @return int Axis Label width in pixels
// int tmpResult=chart.MultiLineTextWidth(LabelValue(value),tmp);
// if ((angle==90) || (angle==270))
// tmpResult=chart.getGraphics3D().FontHeight*tmp;
return $this->internalLabelSize($value, true);
* returns the Axis Label height of the Value parameter. It uses the Axis
* formatting specifiers, the Axis Labels Font and the Labels rotation
* @param value double Axis value
* @return int Axis Label height in pixels
return $this->internalLabelSize($value, false);
// int tmpResult=chart.MultiLineTextWidth(LabelValue(value),out tmp);
// if ((angle==0) || (angle==180))
// tmpResult=chart.getGraphics3D().FontHeight*tmp;
* returns the corresponding text representation of the Value parameter.
* It uses the Axis formatting specifiers.
if ($this->axis->iAxisDateTime) {
//MM todo //if ((value >= -657435) && (value <= 2958466)){
$tmpResult = date($this->axis->dateTimeDefaultFormat($this->axis->iRange),$value);
$tmpResult = date($this->axis->dateTimeDefaultFormat($this->axis->iRange),$value);
//$locale = localeconv();
if (fmod((double) $value,1)!= 0) {
$decimals= self::$LOCALE['frac_digits'];
$tmpResult = number_format($value,$decimals,
self::$LOCALE['decimal_point'],
self::$LOCALE['thousands_sep']);
$locale['decimal_point'],
$locale['thousands_sep']);
$parent= $this->chart->getParent();
// Args : Axis, valueindex display order, label
$parent->TriggerEvent('OnGetAxisLabel', array($this->axis,$this->axis->labelIndex, $this->labelText));
* Gets the axis labels to be drawn in two rows or columns.
return $this->labelsAlternate;
* Gets the axis labels to be drawn in two rows or columns.
|