CLASS SuperScriptText EXTENDS Text (Defined in: jpgraph.php : 3155)

SuperScriptText | Text
FromReal() GetFontHeight() GetTextHeight() GetWidth() Set() SetSuperFont() SuperScriptText() |

Class usage and Overview
This class is responsible for formatting a text string which have a superscript at the end. This is used to generate scientific numbers.

See also related classes:
Text

Class Methods

function FromReal($aVal,$aPrecision)
Create a scientific representation for a number

Argument | Default | Description
--- | --- | ---
$aVal |  | Real value to be used
$aPrecision | 2 | Precision (number of digits) to be printed

Description
Initialized the class from a real value to be used to present a scientific text string.
See also
SuperScriptText::Set

Example

$t = new SuperScriptText();
$t->FromReal(12341.56);
// Will print 1.23*10^4

function GetFontHeight(&$aImg)
Hight of font (approximate the height of the text)

Argument | Default | Description
--- | --- | ---
&$aImg |  | Image context

Description
Return height of text.
See also
SuperScriptText::GetTextHeight and SuperScriptText::GetWidth

function GetTextHeight(&$aImg)
Hight of text

Argument | Default | Description
--- | --- | ---
&$aImg |  | Image context

Description
Hight of text

function GetWidth(&$aImg)
Total width of text

Argument | Default | Description
--- | --- | ---
&$aImg |  | Image context

Description
Total width of text

function Set($aTxt,$aSuper)
Convert a floating point number to scientific notation

Argument | Default | Description
--- | --- | ---
$aTxt |  | Mantissa
$aSuper | "" | Exponent

Description
Specify the string manuall by specifyin mantissa and exponent.
See also
SuperScriptText::FromReal

Example

$t = new SuperScriptText();
$t->Set("1.34 10","5");
// Will generate "1.34 10^5"

function SetSuperFont($aFontFam,$aFontStyle,$aFontSize)
Manually set font to be used for superscript

Argument | Default | Description
--- | --- | ---
$aFontFam |  | Font family
$aFontStyle | FS_NORMAL | Font style
$aFontSize | 8 | Font size

Description
Used to manually specify font to be used for superscript. If not specified it will be detemined automatically based on the font used for the mantissa. The font for the superscript will be roughly 70% of the size of the base font.

function SuperScriptText($aTxt,$aSuper,$aXAbsPos,$aYAbsPos)
Constructor

Argument | Default | Description
--- | --- | ---
$aTxt | "" | Mantissa text
$aSuper | "" | Suoerscript text
$aXAbsPos | 0 | X-position (in pixels)
$aYAbsPos | 0 | Y-position (in pixels)

Description
Creates a new SUperSCriptClass
See also
Text::Text