Chart
[ class tree: Chart ] [ index: Chart ] [ all elements ]

Class: Chart

Source Location: /vendors/svgChart/Chart.php

Class Overview

PEAR
   |
   --Chart

The main Chart class. Base class for all subtypes of charts, like Pie, Bar, Line and so on.


Author(s):

Variables

Methods



Class Details

[line 14]
The main Chart class. Base class for all subtypes of charts, like Pie, Bar, Line and so on.



Tags:

see:  Chart_Data


[ Top ]


Class Variables

$colors =

[line 28]

Array for storing the colors to visualize the data defined in $data.



Tags:

see:  Chart::$data
access:  public

Type:   array


[ Top ]



Class Methods


constructor Chart [line 40]

void Chart( [array $data = false], [string $standard_name = ""], [array $colors = false])

The constructor.

You can pass it an array of Chart_Data objects as data, the name of the visualization and, optional, an array contents the colors in what the Chart data is visualized.




Parameters:

array   $data   Chart_Data)
string   $standard_name   The name of the standard visualization method.
array   $colors   Colors to display the data in.

[ Top ]

method encapsulate [line 168]

string encapsulate( string $svg)

This function simply enclosoures the received svg code with the beginning- and ending <svg> or </svg> tags.

Also it includes an <?xml ... ?> header.




Tags:

return:  The encapsulated SVG code


Parameters:

string   $svg   SVG code to encapsulate

[ Top ]

method get [line 80]

string get( [string $name = false], [array $options = false])

This function returns the svg code for the visualized form of the internal data.

It receives the name of the visualization class to use. As $options, you can pass an array of options forwarded to the visualization class.
The following options are also implemented in this function:
* legend - If set, a legend is also generated. The value is also an array passed to the Chart::makeLegend() function.




Tags:

return:  SVG code


Parameters:

string   $name   Class to use
array   $options   Options, passed to the chart class

[ Top ]

method getColor [line 157]

string getColor( integer $id)

This function simply returns a color from the internal coller palette.

Supplied is a number.




Tags:

return:  color name or hexadeciaml triplet


Parameters:

integer   $id   The id of the color

[ Top ]

method makeLegend [line 124]

string makeLegend( [array $options = false])

This is an internal function used by the visualization classes to make a legend to the various chart types.

It uses the internal $data structure.
You can pass the following options:
* x & y - X & Y coordinates of the top-left point of the legend




Tags:

return:  SVG code for a legend.


Parameters:

array   $options   Options passed

[ Top ]

method makeSVG [line 112]

void makeSVG( [string $name = false], [array $options = false])

This function does the same as get(), with one difference: The returned svg code is capsulated in a <svg>....</svg> element structure, so it returns a completely SVG document.



Parameters:

string   $name   Class to use
array   $options   Options, passed to the chart visulaization class

[ Top ]

method setData [line 55]

array setData( array $data)

This function sets the Chart::$data array to a new value.



Tags:

return:  Old Value of Chart::$data


Parameters:

array   $data   New Value for Chart::$data

[ Top ]


Documentation generated on Mon, 05 Sep 2011 20:32:12 -0500 by phpDocumentor 1.4.3