<--previous | contents | next-->

Common Interface

All graph and pie classes share a common basic interface:

setOption(option, value)

Set an option by option name and value. This method also does data type conversion (see the discussion of colour handling), and type conformance checks.

getOption(option)

Retrieve the value of an option by name.

getAllOptions()

Retrieve a dictionary of all option-value pairs.

restoreDefaultOptions()

Restore the values of all options to the defaults for this graph type.

setLabels([label1, label2, ...])

Set the X-axis labels for Graph types, and per-slice labels for Pie charts. The number of arguments passed to this function should correspond with the number of discrete data points to be plotted.

setData(data1, [data2, ...])

Set the data to be charted. The data format expected differs from chart type to chart type - please see the corresponding chart section for more information.

draw(filespec)

Draw the graph to the specified file. If the filespec argument is a string, it will be treated as the path to a file. Otherwise, filespec is assumed to be a Python file object.

Options as properties

All options are also exposed as properties. Getting and setting an option as a property, is functionally identical to making the corresponding getOption and setOption calls.


<--previous | contents | next--> (12/31/03)
PyGDChart User's Manual