Phplot Reference Manual
Total Page:16
File Type:pdf, Size:1020Kb
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 PHPlot Reference Manual The PHPlot Documentation Team by L J Bayuk, Miguel de Benito, and Afan Ottenheimer Release 2011-07-30 for PHPlot-5.5.0 Copyright © 2005-2011 The PHPlot Documentation Team 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. PHPlot Reference Manual Table of Contents Preface ......................................................................................................................................... vii I. PHPlot Programming ..................................................................................................................... 1 1. PHPlot Installation ................................................................................................................ 2 1.1. Prerequisites .............................................................................................................. 2 1.2. Installing .................................................................................................................. 3 1.3. Next Step ................................................................................................................. 3 2. Getting Started with PHPlot ................................................................................................... 5 2.1. Introduction .............................................................................................................. 5 2.2. Creating the Object .................................................................................................... 6 2.3. A Simple Graph ......................................................................................................... 6 2.4. Different Size Images and Titles ................................................................................... 7 2.5. Multiple Lines Per Graph ............................................................................................ 9 2.6. Customization .......................................................................................................... 11 2.7. What's Next? ........................................................................................................... 11 3. PHPlot Concepts ................................................................................................................. 12 3.1. Definitions .............................................................................................................. 12 3.2. Programming Overview ............................................................................................. 13 3.3. PHPlot Data Types ................................................................................................... 14 3.4. PHPlot Plot Types .................................................................................................... 18 3.5. Colors .................................................................................................................... 25 3.6. Labels .................................................................................................................... 29 3.7. Other Plot Elements .................................................................................................. 33 3.8. Text Fonts ............................................................................................................... 35 3.9. Error Handling ......................................................................................................... 38 4. PHPlot Advanced Topics ...................................................................................................... 40 4.1. Custom PHPlot Class ................................................................................................ 40 4.2. Truecolor Images ..................................................................................................... 40 4.3. Callbacks ................................................................................................................ 46 4.4. Custom Data Color Selection ...................................................................................... 52 4.5. Tuning Parameters .................................................................................................... 54 4.6. Multiple Plots Per Image ........................................................................................... 57 5. PHPlot Examples ................................................................................................................ 62 5.1. Example - Line Plot .................................................................................................. 63 5.2. Example - Line Plot: Functions ................................................................................... 65 5.3. Example - Area Plot ................................................................................................. 67 5.4. Example - Bar Chart ................................................................................................. 69 5.5. Example - Unshaded Bar Chart ................................................................................... 71 5.6. Example - Bar Chart, Label Options ............................................................................ 73 5.7. Example - Line/Point Plot, Point Shapes ....................................................................... 75 5.8. Example - Pie Chart, text-data-single ........................................................................... 77 5.9. Example - Pie Chart, text-data .................................................................................... 79 5.10. Example - Pie Chart, flat with options ........................................................................ 81 5.11. Example - Points Plot with Error Bars ........................................................................ 83 5.12. Example - Points Plot / Scatterplot ............................................................................. 85 5.13. Example - Squared Plot ........................................................................................... 87 5.14. Example - Stacked Bars, Shaded ................................................................................ 89 5.15. Example - Stacked Bars, Unshaded ............................................................................ 91 5.16. Example - Thin Bar Line Plot ................................................................................... 93 5.17. Example - Thin Bar Line Plot, Wider Lines ................................................................. 95 5.18. Example - Two Plots on One Image ........................................................................... 97 5.19. Example - Bar Chart with Data Value Labels ............................................................... 99 iii PHPlot Reference Manual 5.20. Example - Stacked Bars with Y Data Value Labels ...................................................... 101 5.21. Example - Stacked Area Plot ................................................................................... 103 5.22. Example - Annotating a Plot Using a Callback ............................................................ 105 5.23. Example - Complete Web Form with Plot .................................................................. 108 5.24. Example - Using Truecolor To Make a Histogram ....................................................... 115 5.25. Example - Creative Use of the Data Color Callback ..................................................... 119 5.26. Example - Custom Bar Colors Using the Data Color Callback ........................................ 121 5.27. Example - Horizontal Bar Chart ............................................................................... 123 5.28. Example - Horizontal Stacked Bar Chart ................................................................... 125 5.29. Example - Horizontal Thin Bar Line Plot ................................................................... 127 5.30. Example - Basic OHLC (Open, High, Low, Close) Financial Plot ................................... 128 5.31. Example - Candlesticks OHLC (Open, High, Low, Close) Financial Plot .......................... 130 5.32. Example - Filled Candlesticks OHLC (Open, High, Low, Close) Financial Plot .................. 132 5.33. Example - Linepoints Plot with Data Value Labels ...................................................... 134 5.34. Example - Overlaying Plots .................................................................................... 136 5.35. Example - Legend with Point Shapes ........................................................................ 139 5.36. Example - Legend Positioning ................................................................................. 142 5.37. Example - Setting a Y Tick Anchor .......................................................................... 146 5.38. Example - Hourly Data Using X Tick Anchor ............................................................ 149 5.39. Example - Embedding Image with EncodeImage ......................................................... 152 5.40. Example - Bubbles Plot .........................................................................................