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 2015-11-05 for PHPlot-6.2.0 Copyright © 2005-2015 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 ......................................................................................................................................... viii 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 .................................................................................................... 15 3.4. PHPlot Plot Types ..................................................................................................... 19 3.5. Colors ..................................................................................................................... 32 3.6. Labels ..................................................................................................................... 37 3.7. Other Plot Elements ................................................................................................... 44 3.8. Text Fonts ................................................................................................................ 46 3.9. Error Handling .......................................................................................................... 50 4. PHPlot Advanced Topics ...................................................................................................... 52 4.1. Custom PHPlot Class ................................................................................................. 52 4.2. PHPlot Object Serialization ......................................................................................... 52 4.3. Truecolor Images ...................................................................................................... 53 4.4. Callbacks ................................................................................................................. 59 4.5. Custom Data Color Selection ...................................................................................... 65 4.6. Plot Range and Tick Increment Calculations .................................................................. 68 4.7. Tuning Parameters ..................................................................................................... 78 4.8. Multiple Plots Per Image ............................................................................................ 81 4.9. Streaming Plots ......................................................................................................... 86 4.10. Image Maps for Plot Data ......................................................................................... 90 5. PHPlot Examples ............................................................................................................... 101 5.1. Example - Line Plot ................................................................................................. 102 5.2. Example - Line Plot: Functions .................................................................................. 104 5.3. Example - Area Plot ................................................................................................. 106 5.4. Example - Bar Chart ................................................................................................ 108 5.5. Example - Unshaded Bar Chart .................................................................................. 110 5.6. Example - Bar Chart, Label Options ........................................................................... 112 5.7. Example - Line/Point Plot, Point Shapes ...................................................................... 114 5.8. Example - Pie Chart, text-data-single .......................................................................... 116 5.9. Example - Pie Chart, text-data ................................................................................... 118 5.10. Example - Pie Chart, flat with options ....................................................................... 120 5.11. Example - Points Plot with Error Bars ....................................................................... 122 5.12. Example - Points Plot / Scatterplot ............................................................................ 124 5.13. Example - Squared Plot .......................................................................................... 126 5.14. Example - Stacked Bars, Shaded ............................................................................... 128 5.15. Example - Stacked Bars, Unshaded ........................................................................... 130 iii PHPlot Reference Manual 5.16. Example - Thin Bar Line Plot .................................................................................. 132 5.17. Example - Thin Bar Line Plot, Wider Lines ................................................................ 134 5.18. Example - Two Plots on One Image .......................................................................... 136 5.19. Example - Bar Chart with Data Value Labels .............................................................. 138 5.20. Example - Stacked Bars with Y Data Value Labels ...................................................... 140 5.21. Example - Stacked Area Plot ................................................................................... 142 5.22. Example - Annotating a Plot Using a Callback ............................................................ 144 5.23. Example - Complete Web Form with Plot .................................................................. 147 5.24. Example - Using Truecolor To Make a Histogram ....................................................... 154 5.25. Example - Creative Use of the Data Color Callback ..................................................... 158 5.26. Example - Custom Bar Colors Using the Data Color Callback ........................................ 160 5.27. Example - Horizontal Bar Chart ............................................................................... 162 5.28. Example - Horizontal Stacked Bar Chart .................................................................... 164 5.29. Example - Horizontal Thin Bar Line Plot ................................................................... 166 5.30. Example - Basic OHLC (Open, High, Low, Close) Financial Plot ................................... 167 5.31. Example - Candlesticks OHLC (Open, High, Low, Close) Financial Plot .......................... 170 5.32. Example - Filled Candlesticks OHLC (Open, High, Low, Close) Financial Plot .................. 172 5.33. Example - Linepoints Plot with Data Value Labels ....................................................... 174 5.34. Example - Overlaying Plots ..................................................................................... 176 5.35. Example - Legend with Shape Markers ...................................................................... 179 5.36. Example - Legend Positioning .................................................................................