Running Swiff Chart Generator on UNIX systems


Contents

Supported UNIX systems
Configuring Swiff Chart Generator on UNIX systems
What does swfchart.ini contain?
Example of swfchart.ini configuration file
True Type fonts on UNIX systems
Accentuated or other special characters
Minimum Access Rights

Supported UNIX systems

Swiff Chart Generator runs on the following UNIX systems:


Configuring Swiff Chart Generator on UNIX systems

When running on UNIX systems, Swiff Chart Generator default parameters (including caching parameters) are stored in the configuration file named swfchart.ini. By default, swfchart.ini is stored in the installation directory (/usr/local/SwiffChart/swfchart.ini for example).

The directory where the swfchart.ini is located can be changed by setting the environment variable $SWIFF_CHART_HOME to the desired installation path.

Example:
If the environment variable is set as follows:

SWIFF_CHART_HOME=/usr/SwiffChart
export SWIFF_CHART_HOME
then Swiff Chart Generator will look for the following configuration file:
/usr/SwiffChart/swfchart.ini

Note: The environment variable should be defined before running Apache.

What does swfchart.ini contain?

swfchart.ini actually enumerates all the parameters required by Swiff Chart Generator for correctly generating charts on UNIX systems. The table below lists all the parameters included in swfchart.ini:

Parameter Value Definition Default value Example
MaxCacheSize Integer (in KB) An integer value which specifies the maximum size of the cache in KB (see SetMaxCacheSize for more information) 4096 MaxCacheSize=16000
CacheName String A string value which specifies the location of the cache on the web server (see SetCacheName for more information) /charts_cache CacheName=/cache
PrivateCache Pathname A pathname which specifies the location of the private cache directory on the file system (see SetPrivateCacheDir for more information) Not used PrivateCache=/var/cache/swfchart
ForceCache 0 or 1 Specifies whether Swiff Chart Generator should force the use of the cache for all chart requests or not (see UseCache for more information) 0 ForceCache=1
TTFontsDir dir1:dir2:... Specifies the list of directories where the True Type fonts required for generating charts are located. (see SetTTFontsDir for more information) required TTFontsDir=/usr/share/fonts
TTFontsDir=/home/mike/ttf:/usr/share/fonts

Important Note: Each parameter listed above is overriden by their associated PHP methods. For example, if TTFontsDir=/usr/share/fonts in swfchart.ini, and if in the same time the PHP program executes $chart->SetTTFontsDir( "/home/mike/my_fonts" ) then Swiff Chart Generator will use "/home/mike/my_fonts" as the True Type font directory.


Example of swfchart.ini configuration file

Example of swfchart.ini file:

TTFontsDir=/usr/share/fonts
MaxCacheSize=4046
CacheName=/cache
PrivateCache=/var/cache/swfchart
ForceCache=1

Note: A line beginning with either a # or a ; is ignored.


True Type fonts on UNIX systems

Swiff Chart Generator displays text exclusively with True Type fonts. These fonts are specified in the style file (*.scs) along with all the graphical and layout parameters of the generated charts (see How to create chart styles and LoadStyle for more information about style files).

If these fonts are not physically included into the style file, then Swiff Chart Generator will look for these fonts in the directories specified by either the method SetTTFontsDir or the parameter TTFontsDir in swfchart.ini configuration file.

Note: Before trying to generate a chart from a new style file, be sure that the True Type fonts required by this style are actually available in one of the directories specified by either the method SetTTFontsDir or the parameter TTFontsDir in swfchart.ini configuration file.

Accentuated or other special characters

Swiff Chart Generator for UNIX comes with a single True Type replacement font named ReplFontSans.ttf, located in /usr/local/SwiffChart/ttf (if the installation directory is /usr/local/SwiffChart). This font is quite simple and does not include any special or accentuated characters.
Standard chart styles are created under Windows. They generally use an Arial or Times New Roman font. Therefore, simply copy these True Type fonts files on your UNIX server. (only those used by the SCS file are needed, but more can be copied too)
Then use the method SetTTFontsDir to specify the pathnames (separared by ':') where your font files are located on the UNIX server. An alternate method is to edit the variable TTFontsDir in the swfchart.ini file.
Note: only True Type fonts are supported.

Minimum Access Rights

In order to correctly generate charts with Swiff Chart Generator on UNIX systems, the Swiff Chart Generator module launched from the PHP module must have minimum access rights to the various directories and files listed before (True Type fonts, configuration file, cache directory, etc.).

If Swiff Chart Generator does not have the minimum access rights, Swiff Chart Generator will raise an error or have an unpredictable behaviour.

The table below enumarates for all directories and files their corresponding minimum access rights.


File or directories Minimum Access Rights
swfchart.ini read access
True Type fonts directories read access
True Type fonts files read access
Public Cache on the Web Server
(CacheName parameter or SetCacheName method)
read/write access
Private Cache directory
(PrivateCacheDir parameter or SetPrivateCacheDir method)
read/write access

See Also

SetTTFontsDir Method | SetMaxCacheSize Method | SetCacheName Method | SetPrivateCacheDir Method | UseCache Method