Table of Contents
These chapter describes the types of graphs supported by the library that is not a standard graph type used to display data series.
This feature allows the creation of displayed letters (some) and digits which have the look of a 4x7 LED display.
In order to use this feature the module "jpgraph_led.php
" must be
included.
In order to use the LED module the PHP installation must have multi-byte
strings enabled so that the function mb_strlen()
is available. This
is normally enabled at compile time for PHP by specifying the options
--enable-mbstring --enable-mbregex
when configuring the compile
options.
The figures below shows some samples of the characters supported and the available colors
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A LED display is constructed by creating an instance of class DigitalLED47
DigitalLED47::__construct($aRadius = 2, $aMargin= 0.6)
The first argument specifies the radius of each "led-light" and the second argument the margin around each character. Adjusting the radius is the only way to adjust the size of the LED characters.
In order to generate the billboard the method
DigitalLED47::Stroke($aValStr, $aColor , $aFileName =
'')
$aValStr
, The string to be displayed
$aColor
, one of the available colors as shown in the figures
above
$aFileName
, An optional file name which specifies a file that
the image will be written to. No image will be streamed back to the browser
in this case.
is called with the string to be displayed as the first argument. The following code snippet shows how to create a green LED bill board
1 2 | $led = new DigitalLED74();
$led->Stroke('0123456789. ABCDEFGHIJKL',LEDC_GREEN); |
In order to improve visual quality of the LED display it uses super sampling internally to achieve the anti-alias smoothing effect. The number of oversampling is specified with
DigitalLED47::SetSupersampling($aSuperSampling)
By default a 2:times super-sampling is used. Using any value higher than 4 does not give any visual improvements
In the three figures below different levels of super sampling is used, in the left most image no super sampling is used (super sampling=1), in the middle figure super sampling=2 (the default) and in the rightmost figure super sampling is set to 4
|
|
|
In addition to most of the basic latin characters the library also have some support for Cyrillic characters. Due to the limed resolution (4x7) some more complex cyrillic characters are not rendered very faithfully. The available rendering for the cyrillic alphabet is shown in Figure 17.20
Since the library internally uses utf8 character encoding it means that
the string passed on to the library must also be encoded in utf8. In case
the characters have another encoding, say cp1251, they must first be
converted to utf8. This could for example be done by the PHP function
iconv()
..
(This is the only place in the library that is truly multi-byte text safe.)