Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcGraphFontOptions

Graph::ezcGraphFontOptions

Class ezcGraphFontOptions

Class containing the options for font configuration.

We try to fulfill two goals regarding font configuration. First, there should be a single point to configure the fonts used for the text areas in the chart. On the other hand, it should be possible to configure the fonts independently for each chart element.

The solution is that you can modify the global font configuration by accessing $graph->options->font. This takes effect on all chart elements unless you intentionally access the font configuration of an individual chart element. The following example shows, how this works.

  1.   $graph = new ezcGraphPieChart();
  2.   $graph->title = 'Access statistics';
  3.  
  4.   // Set the maximum font size to 8 for all chart elements
  5.   $graph->options->font->maxFontSize = 8;
  6.  
  7.   // Set the font size for the title independently to 14
  8.   $graph->title->font->maxFontSize = 14;
  9.  
  10.   // The following only affects all elements except the // title element,
  11.   // which now has its own font configuration.
  12.   //
  13.   // Keep in mind that the specified font is driver specific. A pure name
  14.   // works for the SVG driver, used here. The GD driver for example
  15.   // requires a path to a TTF file.
  16.   $graph->options->font->name = 'serif';
  17.  
  18.   $graph->data['Access statistics'] = new ezcGraphArrayDataSet( array(
  19.       'Mozilla' => 19113,
  20.       'Explorer' => 10917,
  21.       'Opera' => 1464,
  22.       'Safari' => 652,
  23.       'Konqueror' => 474,
  24.   ) );

Source for this file: /Graph/src/options/font.php

ezcBaseOptions
   |
   --ezcGraphFontOptions
Version:   //autogentag//

Properties

ezcGraphColor read/write $background
Background color. The actual area filled with the background color is influenced by the settings $padding and $minimizeBorder.
ezcGraphColor read/write $border
Border color for the text. The distance between the text and border is defined by the properties $padding and $minimizeBorder.
int read/write $borderWidth
With of the border. To enable the border you need to set the $border property to some color.
ezcGraphColor read/write $color
Font color.
float read/write $maxFontSize
Maximum font size for displayed texts.
float read/write $minFontSize
Minimum font size for displayed texts.
float read/write $minimalUsedFont
The minimal used font size for the current element group. This property is set by the driver to maintain this information and should not be used to configure the apperance of the chart. See $minFontSize instead.
bool read/write $minimizeBorder
Fit the border exactly around the text, or use the complete possible space. This setting is only relevant, when a border color has been set for the font.
string read/write $name
Name of font.
int read/write $padding
Padding between text and border.
string read/write $path
Path to font file.
bool read/write $textShadow
Draw shadow for texts. The color of the shadow is defined in the property $textShadowColor.
ezcGraphColor read/write $textShadowColor
Color of text shadow. If left at the default value "false"" the inverse color of the text color will be used.
int read/write $textShadowOffset
Offset for text shadow. This defines the distance the shadow is moved to the bottom left relative from the text position.
int read/write $type
Type of used font. May be one of the following:
  • TTF_FONT Native TTF fonts
  • PS_FONT PostScript Type1 fonts
  • FT2_FONT FreeType 2 fonts
The type is normally automatically detected when you set the path to the font file.

Member Variables

protected bool $pathChecked = false
Indicates if path already has been checked for correct font

Inherited Member Variables

From ezcBaseOptions
protected ezcBaseOptions::$properties

Method Summary

public void __set( $propertyName , $propertyValue )
Set an option value

Inherited Methods

From ezcBaseOptions
public ezcBaseOptions ezcBaseOptions::__construct()
Construct a new options object.
public void ezcBaseOptions::merge()
Merge an array into the actual options object.
public bool ezcBaseOptions::offsetExists()
Returns if an option exists.
public mixed ezcBaseOptions::offsetGet()
Returns an option value.
public void ezcBaseOptions::offsetSet()
Set an option.
public void ezcBaseOptions::offsetUnset()
Unset an option.

Methods

__set

void __set( string $propertyName , mixed $propertyValue )

Set an option value

Parameters:
Name Type Description
$propertyName string
$propertyValue mixed
Exceptions:
Type Description
ezcBasePropertyNotFoundException If a property is not defined in this class
Documentation generated by phpDocumentor 1.4.3