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 2011-01-15 for PHPlot-5.3.1

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. Other Plot Elements
3.8. Text Fonts
3.9. Error Handling
4. PHPlot Advanced Topics
4.1. Custom PHPlot Class
4.2. Truecolor Images
4.3. Callbacks
4.4. Custom Data Color Selection
4.5. Tuning Parameters
4.6. Multiple Plots Per Image
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 Value Labels
5.20. Example - Stacked Bars with Y Data Value Labels
5.21. Example - Stacked Area Plot
5.22. Example - Annotating a Plot Using a Callback
5.23. Example - Complete Web Form with Plot
5.24. Example - Using Truecolor To Make a Histogram
5.25. Example - Creative Use of the Data Color Callback
5.26. Example - Custom Bar Colors Using the Data Color Callback
5.27. Example - Horizontal Bar Chart
5.28. Example - Horizontal Stacked Bar Chart
5.29. Example - Horizontal Thin Bar Line Plot
5.30. Example - Basic OHLC (Open, High, Low, Close) Financial Plot
5.31. Example - Candlesticks OHLC (Open, High, Low, Close) Financial Plot
5.32. Example - Filled Candlesticks OHLC (Open, High, Low, Close) Financial Plot
5.33. Example - Linepoints Plot with Data Value Labels
5.34. Example - Overlaying Plots
6. PHPlot Functions By Category
6.1. Core
6.2. Input/Output Control
6.3. Colors and Line Styles
6.4. Additional Style Controls
6.5. Error Bar Controls
6.6. Text Fonts
6.7. Titles
6.8. Legend
6.9. Axis Controls
6.10. Grid Controls
6.11. Labels
6.12. Ticks
6.13. Scaling and Translation
6.14. Callbacks
II. PHPlot Function Reference
DrawGraph — Draw the current graph onto the image
GetCallback — Returns the current callback function registered for the given reason
GetDeviceXY — Translate world coordinates into device coordinates
PHPlot — Construct a new PHPlot Class Object
PHPlot_truecolor — Construct a new PHPlot Truecolor 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
SetDrawXAxis — Enable or disable drawing of the X axis line
SetDrawXDataLabelLines — Draw data lines
SetDrawXGrid — Whether or not to draw the X grid lines
SetDrawYAxis — Enable or disable drawing of the Y axis line
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
SetFontGD — Select a GD font to use for a plot element
SetFontTTF — Select a TrueType 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
SetImageBorderWidth — Set the width for the image border
SetIsInline — Set the output image to be inline - without HTTP headers
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 and X data label lines
SetLineSpacing — Set spacing between lines of multi-line text 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
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 main plot title
SetTransparentColor — Designate one color to be transparent
SetTTFPath — Set the default TrueType font directory
SetUseTTF — Set the default font type
SetXAxisPosition — Move the X axis
SetXDataLabelAngle — Set the text angle for X data labels
SetXDataLabelPos — Position and control X data labels
SetXDataLabelType — Set formatting type for X data labels
SetXLabelAngle — Set the text angle for X labels
SetXLabelType — Set formatting type for X tick 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 tick marks
SetXTimeFormat — Set date/time formatting string for X labels
SetXTitle — Sets the X axis title, and optionally its position
SetXTitleColor — Set the color of the X Title
SetYAxisPosition — Move the Y axis
SetYDataLabelAngle — Set the text angle for Y data labels
SetYDataLabelPos — Position and control Y data labels
SetYDataLabelType — Set formatting type for Y data labels
SetYLabelAngle — Set the text angle for Y tick labels
SetYLabelType — Set formatting type for Y tick 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 tick marks
SetYTimeFormat — Set date/time formatting string for Y labels
SetYTitle — Sets the Y axis title, and optionally its position
SetYTitleColor — Set the color of the Y Title
III. Developer's Guide to PHPlot
7. PHPlot Plot Layout
8. PHPlot Legend Layout
9. PHPlot Class Internal Functions
10. PHPlot Class Member Variables
10.1. List of Member Variables
10.2. Member Variable Notes
A. Change Log