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 2015-11-05 for PHPlot-6.2.0

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. PHPlot Object Serialization
4.3. Truecolor Images
4.4. Callbacks
4.5. Custom Data Color Selection
4.6. Plot Range and Tick Increment Calculations
4.7. Tuning Parameters
4.8. Multiple Plots Per Image
4.9. Streaming Plots
4.10. Image Maps for Plot Data
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
5.35. Example - Legend with Shape Markers
5.36. Example - Legend Positioning
5.37. Example - Setting a Y Tick Anchor
5.38. Example - Hourly Data Using X Tick Anchor
5.39. Example - Embedding Image with EncodeImage
5.40. Example - Bubbles Plot
5.41. Example - Pie Chart Label Types
5.42. Example - DrawMessage
5.43. Example - Custom Data Value Label Formatting
5.44. Example - Image Map from Bar Chart
5.45. Example - Image Map from Pie Chart
5.46. Example - Image Map and Non-embedded Plot Image
5.47. Example - Pie Chart Start Angle and Direction
5.48. Example - Horizontal Linepoints Plot with Data Value Labels and Lines
5.49. Example - Horizontal Error Plot
5.50. Example - Box Plot with Data Reduction
5.51. Example - Box Plot with Outliers and Styles
5.52. Example - Squared Area Plot
5.53. Example - Stacked Squared Area Plot
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
DrawMessage — Draw a text message on the image, discarding the plot
EncodeImage — Returns the plot image data
EndStream — End a Motion-JPEG (or other type) plot stream
GetCallback — Returns the current callback function registered for the given reason
GetDeviceXY — Translate world coordinates into device coordinates
GetLegendSize — Return the amount of space required for the legend box
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.
PrintImageFrame — Output the generated plot as one frame in a plot stream
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 data border colors
SetDataColors — Set the colors for plotting data sets
SetDataLabelColor — Set the color for data labels
SetDataType — Indicate the format of the data array
SetDataValueLabelColor — Set the color for data value labels
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
SetDrawDataBorders — Enable or disable drawing of data borders
SetDrawPieBorders — Enable or disable drawing of pie chart segment borders
SetDrawPlotAreaBackground — Enables drawing of a plot area background color
SetDrawXAxis — Enable or disable drawing of the X axis line
SetDrawXDataLabelLines — Draw data label lines for vertical plots
SetDrawXGrid — Whether or not to draw the X grid lines
SetDrawYAxis — Enable or disable drawing of the Y axis line
SetDrawYDataLabelLines — Draw data label lines for horizontal plots
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.
SetFailureImage — Enable or disable error image production on failure
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 labels
SetLegend — Add text to a legend box
SetLegendBgColor — Set legend background color
SetLegendColorboxBorders — Control the borders around color boxes in the legend
SetLegendPixels — Position the legend on the image (device coordinates)
SetLegendPosition — Position the legend
SetLegendReverse — Control the order of text lines in the legend
SetLegendStyle — Control the appearance of the legend
SetLegendTextColor — Set legend text color
SetLegendUseShapes — Use color boxes or shape markers in the legend
SetLegendWorld — Position the legend on the image (world coordinates)
SetLightGridColor — Set the color for grid lines and 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 intervals
SetNumYTicks — Set the number of Y tick intervals
SetOutputFile — Redirect PHPlot output to a file
SetPieAutoSize — Enable or disable automatic pie chart size calculation
SetPieBorderColor — Set the color for pie chart segment borders
SetPieDirection — Set the direction for pie chart segments
SetPieLabelColor — Set the color for pie chart data labels
SetPieLabelType — Set type and format for pie chart labels
SetPieStartAngle — Set the starting angle for pie chart segments
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 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
SetTickLabelColor — Set the color for tick labels
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
SetXTickAnchor — Set an anchor point for X tick marks
SetXTickCrossing — Set crossing length of X tick marks
SetXTickIncrement — Set the length of the interval 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
SetYTickAnchor — Set an anchor point for Y tick marks
SetYTickCrossing — Set crossing length of Y tick marks
SetYTickIncrement — Set the length of the interval 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
StartStream — Begin a Motion-JPEG (or other type) plot stream
TuneXAutoRange — Adjust tuning parameters for X axis range calculation
TuneYAutoRange — Adjust tuning parameters for Y axis range calculation
TuneXAutoTicks — Adjust tuning parameters for X axis tick increment calculation
TuneYAutoTicks — Adjust tuning parameters for Y axis tick increment calculation
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
10.3. PHPlot Class Constants
A. Change Log
SourceForge.net Logo

This version of the manual was produced for the PHPlot Sourceforge project web service site, which requires the logo on each page.

To download a logo-free copy of the manual, see the PHPlot project downloads area.