[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/Image/Graph/ -> Axis.php (sommaire)

Class for axis handling. PHP versions 4 and 5

Author: Jesper Veggerby <pear.nosey@veggerby.dk>
Copyright: Copyright (C) 2003, 2004 Jesper Veggerby Hansen
License: http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
Version: CVS: $Id: Axis.php,v 1.36 2006/03/15 19:57:04 nosey Exp $
Poids: 1690 lignes (58 kb)
Inclus ou requis: 2 fois
Référencé: 0 fois
Nécessite: 1 fichier
 Image/Graph/Plotarea/Element.php

Définit 1 class

Image_Graph_Axis:: (40 méthodes):
  Image_Graph_Axis()
  _pushValues()
  _setAxisPadding()
  _getTitleFont()
  showLabel()
  setDataPreProcessor()
  _getMinimum()
  _getMaximum()
  _setMinimum()
  _setMaximum()
  forceMinimum()
  forceMaximum()
  showArrow()
  hideArrow()
  _labelDistance()
  setLabelInterval()
  setLabelOption()
  setLabelOptions()
  setTitle()
  setFixedSize()
  _value()
  _applyDataset()
  _point()
  _intersectPoint()
  _calcDelta()
  _calcLabelInterval()
  _getNextLabel()
  _labelInterval()
  _size()
  addMark()
  _isNumeric()
  setTickOptions()
  setInverted()
  setAxisIntersection()
  _getAxisIntersection()
  _reset()
  _drawTick()
  _drawAxisLines()
  _updateCoords()
  _done()


Classe: Image_Graph_Axis  - X-Ref

Diplays a normal linear axis (either X- or Y-axis).

Image_Graph_Axis($type = IMAGE_GRAPH_AXIS_X)   X-Ref
Image_Graph_Axis [Constructor].
Normally a manual creation should not be necessary, axis are created
automatically by the {@link Image_Graph_Plotarea} constructor unless
explicitly defined otherwise

param: int $type The type (direction) of the Axis, use IMAGE_GRAPH_AXIS_X

_pushValues()   X-Ref
Push the values by 0.5 (for bar and step chart)


_setAxisPadding($where, $value)   X-Ref
Sets the axis padding for a given position ('low' or 'high')

param: string $where The position
param: int $value The number of pixels to "pad"

_getTitleFont()   X-Ref
Gets the font of the title.

If not font has been set, the parent font is propagated through it's
children.

return: array An associated array used for canvas

showLabel($value)   X-Ref
Shows a label for the the specified values.

Allowed values are  combinations of:
<ul>
<li>IMAGE_GRAPH_LABEL_MINIMUM
<li>IMAGE_GRAPH_LABEL_ZERO
<li>IMAGE_GRAPH_LABEL_MAXIMUM
</ul>
By default none of these are shows on the axis

param: int $value The values to show labels for

setDataPreProcessor(& $dataPreProcessor)   X-Ref
Sets a data preprocessor for formatting the axis labels

param: Image_Graph_DataPreprocessor $dataPreProcessor The data preprocessor

_getMinimum()   X-Ref
Gets the minimum value the axis will show

return: double The minumum value

_getMaximum()   X-Ref
Gets the maximum value the axis will show

return: double The maximum value

_setMinimum($minimum)   X-Ref
Sets the minimum value the axis will show

param: double $minimum The minumum value to use on the axis

_setMaximum($maximum)   X-Ref
Sets the maximum value the axis will show

param: double $maximum The maximum value to use on the axis

forceMinimum($minimum, $userEnforce = true)   X-Ref
Forces the minimum value of the axis

param: double $minimum The minumum value to use on the axis
param: bool $userEnforce This value should not be set, used internally

forceMaximum($maximum, $userEnforce = true)   X-Ref
Forces the maximum value of the axis

param: double $maximum The maximum value to use on the axis
param: bool $userEnforce This value should not be set, used internally

showArrow()   X-Ref
Show an arrow head on the 'end' of the axis


hideArrow()   X-Ref
Do not show an arrow head on the 'end' of the axis (default)


_labelDistance($level = 1)   X-Ref
Return the label distance.

param: int $level The label level to return the distance of
return: int The distance between 2 adjacent labels

setLabelInterval($labelInterval = 'auto', $level = 1)   X-Ref
Sets an interval for when labels are shown on the axis.

By default 'auto' is used, forcing the axis to calculate a approximate
best label interval to be used. Specify an array to use user-defined
values for labels.

param: mixed $labelInterval The interval with which labels are shown
param: int $level The label level to set the interval on

setLabelOption($option, $value, $level = 1)   X-Ref
Sets options for the label at a specific level.

Possible options are:

'showtext' true or false whether label text should be shown or not

'showoffset' should the label be shown at an offset, i.e. should the
label be shown at a position so that it does not overlap with prior
levels. Only applies to multilevel labels with text

'font' The font options as an associated array

'position' The position at which the labels are written ('inside' or
'outside' the axis). NB! This relative position only applies to the
default location of the axis, i.e. if an x-axis is inverted then
'outside' still refers to the "left" side of a normal y-axis (since this
is normally 'outside') but the actual output will be labels on the
"inside"!

'format' To format the label text according to a sprintf statement

'dateformat' To format the label as a date, fx. j. M Y = 29. Jun 2005

param: string $option The label option name (see detailed description
param: mixed $value The value for the option
param: int $level The label level to set the interval on

setLabelOptions($options, $level = 1)   X-Ref
Sets options for the label at a specific level.

The possible options are specified in {@link Image_Graph_Axis::
setLabelOption()}.

param: array $options An assciated array with label options
param: int $level The label level to set the interval on

setTitle($title, $font = false)   X-Ref
Sets the title of this axis.

This is used as an alternative (maybe better) method, than using layout's
for axis-title generation.

To use the current propagated font, but just set it vertically, simply
pass 'vertical' as second parameter for vertical alignment down-to-up or
'vertical2' for up-to-down alignment.

param: string $title The title of this axis
param: Image_Graph_Font $font The font used for the title

setFixedSize($size)   X-Ref
Sets a fixed "size" for the axis.

If the axis is any type of y-axis the size relates to the width of the
axis, if an x-axis is concerned the size is the height.

param: int $size The fixed size of the axis

_value($value)   X-Ref
Preprocessor for values, ie for using logarithmic axis

param: double $value The value to preprocess
return: double The preprocessed value

_applyDataset(&$dataset)   X-Ref
Apply the dataset to the axis

param: Image_Graph_Dataset $dataset The dataset

_point($value)   X-Ref
Get the pixel position represented by a value on the canvas

param: double $value the value to get the pixel-point for
return: double The pixel position along the axis

_intersectPoint($value)   X-Ref
Get the axis intersection pixel position

This is only to be called prior to output! I.e. between the user
invokation of Image_Graph::done() and any actual output is performed.
This is because it can change the axis range.

param: double $value the intersection value to get the pixel-point for
return: double The pixel position along the axis

_calcDelta()   X-Ref
Calculate the delta value (the number of pixels representing one unit
on the axis)

return: double The label interval

_calcLabelInterval()   X-Ref
Calculate the label interval

If explicitly defined this will be calucated to an approximate best.

return: double The label interval

_getNextLabel($currentLabel = false, $level = 1)   X-Ref
Get next label point

param: doubt $currentLabel The current label, if omitted or false, the
param: int $level The label level to get the next label from
return: double The next label point

_labelInterval($level = 1)   X-Ref
Get the interval with which labels are shown on the axis.

If explicitly defined this will be calucated to an approximate best.

param: int $level The label level to get the label interval for
return: double The label interval

_size()   X-Ref
Get the size in pixels of the axis.

For an x-axis this is the width of the axis including labels, and for an
y-axis it is the corrresponding height

return: int The size of the axis

addMark($value, $value2 = false, $text = false)   X-Ref
Adds a mark to the axis at the specified value

param: double $value The value
param: double $value2 The second value (for a ranged mark)

_isNumeric()   X-Ref
Is the axis numeric or not?

return: bool True if numeric, false if not

setTickOptions($start, $end, $level = 1)   X-Ref
Set the major tick appearance.

The positions are specified in pixels relative to the axis, meaning that
a value of -1 for start will draw the major tick 'line' starting at 1
pixel outside (negative) value the axis (i.e. below an x-axis and to the
left of a normal y-axis).

param: int $start The start position relative to the axis
param: int $end The end position relative to the axis
param: int $level The label level to set the tick options for

setInverted($invert)   X-Ref
Invert the axis direction

If the minimum values are normally displayed fx. at the bottom setting
axis inversion to true, will cause the minimum values to be displayed at
the top and maximum at the bottom.

param: bool $invert True if the axis is to be inverted, false if not

setAxisIntersection($intersection, $axis = 'default')   X-Ref
Set axis intersection.

Sets the value at which the axis intersects other axis, fx. at which Y-
value the x-axis intersects the y-axis (normally at 0).

Possible values are 'default', 'min', 'max' or a number between axis min
and max (the value will automatically be limited to this range).

For a coordinate system with 2 y-axis, the x-axis can either intersect
the primary or the secondary y-axis. To make the x-axis intersect the
secondary y-axis at a given value pass IMAGE_GRAPH_AXIS_Y_SECONDARY as
second parameter.

param: mixed $intersection The value at which the axis intersect the
param: mixed $axis The axis to intersect. Only applies to x-axis with

_getAxisIntersection()   X-Ref
Get axis intersection data.

return: array An array with the axis intersection data.

_reset()   X-Ref
Resets the elements


_drawTick($value, $level = 1)   X-Ref
Output an axis tick mark.

param: int $value The value to output
param: int $level The label level to draw the tick for

_drawAxisLines()   X-Ref
Draws axis lines.


_updateCoords()   X-Ref
Causes the object to update all sub elements coordinates

(Image_Graph_Common, does not itself have coordinates, this is basically
an abstract method)


_done()   X-Ref
Output the axis

return: bool Was the output 'good' (true) or 'bad' (false).



Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7