Graph: ezcGraphFlashDriver
[ ]
[ Gallery ]
[ ]
[ ]
[ ]
[ ]
Class: ezcGraphFlashDriver
|
Driver to create Flash4 (SWF) files as graph output. The options of this class are defined in The options of this class are defined in the option class
ezcGraphFlashDriverOptions extending the basic
ezcGraphDriverOptions. [
source]
1. $graph = new ezcGraphPieChart();
2. $graph->title = 'Access statistics';
3. $graph->legend = false;
4.
5. $graph->driver = new ezcGraphFlashDriver();
6. $graph->options->font = 'tutorial_font.fdb';
7.
8. $graph->driver->options->compression = 7;
9.
10. $graph->data['Access statistics'] = new ezcGraphArrayDataSet( array(
11. 'Mozilla' => 19113,
12. 'Explorer' => 10917,
13. 'Opera' => 1464,
14. 'Safari' => 652,
15. 'Konqueror' => 474,
16. ) );
17.
18. $graph->render( 400, 200, 'tutorial_driver_flash.swf' );
Parents
ezcGraphDriver
|
--ezcGraphFlashDriver
Member Variables
|
protected int |
$id
= 1
Unique element id |
|
protected SWFMovie |
$movie
Flash movie |
|
protected array |
$strings
= array()
Array with strings to draw later |
Inherited Member Variables
From
ezcGraphDriver:
Method Summary
|
protected float |
deModifyCoordinate(
$pointValue )
Demodifies a coordinate value, as flash usally uses twips instead of pixels for a higher solution, as it only accepts integer values. |
|
protected void |
drawAllTexts(
)
Draw all collected texts |
|
public void |
drawCircle(
$center, $width, $height, $color, [$filled = true] )
Draw circle |
|
public void |
drawCircleSector(
$center, $width, $height, $startAngle, $endAngle, $color, [$filled = true] )
Draws a sector of cirlce |
|
public void |
drawCircularArc(
$center, $width, $height, $size, $startAngle, $endAngle, $color, [$filled = true] )
Draws a circular arc |
|
public void |
drawImage(
$file, $position, $width, $height )
Draw an image |
|
public void |
drawLine(
$start, $end, $color, [$thickness = 1.] )
Draws a line |
|
public void |
drawPolygon(
$points, $color, [$filled = true], [$thickness = 1.] )
Draws a single polygon. |
|
public void |
drawTextBox(
$string, $position, $width, $height, $align, [$rotation = null] )
Writes text in a box of desired size |
|
public SWFMovie |
getDocument(
)
Returns unique movie object as a parent canvas for all swf objects. |
|
public string |
getMimeType(
)
Return mime type for current image format |
|
public SWFMovie |
getResource(
)
Get resource of rendered result |
|
protected ezcGraphBoundings |
getTextBoundings(
$size, $font, $text )
Returns boundings of text depending on the available font extension |
|
protected float |
modifyCoordinate(
$pointValue )
Modifies a coordinate value, as flash usally uses twips instead of pixels for a higher solution, as it only accepts integer values. |
|
public void |
render(
$file )
Finally save image |
|
protected void |
renderText(
$id, $text, $chars, $type, $path, $color, $position, $size, [$rotation = null] )
Render text depending of font type and available font extensions |
|
protected void |
setShapeColor(
$shape, $color, $thickness, $filled )
Set the fill and line properties for a SWWFShape according to the given parameters. |
|
protected string |
simulateCircularArc(
$center, $width, $height, $size, $startAngle, $endAngle, $color, $filled )
Draws a circular arc consisting of several minor steps on the bounding lines. |
Inherited Methods
From
ezcGraphDriver :
Methods
deModifyCoordinate
float deModifyCoordinate(
float
$pointValue )
Demodifies a coordinate value, as flash usally uses twips instead of pixels for a higher solution, as it only accepts integer values.
Parameters
| Name |
Type |
Description |
$pointValue |
float |
|
drawAllTexts
void drawAllTexts(
)
Draw all collected texts
The texts are collected and their maximum possible font size is calculated. This function finally draws the texts on the image, this delayed drawing has two reasons:
1) This way the text strings are always on top of the image, what results in better readable texts 2) The maximum possible font size can be calculated for a set of texts with the same font configuration. Strings belonging to one chart element normally have the same font configuration, so that all texts belonging to one element will have the same font size.
drawCircle
Draw circle
Parameters
| Name |
Type |
Description |
$center |
ezcGraphCoordinate |
Center of ellipse |
$width |
mixed |
Width of ellipse |
$height |
mixed |
height of ellipse |
$color |
ezcGraphColor |
Color |
$filled |
mixed |
Filled |
Redefinition of
drawCircleSector
void drawCircleSector(
ezcGraphCoordinate
$center, mixed
$width, mixed
$height, mixed
$startAngle, mixed
$endAngle,
ezcGraphColor
$color, [mixed
$filled = true] )
Draws a sector of cirlce
Parameters
| Name |
Type |
Description |
$center |
ezcGraphCoordinate |
Center of circle |
$width |
mixed |
Width |
$height |
mixed |
Height |
$startAngle |
mixed |
Start angle of circle sector |
$endAngle |
mixed |
End angle of circle sector |
$color |
ezcGraphColor |
Color |
$filled |
mixed |
Filled |
Redefinition of
drawCircularArc
void drawCircularArc(
ezcGraphCoordinate
$center, integer
$width, integer
$height, integer
$size, float
$startAngle, float
$endAngle,
ezcGraphColor
$color, [bool
$filled = true] )
Draws a circular arc
Parameters
| Name |
Type |
Description |
$center |
ezcGraphCoordinate |
Center of ellipse |
$width |
integer |
Width of ellipse |
$height |
integer |
Height of ellipse |
$size |
integer |
Height of border |
$startAngle |
float |
Starting angle of circle sector |
$endAngle |
float |
Ending angle of circle sector |
$color |
ezcGraphColor |
Color of Border |
$filled |
bool |
|
Redefinition of
drawImage
Draw an image
The image will be inlined in the SVG document using data URL scheme. For this the mime type and base64 encoded file content will be merged to URL.
Parameters
| Name |
Type |
Description |
$file |
mixed |
Image file |
$position |
ezcGraphCoordinate |
Top left position |
$width |
float |
Width of image in destination image |
$height |
float |
Height of image in destination image |
Redefinition of
drawLine
Draws a line
Parameters
Redefinition of
drawPolygon
void drawPolygon(
$points,
ezcGraphColor
$color, [mixed
$filled = true], [float
$thickness = 1.] )
Draws a single polygon.
Parameters
| Name |
Type |
Description |
$points |
array |
Point array |
$color |
ezcGraphColor |
Polygon color |
$filled |
mixed |
Filled |
$thickness |
float |
Line thickness |
Redefinition of
drawTextBox
void drawTextBox(
string
$string,
ezcGraphCoordinate
$position, float
$width, float
$height, int
$align, [
$rotation = null] )
Writes text in a box of desired size
Parameters
| Name |
Type |
Description |
$string |
string |
Text |
$position |
ezcGraphCoordinate |
Top left position |
$width |
float |
Width of text box |
$height |
float |
Height of text box |
$align |
int |
Alignement of text |
$rotation |
ezcGraphRotation |
|
Redefinition of
getDocument
SWFMovie getDocument(
)
Returns unique movie object as a parent canvas for all swf objects.
getMimeType
string getMimeType(
)
Return mime type for current image format
Redefinition of
getResource
SWFMovie getResource(
)
Get resource of rendered result
Return the resource of the rendered result. You should not use this method before you called either renderToOutput() or render(), as the image may not be completely rendered until then.
getTextBoundings
Returns boundings of text depending on the available font extension
Parameters
Redefinition of
modifyCoordinate
float modifyCoordinate(
float
$pointValue )
Modifies a coordinate value, as flash usally uses twips instead of pixels for a higher solution, as it only accepts integer values.
Parameters
| Name |
Type |
Description |
$pointValue |
float |
|
render
void render(
string
$file )
Finally save image
Parameters
| Name |
Type |
Description |
$file |
string |
Destination filename |
Redefinition of
renderText
void renderText(
string
$id, string
$text, string
$chars, int
$type, string
$path,
ezcGraphColor
$color,
ezcGraphCoordinate
$position, float
$size, [float
$rotation = null] )
Render text depending of font type and available font extensions
Parameters
| Name |
Type |
Description |
$id |
string |
|
$text |
string |
|
$chars |
string |
|
$type |
int |
|
$path |
string |
|
$color |
ezcGraphColor |
|
$position |
ezcGraphCoordinate |
|
$size |
float |
|
$rotation |
float |
|
setShapeColor
void setShapeColor(
$shape,
ezcGraphColor
$color, mixed
$thickness, mixed
$filled )
Set the fill and line properties for a SWWFShape according to the given parameters.
Parameters
| Name |
Type |
Description |
$shape |
SWFShape |
|
$color |
ezcGraphColor |
|
$thickness |
mixed |
|
$filled |
mixed |
|
simulateCircularArc
string simulateCircularArc(
ezcGraphCoordinate
$center, mixed
$width, mixed
$height, mixed
$size, mixed
$startAngle, mixed
$endAngle,
ezcGraphColor
$color, bool
$filled )
Draws a circular arc consisting of several minor steps on the bounding lines.
Parameters
| Name |
Type |
Description |
$center |
ezcGraphCoordinate |
|
$width |
mixed |
|
$height |
mixed |
|
$size |
mixed |
|
$startAngle |
mixed |
|
$endAngle |
mixed |
|
$color |
ezcGraphColor |
|
$filled |
bool |
|
Last updated: Tue, 02 Dec 2008