6.3. Available Callbacks
Prev | Chapter 6. Callbacks | Next

## 6.3. Available Callbacks

This section defines the currently available callback names. A callback name is also called a reason.

Most of the callbacks currently available are drawing callbacks, activated during the graph drawing process started by DrawGraph. By convention, a drawing callback occurs right after the event which it names. For example, the draw_titles callback will be called after drawing the plot titles.

Debug callbacks are for use when developing and debugging PHPlot itself. Needless to say, their use for other purposes is discouraged.

The following table lists the available callback reasons.

Callback Name: | Calling Point: | Extra Parameters: | Notes:
--- | --- | --- | ---
draw_setup | After all setup, before drawing anything. | (None) | Anything drawn here will be covered by the background.
draw_image_background | After drawing the image backgrounds and border. | (None) |
draw_plotarea_background | After drawing the plot area background. | plot_area | plot_area parameter was added in PHPlot-5.1.0
draw_titles | After drawing the plot title, X and Y titles. | (None) | Called even if no titles were set.
draw_axes | After drawing the X and Y axis and grid lines. | (None) | Not called for pie charts.
draw_graph | After drawing the body of the graph. | plot_area | plot_area parameter was added in PHPlot-5.1.0
draw_border | After drawing the plot area border. | (None) | Not called for pie charts.
draw_legend | After drawing the legend, if legend is enabled. | (None) | Not called if no legend was set.
draw_all | After all drawing is complete. | plot_area | Added in PHPlot-5.1.0
debug_textbox | Just before drawing any text. | $px, $py, $bbox_width, $bbox_height | Provides access to the orthogonal bounding box position and size for the text string.
debug_scale | Called at end of many scale calculation functions. | Function name, then an array of variable name => value | For displaying intermediate values in margin and scale calculations.

### Notes:

Several of the drawing callbacks include `plot_area` as an extra parameter. This is an array of 4 values that define the plot area within the image, in GD pixel coordinates, as left_x, top_y, right_x, and bottom_y. For more information, see Chapter 7, Plot Layout.

See Section 6.5, “Using Callbacks to Annotate Plots” for information on using the drawing callbacks to annotate your plot.

Prev | Up | Next
6.2. Callback Function Access | Home | 6.4. Object Methods as Callbacks