PHPlot Reference Manual

The PHPlot Documentation Team

L J Bayuk

Primary author and editor of the manual, and current maintainer of PHPlot

Miguel de Benito

Developer and maintainer of PHPlot

Afan Ottenheimer

Original developer of PHPlot

Release 2008-01-13 for PHPlot-5.0.5

Permission to use, copy, modify and distribute this manual for any purpose and without fee is hereby granted in perpetuity, provided that the above copyright notice and this paragraph appear in all copies.


Table of Contents

Preface
I. PHPlot Programming
1. PHPlot Installation
1.1. Prerequisites
1.2. Installing
1.3. Next Step
2. Getting Started with PHPlot
2.1. Introduction
2.2. Creating the Object
2.3. A Simple Graph
2.4. Different Size Images and Titles
2.5. Multiple Lines Per Graph
2.6. Customization
2.7. What's Next?
3. PHPlot Concepts
3.1. Definitions
3.2. Programming Overview
3.3. PHPlot Data Types
3.4. PHPlot Plot Types
3.5. Colors
3.6. Labels
3.7. Error Handling
3.8. Extra Data Processing
4. PHPlot Functions By Category
4.1. Core
4.2. Input/Output Control
4.3. Colors and Line Styles
4.4. Additional Style Controls
4.5. Error Bar Controls
4.6. Text Fonts
4.7. Titles
4.8. Legend
4.9. Axis Controls
4.10. Grid Controls
4.11. Labels
4.12. Ticks
4.13. Scaling and Translation
4.14. Callbacks
5. PHPlot Examples
5.1. Example - Line Plot
5.2. Example - Line Plot: Functions
5.3. Example - Area Plot
5.4. Example - Bar Chart
5.5. Example - Unshaded Bar Chart
5.6. Example - Bar Chart, Label Options
5.7. Example - Line/Point Plot, Point Shapes
5.8. Example - Pie Chart, text-data-single
5.9. Example - Pie Chart, text-data
5.10. Example - Pie Chart, flat with options
5.11. Example - Points Plot with Error Bars
5.12. Example - Points Plot / Scatterplot
5.13. Example - Squared Plot
5.14. Example - Stacked Bars, Shaded
5.15. Example - Stacked Bars, Unshaded
5.16. Example - Thin Bar Line Plot
5.17. Example - Thin Bar Line Plot, Wider Lines
5.18. Example - Two Plots on One Image
5.19. Example - Bar Chart with Data Labels
II. PHPlot Function Reference
DrawGraph — Draw the current graph onto the image
GetCallback — Returns the current callback function registered for the given reason
PHPlot — Construct a new PHPlot Class Object
PrintImage — Output the generated graph image and clean up the internal storage space.
RemoveCallback — Unregisters any callback registered for the given reason
SetBackgroundColor — Sets the overall background color.
SetBgImage — Set a graphic file to be used in the graph background
SetBrowserCache — Control browser-side image caching
SetCallback — Registers a callback function
SetDataBorderColors — Set the rectangle border color on bars and stacked bars
SetDataColors — Set the colors for plotting data sets
SetDataType — Indicate the format of the data array
SetDataValues — Set the data array for plotting
SetDefaultDashedStyle — Sets the on/off pattern for dashed lines.
SetDefaultTTFont — Set the default TrueType font
SetDrawBrokenLines — Sets whether lines should be broken at missing data
SetDrawDashedGrid — Use solid or dashed lines for the grid
SetDrawPlotAreaBackground — Enables drawing of a plot area background color
SetDrawXDataLabelLines — Draw data lines
SetDrawXGrid — Whether or not to draw the X grid lines
SetDrawYDataLabelLines — Not implemented
SetDrawYGrid — Whether or not to draw the Y grid lines
SetErrorBarColors — Sets the colors used for data error bars
SetErrorBarLineWidth — Set the line width used for error bars
SetErrorBarShape — Select line or tee-style error bars
SetErrorBarSize — Set the size of the error bar tee.
SetFileFormat — Select the graphic image format generated by PHPlot
SetFont — Select which font to use for a plot element
SetGridColor — Set the color used for the axes and borders
SetImageBorderColor — Set image border color, if enabled
SetImageBorderType — Draw a border around the image
SetIsInline — Set the output image to be “inline” - without HTTP headers
SetLabelColor — Do not use
SetLabelScalePosition — Position pie-chart percentage labels
SetLegend — Add text to a legend box
SetLegendPixels — Position the legend on the image (device coordinates)
SetLegendStyle — Control the appearance of the legend
SetLegendWorld — Position the legend on the image (world coordinates)
SetLightGridColor — Set the color for grid lines
SetLineSpacing — Set spacing between lines of multi-line elements
SetLineStyles — Set the line style (solid or dashed) for each data set
SetLineWidths — Set line width (thickness) for each data set
SetMarginsPixels — Set margins around the plot area
SetNumberFormat — Set the separators used when formatting number labels
SetNumXTicks — Set the number of X tick marks
SetNumYTicks — Set the number of Y tick marks
SetOutputFile — Redirect PHPlot output to a file
SetPlotAreaBgImage — Set a graphic file to be used in the plot area background
SetPlotAreaPixels — Set the limits for the plot area in device coordinates
SetPlotAreaWorld — Override automatic data scaling to device coordinates
SetPlotBgColor — Set plot area background color
SetPlotBorderType — Control how much of a border is drawn around the plot
SetPlotType — Select the type of plot - how the data will be graphed
SetPointShapes — Select a point shape for each data set
SetPointSizes — Sets the point size for each data set
SetPrecisionX — Set precision for numeric formated X labels
SetPrecisionY — Set precision for numeric formated Y tick labels
SetPrintImage — Determine whether or not to automatically output the image when the plot is drawn
SetRGBArray — Select a color map
SetShading — Set the size of the drop shadow for bar and pie charts.
SetSkipBottomTick — Suppress the bottom Y axis tick mark and label
SetSkipLeftTick — Suppress the first X axis tick mark and label
SetSkipRightTick — Suppress the last X axis tick mark and label
SetSkipTopTick — Suppress the top Y axis tick mark and label
SetTTFPath — Set the name of the default TrueType font directory
SetTextColor — Set general text color
SetTickColor — Set the color of the axis tick marks
SetTitle — Set the main title text for the plot
SetTitleColor — Set the color of the plot titles
SetTransparentColor — Designate one color to be transparent
SetUseTTF — Enables or disables use of TrueType fonts
SetXAxisPosition — Move the X axis
SetXDataLabelPos — Where to draw the X data labels
SetXLabelAngle — Set the text angle for X tick and data labels
SetXLabelType — Set formatting type for X tick and data labels
SetXScaleType — Select linear or logarithmic scale
SetXTickCrossing — Set crossing length of X tick marks
SetXTickIncrement — Set the step between X ticks
SetXTickLabelPos — Position the X tick labels
SetXTickLength — Set outer length of X tick marks
SetXTickPos — Position the X axis tick marks
SetXTimeFormat — Set date/time formatting string for X labels
SetXTitle — Sets the X axis title, and optionally its position
SetYAxisPosition — Move the Y axis
SetYDataLabelPos — Position and control Y data labels
SetYLabelAngle — Set the text angle for Y tick labels
SetYLabelType — Set formatting type for Y tick and data labels
SetYScaleType — Select linear or logarithmic scale
SetYTickCrossing — Set crossing length of Y tick marks
SetYTickIncrement — Set the step between Y ticks
SetYTickLabelPos — Position the Y tick labels
SetYTickLength — Set outer length of Y tick marks
SetYTickPos — Position the Y axis tick marks
SetYTimeFormat — Set date/time formatting string for Y labels
SetYTitle — Sets the Y axis title, and optionally its position
III. Developer's Guide to PHPlot
6. Plot Layout
7. Legend Layout
8. Internal Functions
9. Callbacks
9.1. Callbacks Application Interface
9.2. Callback Function Access
9.3. Available Callbacks
9.4. Object Methods as Callbacks
A. Change Log