Image_Graph::addData()

Image_Graph::addData() -- Add new data to the graph

Synopsis

require_once '/Graph.php';

object Image_Graph_Data_Common& Image_Graph::addData (array $data [, string $representation = "line" [, array $attributes = array()]])

Description

This function generate an instance of the given data representation-type (e.g. it will generate an instance of Image_Graph_Data_Line if you supply "line" for $representation). The new object will automatically be added to an internal list of data-objects. A reference to the object which was added to the graph will also be returned by this function. Using that reference you can e.g. call functions like setColor(), or whatever the specific data-element might support, to customize the data-element. You can use the array $attributes to supply attribute-data to the data-element upon creation. This might be quite handy if you add several data and don't want to call e.g. setColor() on each one separately. But this is up to you ... If no "color" is specified in the attributes-array, the "dataDefaultColor" will be used, which can be set using setDataDefaultColor().

Parameter

array $data

data to draw

string $representation

data representation (e.g. "line")

array $attributes

attributes like color

Throws

throws no exceptions thrown

See

see Image_Graph::setDataDefaultColor()

Note

This function can not be called statically.