1This is the Change Log for PHPlot. 2The project home page is http://sourceforge.net/projects/phplot/ 3----------------------------------------------------------------------------- 4 52011-07-30 (lbayuk) ===== Released as 5.5.0 ===== 6 * phplot.php: Updated version comment and version constant 7 * README.txt: Updated for new release 8 * NEWS.txt: Add text for new release 9 102011-07-28 11 * Fixed problem found in testing with bubbles plot: data array 12 with no Y,Z values at all got undefined property warnings. 13 14 * Feature request #3352301 "Bubble plots": 15 + Added new data type 'data-data-xyz', which includes a Z value 16 for each Y. 17 + Extended CheckDataArray(), DecodeDataType() and 18 FindDataLimits() to understand new data type. 19 + Added new plot type 'bubbles' for bubble plots, using data 20 type 'data-data-xyz'. The Z value controls the bubble size. 21 + New internal function DrawBubbles() to draw bubble plot. 22 + New tunable parameters bubbles_min_size and bubbles_max_size. 23 242011-07-25 25 * Feature request #3374495 "Data URL encoding": 26 + New function EncodeImage() returns the plot image as a string, 27 with 3 available encodings: raw, base64, and dataurl. The dataurl 28 encoding implements RFC2397 embedding of image data in a URL, 29 and allows a single PHP script to produce an HTML page with the 30 plot image embedded within. 31 + New internal function GetImageType() for code shared between 32 PrintImage() and EncodeImage(). 33 + New function SetFailureImage() disables the normal behavior 34 where PHPlot produces an image containing an error message in 35 case of a fatal error. Suppressing this is necessary when using 36 the new EncodeImage(), to avoid unexpected image data on stdout. 37 + New member variable suppress_error_image, set by 38 SetFailureImage(), checked by PrintError() to not make an image. 39 402011-07-22 41 Preparing for move from CVS to Subversion. 42 * Makefile: Remove 'tag' target. This was unused (and CVS-specific). 43 * phplot.php: Remove reference to CVS in comment and version const. 44 452011-07-21 46 * Fixed bug #3370548 "Reverse legend line order for stackedbars": 47 New function SetLegendReverse(True) to draw lines in the legend 48 in order from the bottom up, rather than top down. This is 49 mostly intended for stackedbars and stackedarea plots. 50 512011-07-04 52 * Code cleanup: Removed extra loop variable $cnt from plot drawing 53 functions, where it was either unused or redundant. 54 552011-06-12 56 * Fixed bug 3312064 "PHP errors with invalid data arrays": 57 PHPlot now checks the data array more carefully, to reject invalid 58 arrays and prevent PHP warning or notice errors with bad data arrays. 59 + SetDataValues() checks the data array argument to make sure it uses 60 0-based, sequential integer indexes, and that each element is an array. 61 + CheckDataArray() (called early by DrawGraph()) uses the data type for 62 more specific checking. It makes sure each row has the right number of 63 entries. (E.g. text-data >=1, data-data >=2, data-data-error =2+3N.) 64 + DrawArea() ('area' and 'stackedarea' plots) returns without drawing 65 anything if there are < 2 rows, to avoid a PHP warning from 66 ImageFilledPolygon(). The 2-row minimum requirement is now documented. 67 + DrawLines(), DrawLinesError(), and DrawSquared() return without 68 drawing anything if there are no data values at all, to avoid a PHP 69 warning from array_fill(). 70 + DrawOHLC() ('ohlc', 'candlesticks', and 'candlesticks2' plots) now 71 checks early that there are 4 data columns, and fails if not. This 72 is to avoid a PHP warning when assigning line thicknesses. 73 742011-06-05 75 * Fixed bug 3312134 "Allow missing points in OHLC plots": 76 You can now skip points in the 3 OHLC plot types by using empty strings 77 ('') for the 4 values in the row. All rows must still have 4 values, but 78 if any is non-numeric the row will be skipped. 79 802011-05-27 (lbayuk) ===== Released as 5.4.0 ===== 81 * phplot.php: Updated version comment and version constant 82 * README.txt: Updated for new release 83 * NEWS.txt: Add text for new release 84 852011-05-25 86 * Added class constant PHPlot::version with the PHPlot release version. 87 882011-05-23 89 * Fix bug 3296884 "Undefined variable with stackedbars": 90 This is part 2 of the fix. (Part 1 fixed the undefined variable error 91 when the first stack was all zeros, but did not fix related problems.) 92 93 Changed DrawStackedBars() and DrawHorizStackedBars(): 94 + Do not ignore zero values. A leading zero value is significant if the 95 axis is moved in the direction opposite to the stack direction. Now 96 PHPlot will draw a bar segment from the axis to zero in this case. 97 Also a trailing zero value will produce a color cap on shaded bars. 98 + Determine each stack direction before drawing it. This is necessary 99 to be able to draw the leading 0 segment case correctly. 100 1012011-05-21 102 * Feature request #3303654 "Force tick mark at specific value": 103 + New functions SetXTickAnchor and SetYTickAnchor. 104 + CalcTicks() adjusts the starting tick point so that an anchor 105 point, if set, will coincide with a tick mark (or would, if the 106 data range were extended). 107 1082011-05-15 109 * Feature request #3291155 "More flexible legend positioning": 110 You can now position the legend by specifying that any point on the 111 legend box be placed at any point on the image, plot area, or relative 112 to the main title. You can get the legend box size from PHPlot, and 113 use it (for example) to adjust the plot area margins. 114 + Added new public function SetLegendPosition() which provides 115 much move flexible control over the legend position. 116 + Re-implemented SetLegendPixels() and SetLegendWorld() by 117 just having them call SetLegendPosition(). 118 + Added new public function GetLegendSize() which returns the 119 height and width of the legend box. 120 + New internal function GetLegendSizeParams() with code split 121 off from DrawLegend() and used by GetLegendSize() too. 122 + New internal function GetLegendPosition() calculates the legend 123 position. This implements all the new position modes. 124 + Removed internal class variables legend_x_pos, legend_y_pos, 125 and legend_xy_world. Replaced with an array: legend_pos, which 126 holds the legend position parameters set by SetLegendPosition(). 127 1282011-05-08 129 * Merged 5.3.2 release changes. (The two entries below this, 2011-05-01 130 and 2011-04-26, came before 5.3.2, but 5.3.2 was a single patch applied 131 against 5.3.1 and not against current CVS.) 132 1332011-05-01 134 * Feature request #3292825 "Use point shape markers in legend box": 135 + Implement optional use of point shapes instead of color boxes in the 136 legend, for use with points and linepoints plots. 137 + Add new function SetLegendUseShapes() to enable use of point shapes 138 in the legend. 139 + New internal class variable legend_use_shapes. 140 + Removed optional never-used 3rd argument to SetLegendStyle(). 141 + Add new internal function DrawShape() which now implements DrawDot() 142 but takes device coordinates, for use by DrawLegend(). 143 144 * Fix bug #3294604 "Center vertical alignment for legend text": 145 + Legend text lines are now vertically centered on the middle of 146 the color box or marker shape, rather than using bottom alignment. 147 1482011-04-26 149 * Moved legend functions together into one section, and removed 150 commented-out public variable declarations for legend variables. 151 No functionality changes are introduced. 152 (This is being done in anticipation of two upcoming changes to 153 legend code. I dislike moving functions around because it makes it 154 hard to use 'diff' to check changes, but it is helpful to have 155 functions that work together placed together in the script. As 156 a compromise, do the re-arrangement in its own change.) 157 1582011-05-06 (lbayuk) ===== Released as 5.3.2 ===== 159 * phplot.php: Updated version 160 * README.txt: Updated for new release 161 * NEWS.txt: Add text for new release 162 Note: This release was built off of the CVS branch tagged 163 rel5_3_1_patches, not HEAD. 164 1652011-05-06 166 * For bug 3296884 "Undefined variable with stackedbars": 167 A temporary fix was made against phplot-5.3.1 to avoid an undefined 168 variable error when the first stack in a stackedbars plot has all zero 169 values. The fix avoids the error message, and the plots are OK in most 170 cases. There are still issues with label position, and if the axis 171 is moved. These will be addressed in a future fix. 172 1732011-01-15 (lbayuk) ===== Released as 5.3.1 ===== 174 * phplot.php: Updated version 175 * README.txt: Updated for new release 176 * NEWS.txt: Add text for new release 177 1782011-01-09 179 * Fixed some style / indent errors, and 1 redundant test. 180 1812011-01-03 182 * For bug 3143586 "Multiple plots per image - fixes & docs": 183 Make sure there is a documented way to reset PHPlot feature 184 settings, especially those for which the default settings result 185 in automatic calculated values. Where possible, calling a Set*() 186 function with no arguments should reset the feature to defaults. 187 188 + Changed SetLegendPixels() arguments to be optional with default 189 NULL meaning reset to automatic positioning. 190 191 + Fixed SetXAxisPosition() and SetYAxisPosition() to accept empty 192 string '' to mean reset to default automatic positioning. 193 Make arguments optional, defaulting to empty string. 194 195 + Changed SetNumXTicks() and SetNumYTicks() arguments to be 196 optional with default empty string '' meaning reset to 197 of automatic calculation. 198 199 * Changed SetPointShapes() to use CheckOptionArray(). This 200 simplifies the function with no change in operation. 201 202 * Extend copyright years to 2011. 203 2042010-12-30 205 * Fix for bug 3147397 "Data colors missing with multiple plots": 206 + Do not truncate the data_colors and related arrays, so the full 207 set of colors will be available for subsequent plots on the image. 208 (Color indexes are still allocated in the image only as needed.) 209 + New internal functions GetColorIndexArray() and 210 GetDarkColorIndexArray(), replacing previous use of array_map(). 211 + Removed internal function truncate_array() - no longer used. 212 + Changed SetColorIndexes(), NeedDataDarkColors(), and 213 NeedErrorBarColors() to only allocate the color indexes that will 214 be needed (instead of allocating all colors in the truncated color 215 descriptor arrays). 216 2172010-12-28 218 * Instead of throwing an error, SetLegend(NULL) now clears the legend 219 array. This can be useful with multiple plots on an image. Before 220 this change, only SetLegend(array()) did that (possibly by accident). 221 2222010-12-27 223 * Do not have SetDefaultStyles() call deprecated SetLabelColor(). 224 225 * Fixes for bug 3143586 "Multiple plots per image - fixes & docs": 226 + Fix DrawLegend so it doesn't forget that the legend position 227 was specified in world coordinates. This fixes the legend 228 position for plots after the first. 229 + Don't draw the image border more than once (although this would 230 probably have no impact on the resulting image). This parallels 231 the behavior for the main plot title and the image background. 232 Replaced member variables background_done and title_done with a new 233 member array done[] which will track when these elements were done. 234 2352010-12-06 236 * Fix comments above CalcPlotAreaWorld(). Deleted incorrect information 237 from before data-data-yx existed, and before DecodeDataType rewrite. 238 2392010-12-04 (lbayuk) ===== Released as 5.3.0 ===== 240 * phplot.php: Updated version 241 * README.txt: Updated for new release 242 * NEWS.txt: Add text for new release 243 2442010-12-03 245 * Feature request 3127005 "Ability to suppress X/Y axis lines": 246 Added SetDrawXAxis() and SetDrawYAxis() to control flags which 247 will suppress drawing the X or Y axis lines. (These lines were 248 probably the only PHPlot elements that could not be turned off.) 249 Changed DrawXAxis() and DrawYAxis() to conditionally draw the 250 axis lines. 251 2522010-11-28 253 * Feature request 3117873 "Data value labels in more plot types": 254 Implemented Data Value Labels for plot types points, lines, 255 linepoints, and squared. Added 2 class variables which can be 256 set to control the distance and angle of the labels from points. 257 New internal function CheckDataValueLabels() calculates position 258 and text alignment for these labels. 259 260 * Updated comments for Set[XY]DataLabelPos to match the text in 261 the manual, which was rewritten to clarify label types. 262 2632010-11-23 264 * Code cleanup. Moved some functions around to group "plot drawing 265 helpers" separately from "plot drawing". No changes to operation. 266 2672010-11-21 268 * Feature request 3111166 "Control legend colorbox width": 269 Added a class variable legend_colorbox_width which can be changed 270 to make the colorboxes wider or narrower. 271 2722010-11-16 273 * Feature request 3093483 "Investing support chart types": 274 Added 3 new plot types: Basic OHLC (Open/High/Low/Close), Candlesticks, 275 and Filled Candlesticks. Implemented with one new function to handle the 276 3 new plot types: ohlc, candlesticks, and candlesticks2. 277 2782010-11-11 279 * Moved information about plot types into a new static member array 280 plots[]. (This is an internal change with no impact on usage, but will 281 make it easier to add new plot types.) SetPlotType() no longer needs a 282 list of plot types to check, FindDataLimits() does not need to check for 283 specific plot types to to process the data array, and DrawGraph() uses 284 data from the array rather than knowing about all the plot types. 285 2862010-10-31 287 * Changed internal CalcBarWidths() to take two arguments which indicate 288 how it should calculate bar widths, rather than having it check the 289 plot_type directly. (Taken from another, experimental change. This 290 minimizes places where plot_type is directly used.) 291 2922010-10-03 (lbayuk) ===== Released as 5.2.0 ===== 293 * phplot.php: Updated version 294 * README.txt: Updated for new release 295 * NEWS.txt: Add text for new release 296 * Makefile: Removed HorizontalBars.txt from release. This is now all 297 documented in the reference manual. 298 2992010-10-01 300 * Rewrite color handling. Default and specified colors are now validated, 301 converted to RGBA arrays, and saved. The colors indexes are not 302 allocated until graph drawing time. Unneeded colors are not allocated. 303 304 Fix bug 3045131 "SetTransparentColor problems": Transparency setup is 305 deferred to graph drawing time, after most other colors are allocated. 306 Fixes SetTransparentColor order dependency, and works with data colors. 307 308 Fix bug 3049726 "Optimize color allocation": Colors allocation is 309 deferred to graph drawing time, and colors for most elements are only 310 allocated if needed. In particular, the data colors and dark colors, 311 which used 32 slots, now only get defined as needed. 312 313 Feature request (partial) 3077554 "Finer control over plot element 314 colors": The colors of the main, X, and Y titles can now be controlled 315 separately. 316 317 Change details: 318 New internal functions: 319 GetColorIndex(), GetDarkColorIndex() 320 Allocate pre-parsed colors for elements. 321 SetColorIndexes() 322 Does the deferred color allocation and defaults. 323 NeedDataDarkColors(), NeedErrorBarColors() 324 Called by graph drawing functions if those colors are needed. 325 GetDataColor(), GetDataErrorColors(), GetBarColors() 326 Custom or standard data color assignment for most plot types. 327 truncate_array() 328 Shorten an array. Used to limit data color allocation. 329 330 Removed internal functions: 331 SetIndexColor(), SetIndexDarkColor() 332 Unneeded. Color handling is now in two separate phases. 333 334 Removed internal member variable: 335 data_colors_alpha 336 PHPlot no longer calls SetDataColors before plotting, so this 337 variable is not needed to preserve the default alpha. 338 339 New internal member variables: 340 transparent_color 341 Saves color value from SetTransparentColor. For bug 3045131. 342 x_title_color, y_title_color, ndx_x_title_color, ndx_y_title_color 343 For title colors. DrawXTitle and DrawYTitle use them now. 344 345 Changed internal member variables: 346 i_border, plot_bg_color, bg_color, label_color, text_color, etc. 347 All variables for colors now always hold a parsed 4-component 348 (RGBA) color specification as an array, and are no longer 349 statically initialized to a color name. 350 351 New public functions: 352 SetXTitleColor(), SetYTitleColor() 353 These can be used to make the 3 titles have different colors. 354 3552010-09-26 356 * Don't let SetXDataLabelPos() accept 'xaxis' or 'all' as valid. 357 Don't let SetXTickLabelPos(), SetYTickLabelPos() accept 'all' as valid. 358 These were never implemented and never documented. 359 360 361 * Feature request #3073679 "Stacked bar plots with negative values": 362 Allow stacked bar plots (vertical and horizontal) to work with negative 363 values. Changed FindDataLimits() to not take abs() values for 364 stackedbar when calculating the data range. Changed DrawStackedBars() 365 and DrawHorizStackedBars() to handle negative values, including proper 366 label positions. The first non-zero value in a row sets the direction 367 of the bar. Mixing positive and negative values within a row works but 368 the results are not useful. 369 370 * New internal DrawBar() moves common code from 4 bars and stackedbars 371 drawing functions and makes it easier to deal with shading vs bar 372 direction. 373 3742010-09-24 375 * Fix bug 3074402 "Fix Y axis default for horizontal plots": 376 Make the default axis positions symmetrical for vertical plots 377 (X and Y) and horizontal plots (Y and X). This fixes the problem 378 with horizontal bar/thinbarline plots that have negative data, 379 where the Y axis stayed on the left and the bars went rightward. 380 3812010-09-01 382 * Fix bug 3056991 "Internal methods should be 'protected'": 383 Changed CheckDataArray(), number_format(), FindDataLimits(), and 384 DrawBackground() to be 'protected'. The test suite no longer calls 385 these directly. For SetIndexColor(), SetRGBColor(), DrawText(), 386 SizeText(), xtr(), and ytr(), left these as public with a comment 387 indicating they should be treated as protected. 388 389 * Fix bug 3057000 "Review 'deprecated' methods": 390 + Changed deprecated method SetNewPlotAreaPixels() to just call 391 SetPlotAreaPixels(). It was suspicious as coded, and was found 392 to be equivalent to SetPlotAreaPixels(). 393 + Removed SetColor(), which didn't do anything. It was calling 394 SetRGBColor and discarding the result. After reviewing the 395 history of this in all CVS versions, it does not seem to have 396 ever been coded correctly, so there is no harm in removing it. 397 + All other deprecated methods seem OK and are left as is. 398 3992010-08-30 (lbayuk) ===== Released as 5.1.3 ===== 400 * phplot.php: Updated version 401 * README.txt: Updated for new release 402 * NEWS.txt: Add text for new release 403 4042010-08-27 405 * Fix bug 3051832 "Let PHP/GD find the font file": 406 Instead of checking for file existence, PHPlot now uses a non-drawing GD 407 operation to validate a TrueType font in SetFontTTF(). This allows GD to 408 use its internal search path, making it likely that fonts can be found 409 without needing a platform-dependent path in your script. Full paths 410 will still work, so there is no compatibility issue. 411 412 * Fix bug 3051906 "Better choice for default TT font": 413 Removed "benjamingothic.ttf" as the default TT font setting. This has 414 not been included in PHPlot since 2004. Changed SetFontTTF() to call 415 new GetDefaultFontTTF(), which will try a number of sans-serif font 416 names the first time it needs a default TT font. Considering the above 417 fix to finding fonts, this has a good chance of finding a working 418 font. It is known to work on Windows and some Linux distributions. 419 4202010-08-19 421 * Makefile: Removed phplot_data.php from list of files to release. 422 Reference bug report 3048267. This file has not been maintained or 423 tested, and has bugs. It will remain in CVS, but not be included 424 in PHPlot releases. 425 4262010-08-17 427 * Change new DrawLinePoints(). It does not have to check and 428 handle error bar plots, as DrawDots and DrawLines will do that. 429 4302010-08-16 431 * Rewrote DecodeDataType(). Previous implementation was hard to 432 extend and inefficient. Now it uses new class variables (not a 433 returned array) and is only called once, by DrawGraph. Changed all 434 users of data_type to use the new variables. 435 436 In CheckDataArray(), calculate data_columns properly for 437 text-data-single data type (pie chart) too. Simplify DrawPie 438 to use this, and merge 2 of the 3 cases. 439 440 Have a single function handle each plot type, so it can properly 441 check the data type and report a correct error message showing 442 all supported types. For example, DrawBars is now the entry point 443 for both bars and horizontal bars; DrawGraph does not directly 444 call DrawHorizBars. Similar for DrawStackedBars and 445 DrawHorizStackedBars. Lines, Points, and Linepoints also now 446 have a single function each, dispatching to others as needed. 447 (These changes were split off from an upcoming, larger change.) 448 4492010-08-14 450 * Fixes to SetDataValues: need to clear out the 2 arrays before 451 setting values in a loop, else if the function is used more than 452 once then old values will remain. 453 Move records_per_group calculation outside the loop. 454 (These were split off from upcoming, larger changes.) 455 456 * Part 4 of horizontal plots: implement horizontal thinbarline plots. 457 Added new data type 'data-data-yx' (label, Y, X1, X2, ...). 458 DrawThinBarLines() now draws either vertical or horizontal plots, and 459 supports data types text-data, data-data, text-data-yx, data-data-yx. 460 461 Fixed DecodeDataType() to handle text-data-single too, for completeness. 462 463 * Fix for over-padding style and color arrays. These were padded to 464 records_per_group, but that is the maximum data array row size. 465 The number of actual data sets is less, and depends on the data type. 466 Calculate the correct number as data_columns at the top of DrawGraph, 467 and use that to pad the arrays. Also moved early error checking in 468 DrawGraph() into new CheckDataArray(). 469 4702010-08-09 471 * Code cleanup. This is a large change to unify the comment and 472 coding stye used in PHPlot. The PEAR style guide is being used 473 as a reference, but PHPlot will never be 100% compliant. 474 This patch introduces no functional changes at all. 475 - Limit line length to 110. 476 - Remove obsolete, partially implemented Doxygen comments. 477 - Add descriptive comment above functions where missing. 478 - Use consistent comment markers and control structure spacing. 479 - Remove ctags-confusing end of function comments. 480 - Rewrote a few if/else blocks for cleaner logic. 481 - Re-order some functions for consistency (X, then Y). 482 4832010-08-04 484 * Implemented horizontal stacked bar plots: 485 Use the same data type introduced for horizontal bars, 'text-data-yx', 486 and the same plot type 'stackedbars', to make a horizontal stacked bar 487 plot. Data value labels, both at the ends of the bars and within the 488 bars ('plotstack' labels) are available with horizontal stacked bars. 489 490 * Internal function DrawDataLabel() is replaced by DrawDataValueLabel(), 491 with different usage. The new function can also check to see if a label 492 fits in the allocated space. 493 494 * Fixed the text size check in stacked bar plots for data value labels 495 within the bars. The check only worked correctly for 0 degree labels. It 496 now works with any text angle. It suppresses the label if it is too high 497 (for vertical stacked bar plots) or too wide (for horizontal stacked bar 498 plots) to fit in the bar segment to which it belongs. Note that it only 499 checks in the bar direction. If the text is too wide (for vertical bars), 500 or too high (for horizontal bars), it will still be plotted, but will 501 cross the sides of the bar. 502 5032010-07-28 504 * Allow callbacks to return a value (to support new data_color callback). 505 * Feature request 3034164 "Extended control of data colors": 506 Define new callback 'data_color' for picking the data color. 507 Changed internal plot drawing functions DrawDots, DrawLines, DrawSquared, 508 DrawBars, DrawStackedBars, DrawDotsError, DrawThinBarLines, 509 DrawLinesError, and DrawHorizBars to use the data_color callback 510 (if defined) to select the data colors. 511 * SetRGBArray code cleanup (no functional changes). 512 5132010-07-27 514 * Fixes for error bars: 515 Code cleanup in DrawYErrorBar(), with no functional change. 516 Suppress duplicate drawing of error bars with 'linepoints' error plots. 517 This was already fixed for data labels. Now error bars will only be 518 drawn by the 'points' part, not the 'lines' part. There should be no 519 visible changes to plots. (This is needed for a future change). 520 5212010-07-26 522 * Horizontal bar charts (still an experimental feature) can now have data 523 value labels. 524 * HorizontalBars.txt: Fix incorrect description of bar direction. Add 525 text explaining the new data value labels. 526 5272010-06-29 (lbayuk) ===== Released as 5.1.2 ===== 528 * phplot.php: Updated version 529 * README.txt: Updated for new release 530 * NEWS.txt: Add text for new release 531 5322010-06-26 533 * Feature request 2885930 "Horizontal Bars": 534 Horizontal bar charts are implemented, as an experimental feature. 535 A new data type 'text-data-yx' was added, which works with 536 'bars' plot type to produce a horizontal bar chart from a data 537 array with X values for each Y value. Changes were made to 538 FindDataLimits, CalcMargins, CalcPlotAreaWorld, CalcBarWidths, 539 and CalcMaxDataLabelSize to handle the new data type. Other 540 changes were made to handle label position defaults and grid 541 defaults. New drawing functions were added for horizontal bars. 542 543 * HorizontalBars.txt: new documentation file for experimental feature. 544 * Makefile: List new documentation file. 545 5462010-06-25 547 * Each plot-type drawing function now checks that it is getting a data 548 type that it knows how to handle. A new internal function unifies the 549 checking and error message. (This is associated with an upcoming, 550 bigger change.) 551 552 Compatibility: If you were using an invalid data type for a plot type 553 whose function did not check, will now get an error. 554 555 * Removed some dubious code from DrawLines() and DrawSquared() and 556 rewrote comments there. The code initialized lastx[0] and lasty[0], 557 but lasty was mapped using the X (rather than Y) function. This was 558 obviously wrong, but closer inspection showed that the values were 559 never, used so the code was removed. 560 5612010-06-13 562 * Truecolor.txt: removed 563 * Makefile, README.txt: Removed reference to Truecolor.txt. Full 564 documentation for truecolor images is now in the Reference Manual. 565 5662010-06-02 567 * Fix bug 3010116 "Bad rendering of title in multi-plot image 568 when using TTF": 569 Make sure the main title is drawn only once. (If drawn multiple 570 times with TrueType font text, the anti-aliasing effects result 571 in poor quality text.) 572 5732010-05-31 574 * Improvements to truecolor support (from feature request 2947679): 575 Truecolor support is now better integrated. The derived class only 576 has the constructor now, and the base class itself provides the alpha 577 color component support through the internal functions SetIndexColor(), 578 SetIndexDarkColor(), and SetRGBColor(). This means alpha channel 579 works with palette images too (in so far as GD supports this). 580 581 * Truecolor.txt: Updated per changes to truecolor support. 582 583 * Image tiling with mode 'scale' in tile_img(), used with image and 584 plot area backgrounds, now uses imagecopyresampled() rather than 585 imagecopyresized(). They are the same with palette images, but the 586 resampled copy gets better results with truecolor images. 587 5882010-05-29 589 * Feature request 3002606 "Add to plot and image border options": 590 Added options 'right', 'top', and 'bottom' to SetPlotBorderType() 591 (existing options are 'left', 'sides', 'none', and 'full'). This 592 now also accepts an array of the above options, giving complete 593 control over which sides to draw. 594 Added option 'solid' to SetImageBorderType() to use the actual 595 color set with SetImageBorderColor(), rather than the darker 596 shade as type 'plain' does (for some reason). 597 New function SetImageBorderWidth() sets the width of the image 598 border. The image border width is now accounted for in margin 599 calculations, although existing plots will not change. 600 6012010-04-04 (lbayuk) ===== Released as 5.1.1 ===== 602 * phplot.php: Updated version 603 * README.txt: Updated for new release 604 * NEWS.txt: Add text for new release 605 6062010-04-01 607 * Remove & from argument in SetDataValues(). The data array is not 608 modified and does not need to be passed by reference. (There is 609 no performance advantage, either.) 610 6112010-03-29 612 * Feature request 2947679 "Support for alpha blending/Truecolor": 613 Implemented truecolor image support with a new class 614 PHPlot_truecolor, extended color specifications to allow 615 specification of an alpha value, and added a new optional parameter 616 to SetDataColors for a default alpha value for all data colors. 617 This feature is *EXPERIMENTAL* (see next item). 618 619 * Truecolor.txt: New file, documentation for the new truecolor capability. 620 (The Truecolor feature is experimental, which means it is subject to 621 change in incompatible ways and the documentation has not yet been 622 incorporated into the PHPlot Reference Manual.) 623 624 * Makefile: Include new documentation file in release. 625 6262010-03-26 627 Fixed bug 2976735 "Improvements and fixes for 'area' plots": 628 Rewrote DrawArea() function which handles 'area' plot. 629 Part 1: This is related to feature request 2947679, Truecolor support 630 with transparency. The area plot function was filling each area from the X 631 axis up to the Y value, resulting in area overlaps. This wasn't a problem 632 with opaque colors, but with transparency, the overlapping areas resulted 633 in changed colors. The rewritten function fills the area between each line 634 instead of from each line down to the X axis. Plots with opaque colors 635 will not change. 636 Part 2: Area plots now work when the X axis is moved up with 637 SetXAxisPosition(). 638 Part 3: Fixed FindDataLimits() for area (and stackedbars too) to 639 take absolute values of Y values. The drawing function was doing this, 640 but not FindDataLimits, resulting in incorrect limits if any Y<0. 641 Part 4: The rewritten DrawArea() also handles a new plot type 642 'stackedarea'. This is an area plot where the Y values are stacked, 643 similar to 'stackedbars'. 644 Note: As part of the changes, it is now an error to try an area plot 645 with an unequal number of Y points for each X. 646 6472010-03-23 648 * Feature request 2973995 "Add y-Data to Stackedbars": 649 Implemented Y Data Labels for Stacked Bar charts (stackedbars). 650 The labels are enabled with SetYDataLabelPos, same as with bar charts. 651 There are two types of labels: above the stack with the total, and 652 within the bars at each segment. 'plotin' turns on the upper ones, and 653 'plotstack' turns both on. 654 655 * Other changes: 656 + Removed unimplemented second argument to SetYDataLabelPos. 657 + Fixed questionable logic in SetYDataLabelPos when given an argument 658 that belongs with SetYTickLabelPos. 659 + Fix comments at top of plot-type Draw functions. 660 661 * Fix for bug 2974639 "Stacked bars plot breaks with X axis != 0": 662 Stacked bar plots with non-zero X axis position no longer break apart 663 into segments with gaps. The bars are drawn up from the X axis, and 664 any segments or partial segments below the X axis are not drawn. 665 6662010-03-22 667 * Change related to feature request 2947679 - Fix 'dot' point shape: 668 Use imagefilledellipse(), not imagefilledarc(), when drawing the 'dot' 669 point shape. The fix was needed for future support of truecolor images 670 with transparency, but filled dots from imagefilledellipse() look 671 better (rounder) with regular images and opaque colors. 672 Credit to mvaldez for identifying the problem and providing the fix. 673 6742010-03-04 675 * Fix for bug 2963757 "point_counts undefined error in 5.1.0": 676 Fixed CheckPointParams so it sets point_counts even when the point shape 677 and point size arrays are already the same size and do not need padding. 678 6792010-01-26 680 * Fix for bug 2938219 "Bars go in wrong direction": 681 Fixed CalcAxisPositions() to be consistent in positioning the X axis. 682 When all Y values are <0 and the Y=0 line is not part of the plot range, 683 PHPlot will now default the X axis to the top of the plot, not the 684 bottom. This fixes the problem with bars to negative Y values being 685 drawn downward if Y=0 is visible, but upward if Y=0 is not visible. 686 This also affects thinbarline plots. 687 Credit to lauryn1298 for finding the bug. 688 6892009-12-24 (lbayuk) ===== Released as 5.1.0 ===== 690 6912009-12-18 692 * Change for bug 1795971 "Fix default data colors": 693 The default Data Color and Error Bar Color arrays now have 16 694 different colors, no duplicates, and nothing so light that it 695 is invisible. 696 Using '' or False as the argument to SetDataColors, SetErrorBarColors, 697 and SetDataBorderColors now re-initializes the map to the defaults. 698 This was previously undocumented, and in some cases set the map to 699 something different from the default. 700 7012009-12-15 702 * Cleanup: Remove DrawAxisLegend() - empty function marked TODO, 703 not really clear what it was meant to do. 704 7052009-12-14 706 * Fix for bug 2914403 "Pie + X/Y titles: Undefined property error": 707 In DrawGraph(), don't try to draw X or Y titles for pie charts. 708 709 * Feature request 2899921: "allow different format for data and tick 710 labels"; Bug 2906436: "Fixes for X Tick Labels vs X Data Labels", 711 and partial implementation of changes from user 'adoll' regarding 712 tick vs data labels: 713 714 New public functions: 715 + SetXDataLabelType() : Sets formatting for X Data Labels 716 + SetYDataLabelType() : Sets formatting for Y Data Labels (bar charts) 717 + SetXDataLabelAngle() : Sets text angle for X Data Labels 718 + SetYDataLabelAngle() : Sets text angle for Y Data Label (bar charts) 719 The defaults for these are set up to be fully backward compatible 720 with previous releases of PHPlot (except see the next item). 721 722 Re-used function name SetXDataLabelAngle(): 723 + This has been deprecated and undocumented since 2003-12-07, and 724 used to just call SetXLabelAngle(). For new behavior, see above. 725 726 Changes to public functions: 727 + SetXDataLabelPos() and SetXTickLabelPos() no longer cancel each 728 other out (set the other control variable to 'none'). Instead, 729 they are both considered before plot drawing. 730 731 Changes to internal functions: 732 + DrawDataLabel() now uses the font, angle, and color arguments as 733 provided, and does not substitute values if they are empty. 734 + SetLabelType() now takes mode='xd' and 'yd' for X Data and Y Data 735 label formatting; 'x' and 'y' are for tick labels only now. 736 + Functions that work on Data labels now call FormatLabel() with the 737 new mode parameter value 'xd' or 'yd, and use the new 738 data_label_angle variables. 739 + New CheckLabels(), used by DrawGraph to process label parameters. 740 + CalcMargins() - Rewritten to handle changes to Tick and Data labels. 741 742 Changes to internal class variables: 743 + New: x_data_label_angle, y_data_label_angle 744 + Do not initialize x_tick_label_pos or x_data_label_pos, so that 745 CheckLabels() can tell if they were set or not and apply defaults. 746 + Initialize y_data_label_pos to 'none', not 'plotleft'. 747 + Add 2 more indexes to label_format[] array: 'xd' and 'yd'. 748 749 * Cleanup: 750 + Delete unused internal class variable: draw_y_data_label_lines 751 + Delete unused function SetDrawYDataLabelLines() 752 7532009-12-07 754 * Fix bug 1795972 "Fix default point shapes": 755 + Added 10 new point shapes to the existing 10 shapes. 756 + Changed the default point shape from all 'diamond' to a 757 selection of up to 10 different shapes. 758 + Fixed bug in the code that tried to set the point shapes 759 and sizes arrays to be the same size. This was not working, 760 resulting in unexpected point sizes. 761 + Changed default point size to 6 for all shapes. It was trying 762 to be "5, 5, 3" but due to several bugs this was not working. 763 + Do not adjust shape sizes to even numbers (was done for only two 764 shapes). Instead, consistently truncate size/2 when needed. 765 NOTE: These may change the look of 'points' and 'linepoints' plots. 766 767 * Changed startup initialization code: 768 + SetDefaultStyles() was doing some odd things using a variable 769 called "session_set", with comments referring to non-existent 770 session support code. This has been removed. There should be 771 no visible changes from this. PHPlot does not use PHP sessions. 772 7732009-12-04 774 * Fix for bug 2908256, errors in pie charts with bad data array: 775 (From a Drupal contrib module report by thekevinday.) 776 With pie charts only, a data array with no valid Y values resulted 777 in PHP error messages. All other plot types handle this by producing 778 an image without a graph. 779 Fixed DrawPieChart to behave this way too. If there are no valid Y 780 values, or if the sum of all Y values is 0, do not error out, but 781 don't draw a pie chart either. 782 Also, pie charts now ignore non-numeric Y values, like other plot types. 783 7842009-11-20 (lbayuk) 785 * Fix for bug 2900914 "Problem with display of 0 on Y axis": 786 Changed how X and Y values are stepped by tick intervals, to avoid 787 cumulative round-off error. This fixes the problem when Y crosses 0 with 788 a tick step such as 0.1 resulting in a long label for a very small but 789 non-zero number. Fixed DrawXTicks, DrawYTicks, and CalcMaxTickLabelSize. 790 (Originally reported by cncnet) 791 7922009-11-19 (lbayuk) 793 * Improve support for using callbacks to annotate plots: 794 Added new callback 'draw_all', called after all drawing. 795 Supply plot_area[] as argument to some drawing callbacks. 796 Added new method GetDeviceXY() to translate from world coordinates. 797 Allow NULL or '' for $font in DrawText() internal method, meaning to 798 use the generic font. If callbacks want to use DrawText, this 799 avoids them having to reference the internal fonts[] array. 800 8012009-11-01 (lbayuk) 802 * Address bug report 2886365 "Declare all functions and variables in 803 PHP5 style" 804 PHP5 deprecates the use of 'var' to declare a class member variable. 805 All initialized class member variables are now declared 'public'. 806 (It was tempting to make most or all 'protected' or 'private', but 807 that would likely break too much, including the PHPlot Test Suite.) 808 809 Most class member functions which are meant for internal use only are 810 now declared 'protected', so they cannot be called from scripts 811 (except in child classes). (Note PHP5 does not deprecate the use of 812 just 'function' to mean public, so public functions were not changed.) 813 Internal functions are those documented in the manual under Developer's 814 Guide, Internal Functions. If your code breaks because you are using 815 a method which is now protected, please post the details on the help 816 forum. 817 818 Some member variables which were set in the constructor are now 819 initialized with the class instead. (No impact.) 820 821 Removed commented-out, FIXME-noted code for interim labels. 822 8232009-10-12 (lbayuk) 824 * Bug report 2839547, allow SetImageBorderType('none') to reset the image 825 border type. Also checked for other cases where there is no reset; 826 found one that exists (Set[XY]LabelType) but needs to be documented. 827 8282009-07-09 (lbayuk) 829 * Added a hook $plot->locale_override which can be set to True to prevent 830 PHPlot from loading locale settings from the environment with 831 setlocale(LC_ALL, ''). This is necessary for testing PHPlot on Windows, 832 where you cannot force a locale with an environment variable. It might 833 also be needed for people who want PHPlot's locale to differ from the 834 web server's locale. 835 8362009-06-12 (lbayuk) ===== Released as 5.0.7 ===== 837 8382009-06-11 (lbayuk) 839 * Change PHPlot license to LGPL, per Afan. 840 phplot.php, phplot_data.php - Change license notice. 841 rgb.inc.php - Change top comments and remove bottom marker. 842 COPYING - new file, text of LGPL. 843 LICENSE.* - removed files - old licenses. 844 Makefile - change list of distributed files. 845 846 * Fix for bug 2803900: SetRGBArray('large') does not work. The include 847 file defined a different array name than the main script expected. 848 (This bug seems to have happened over 8 years ago.) Fixed the array 849 names to match. Also removed the ./ prefix from the included filename 850 so it will be found if on the include path but not in the script 851 directory. Also added error check if the rgb.inc.php include file 852 is needed and not found. 853 8542009-05-25 (lbayuk) 855 * Added new feature to allow partial margin or plot area specification. 856 You can omit, or specify as NULL, any of the 4 arguments to 857 SetMarginsPixels() or SetPlotAreaPixels(), and this means PHPlot 858 should use the automatically calculated margin on that side. 859 Credit to adoll for this feature. 860 8612009-05-17 (lbayuk) 862 * Fix for bug 2791502 "Error plots treat missing Y values as 0": 863 Plots with data type data-data-error now support missing Y values, 864 instead of treating them as 0. This works with lines, points, 865 and linepoints plot types, and also honors SetDrawBrokenLines. 866 867 868 * Fix for bug 2792860 "Wrong DataLabelLines with missing Y": 869 Do not draw X Data Label Lines at points with missing Y values. 870 871 872 * Fix for bug 2786350 "Missing Y data results in bad auto-range": 873 Rewrote FindDataLimits to ignore missing Y values, rather than 874 treating them as if 0, for calculating range. 875 Bug report and analysis by mrten. 876 877 * Fix for bug 2786354 "Incorrect auto-range for data-data-error": 878 For data-data-error data type, apply the positive and negative error 879 amounts for each Y point to that point only, rather than applying the 880 largest errors to the overall minimum and maximum Y value for the row. 881 882 Note: The two fixes above can change existing plots which rely on 883 automatic Y range calculation. The first fix affects plots with 884 missing Y values and min(Y)>0. The second fix can affect plots using 885 data-data-error data type and different error values for different 886 points. In both cases the new Y range can be smaller than before. 887 8882009-01-20 (lbayuk) ===== Released as 5.0.6 ===== 889 8902009-01-18 (lbayuk) 891 * Fix for bug 1891636 "Misaligned TTF X Labels": 892 PHPlot was using the actual bounding box of each line of text 893 to allocate space and set the text positioning, but was ignoring the 894 fact that the text baseline is not the same as the bottom of the 895 bounding box. This resulted in uneven alignment of the X labels if 896 they had different heights (for example, month names Jul and Aug). 897 898 PHPlot now calculates the size of text for allocation (SizeText) using 899 the descenders on the last line, and calculates the size for drawing 900 (DrawText) only to the baseline. PHPlot also now uses a fixed line 901 spacing for each line of text in a font, rather than the actual text 902 height. This allows separately drawn multi-line labels to align. 903 904 * Changes to line spacing when using multi-line labels: 905 PHPlot was using the class variable line_spacing to mean the 906 number of pixels between lines of multi-line labels. This made the 907 spacing too small for larger fonts, and it was not possible to adjust 908 line spacing for different types of text. 909 910 PHPlot now interprets line_spacing as the number of pixels only 911 for GD text, and as a scale factor for the font's built-in line 912 spacing for TrueType text. In addition, a new optional argument is 913 added to SetFont, SetFontGD, and SetFontTTF to set a line spacing 914 specific to that type of text. 915 916 * Changes had to be made to the legend drawing code to accommodate the 917 changes to font handling. 918 919 Note: The line spacing change results in slightly looser spacing on 920 multi-line TrueType text labels, and slightly taller legends, compared 921 to version 5.0.5. 922 9232008-09-21 (lbayuk) 924 * Interim fix for bug 1932571 "Data-Data Plot fails with same X values". 925 PHPlot will no longer hang when the range of X values is 0 (that is, when 926 x_min == x_max). It will arbitrarily set an X range of 1, so the 927 calculated tick step is not 0. This is a temporary fix. Work on a smarter 928 X and Y range calculation is in progress, which will handle edge cases 929 like this better, but it isn't ready and this bug has been open too long. 930 Credit to andyl for finding the bug. 931 932 * Fix font path: Use DIRECTORY_SEPARATOR constant not '/'. 933 934 Extended the label formatting capabilities, adding 'printf' and 'custom' 935 types, added a prefix and suffix for 'data' type, and allow format controls 936 to be included in SetXLabelType and SetYLabelType. 937 938 External changes: 939 * Added 'printf' label type. The caller specifies the print format as the 940 2nd argument to SetXLabelType or SetYLabelType (default '%e'). 941 $plot->SetXLabelType('printf', '%5.2f'); 942 943 * Added 'custom' label type. The caller supplies a callback (typically a 944 function name) and optional pass-through argument as the 2nd and 3rd 945 arguments to Set[XY]LabelType. The function is called as $f($value, $arg) 946 to return the formatted $value. 947 $plot->SetXLabelType('custom', 'myfunction', $arg_value); 948 949 * In addition to Set[XY]TimeFormat, the format string for type 'time' can 950 now be set as the 2nd argument to Set[XY]LabelType. 951 $plot->SetXLabelType('time', '%H:%M'); 952 953 * In addition to SetPrecision[XY], the precision for type 'data' can now be 954 set as the 2nd argument to Set[XY]LabelType. A 3rd and 4th argument 955 can supply a prefix and suffix for 'data' formatting. (All optional) 956 $plot->SetXLabelType('data', 2, '$', 'US'); 957 958 Internal changes: 959 * Class variables x_precision, y_precision, x_label_type, y_label_type, 960 x_time_format, and y_time_format have been removed. 961 962 * New class array variable label_format[], with elements 'x' and 'y' which 963 are arrays for label formatting. Elements in the sub-arrays are not 964 initialized until needed. 965 966 * New function SetLabelType, which implements Set[XY]LabelType now. 967 968 * FormatLabel() was rewritten to support the new label formatting. 969 970 Compatibility: 971 * Any code that directly references class variables related to label 972 formatting will break, except for data_units_text. Use the documented 973 function methods instead. Setting data_units_text as a suffix is 974 deprecated but still works. 975 976 * The 'data' type precision for 'Y' is still used for pie chart labels. 977 9782008-07-12 (lbayuk) 979 Multiple comment spelling error fixes. No functional changes. 980 9812008-07-06 (lbayuk) 982 Changes to allow mixing GD fixed-font text and TrueType Font (TTF) text 983 on the same plot. 984 (This change came from work done trying to fix TTF text positioning, 985 where it looks like additional information needs to be stored for TrueType 986 fonts. The old font data structure was awkward to extend, and allowing 987 mixed GD/TTF text was on the to-do list anyway.) 988 989 External changes: 990 * SetFontGD(), SetFontTTF(): New functions to set a font, with type. 991 * SetFont(): Now calls SetFontGD or SetFontTTF depending on $use_ttf. 992 These changes should be fully compatible with existing programs. 993 994 Internal changes: 995 * Updated comments explaining SetUseTTF() now sets the default type 996 (not the only type) of text used. 997 * Put all the font data into a class array. (Replaces $this->generic_font 998 with $this->fonts['generic'], etc.) 999 * ProcessTextGD() and ProcessTextTTF() now take the font array as one 1000 argument, rather than separate arguments for font path and size. 1001 10022008-01-13 (lbayuk) ===== Released as 5.0.5 ===== 1003 * phplot.php: Updated version 1004 * README.txt: Updated for new release 1005 * NEWS.txt: Add text for new release 1006 * Makefile: Remove 'Callbacks' from release target, as this material is 1007 now in the reference manual. 1008 10092008-01-07 (lbayuk) 1010 Copyright updated to 2008 and PHP4 no longer listed as supported. 1011 1012 Major rewrite of the margin calculation functions to address multiple 1013 problems. Fixes for bugs 1856207 "Margin error with 'xaxis'/'yaxis' 1014 position, 1843012 "Make margins, drawing consistent", and 945439 1015 "x_tick_label_height not set correctly". 1016 1017 Note: These changes are inter-dependent and cannot be split up. 1018 1019 * Defer all calculations to DrawGraph time, to eliminate order dependencies. 1020 These functions now just store their arguments in the object, and all 1021 calculations happen later: 1022 + SetXAxisPosition, SetYAxisPosition 1023 + SetMarginsPixels 1024 + SetPlotAreaPixels (Stores margins, not area, now.) 1025 + SetPlotAreaWorld 1026 + SetXTickIncrement, SetYTickIncrement 1027 1028 * A new callback 'debug_scale' was added to trace the margin and scale 1029 calculations. 1030 1031 * CalcMargins was rewritten. Actual sizes of tick and data labels are now 1032 used, rather than guesses like "use size of biggest Y value". A minimum 1033 value (3 x safe_margin, or 15 pixels) applies to each margin. 1034 1035 * FindDataLimits no longer needs to find the longest data label, since 1036 CalcMargins now does that more precisely. 1037 1038 * DrawXTitle and DrawYTitle now use position offsets calculated by 1039 CalcMargins. Note: These titles are now offset from the plot area, 1040 not the image area. The titles will move if you had set the plot area 1041 or margins. 1042 1043 * DrawYTick, DrawXTick rewritten to use pre-calculated offsets, and common 1044 code moved to new CalcTicks(). 1045 1046 * DrawXDataLabel: Use pre-calculated offsets for text. 1047 1048 * DrawGraph: Rewrote top section (before drawing anything) to do the 1049 calculations in the proper order, unconditionally. 1050 1051 * Class variables removed: 1052 x_label_inc, y_label_inc, _x_label_cnt : These were never used. 1053 title_height, x_title_height, y_title_width : Now internal to CalcMargins. 1054 data_limits_done : No more need to remember if FindDataLimits called. 1055 1056 * New class variables added: 1057 plot_margins_set : Keeps track of user-set plot area or automatic. 1058 x_label_top_offset, x_label_bot_offset, x_offset_axis_offset, 1059 y_label_left_offset, y_label_right_offset, y_label_axis_offset, 1060 x_title_top_offset, x_title_bot_offset, 1061 y_title_left_offset, y_title_left_offset : Label offsets 1062 1063 * New internal functions: 1064 CalcPlotAreaPixels : Deferred calculations taken out of SetPlotAreaPixels 1065 and SetMarginsPixels. 1066 CalcPlotAreaWorld : Deferred calculations taken out of SetPlotAreaWorld. 1067 CalcAxisPositions : Calculate axis positions, moved from CalcTranslation. 1068 CalcTicks : Calculate X and Y tick interval. This still uses the 1069 same simple method (basically range/10), but now we could drop in a new 1070 algorithm much more easily. This is now also used by CalcMargins. 1071 Code taken out of DrawXTicks and DrawYTicks. 1072 CalcMaxTickLabelSize : So CalcMargins can use the exact tick label sizes. 1073 CalcMaxDataLabelSize : So CalcMargins can use the exact data label sizes. 1074 DrawXTick : Code split out from DrawXTicks for symmetry with DrawYTick. 1075 1076 10772007-12-13 (lbayuk) 1078 * Changed ProcessTextTTF() so SizeText() will return integers. It rounds 1079 the calculated values up, so the bounding box really contains the text. 1080 This also prevents unneeded float calculations in derived values. 1081 10822007-12-09 (lbayuk) 1083 Major rewrite of the text drawing functions to address multiple problems. 1084 Note: These changes are inter-dependent and cannot be split up. 1085 1086 * Fixed bug 1813070 "Bad position for multi-line TrueType text": 1087 TTF text is now drawn line-by-line, not as a block, for proper 1088 alignment and positioning. 1089 1090 * Fixed bug 1813071 "Wrong title height for multi-line TTF text": 1091 Corrected miscalculation of overall height of multi-line TTF titles. 1092 This bug resulted in over-sized margins. 1093 The height is now computed line-by-line, including the inter-line spacing. 1094 1095 * Fixed bug 1813474 "DrawText alignment arguments wrong": 1096 Corrected meaning of 'top' vs 'bottom' alignment. PHPlot now follows 1097 the usual conventions: 'top' alignment means top of text to reference. 1098 DrawText default for vertical alignment is still 'bottom', but the 1099 meaning was corrected. All callers of DrawText were fixed. 1100 1101 * Fixed bug 1816844 "Fix order dependency for setting titles": 1102 Defer processing titles strings until DrawGraph(), so there is no 1103 more order dependency (no need to set font before setting title strings). 1104 1105 * Fixed bug 1819668 "Horiz. align multi-line text: GD vs TTF": 1106 The new text routines draw TTF text line-by-line and correctly do 1107 right-, center-, and left- alignment of each line within a text block. 1108 1109 * Fixed bug 1826513 "FIXME in DrawLegend: Max label length": 1110 Use actual width of widest legend line to calculate legend box size. 1111 1112 * Partial fix for bug 945439 "x_tick_label_height not set correctly": 1113 In FindDataLimits(), save the longest data label, not just its length, 1114 and use the actual rendered size of that string in CalcMargins() for 1115 the margin calculations. 1116 Also take into account which of the tick or data labels are visible. 1117 This is not a complete fix, but is a significant improvement. 1118 1119 The following changes were made related to the above fixes: 1120 1121 + Replaced internal function TTFBBoxSize(), which didn't work right, with 1122 SizeText(). It returns the orthogonal bounding box of a block of text, 1123 and works with both GD and TTF text. 1124 1125 + DrawText() and SizeText() call a single function ProcessText(), which is 1126 the only place GD text and TTF text are distinguished. (So eventually 1127 we will be able to mix GD and TTF text on a plot.) 1128 1129 + New internal functions ProcessTextGD() and ProcessTextTTF() draw (or size) 1130 GD and TTF text respectively. These are only called by ProcessText(). 1131 These are re-implementations which properly position and align text. 1132 1133 + Removed class variables title_angle, x_title_angle, and y_title_angle. The 1134 titles only work at their fixed angles anyway (0, 0, and 90 respectively). 1135 1136 + Line spacing set with SetLineSpacing() now affects TTF text as well as 1137 GD text. Previously, it only affected GD text. The default line spacing 1138 happens to be usable for TTF text. 1139 1140 + Added new callback hook 'debug_textbox' for developing, testing, and 1141 documenting. It provides access to the text area bounding box. 1142 1143 + Removed unneeded class variables x_tick_label_height, y_tick_label_width, 1144 x_tot_margin, y_tot_margin. 1145 11462007-11-25 1147 * Improve error handling: 1148 Internal functions PrintError() and DrawError() are now the same. Both 1149 will draw the error message into the image and output it, and then 1150 trigger a user-level error. If no error handler has been set, it will 1151 exit, as before. But now the error message should also get logged, or 1152 written to the standard error stream, depending on the SAPI in use. 1153 You can now establish an error handler to catch most PHPlot errors and 1154 do some cleanup before exit. 1155 1156 This fix also covers bug #1823774 "Default Font Path and Error Message 1157 Output". 1158 1159 Fixed the return value of most PHPlot functions, to return False on 1160 error, else True. Since uncaught errors are fatal anyway, this only 1161 affects code with an error handler that returns, which is not 1162 recommended and unsupported at this time. These changes are for 1163 possible future error handling options. 1164 11652007-11-22 1166 * Fix bug 1836528 "Insufficient checking of parameter values": 1167 Rewrote CheckOption to correctly validate option choices. 1168 (It previously accepted substrings and other incorrect values.) 1169 PHPlot methods that use CheckOption now must be called with valid option 1170 values. Empty strings are also no longer accepted. 1171 11722007-11-17 (lbayuk) 1173 * Change to callbacks to support extra arguments. 1174 The PHPlot class can now pass extra arguments to a callback function. 1175 Callback functions now take the following form: 1176 my_callback($img, $passthru_arg, ...) 1177 Where '...' is zero or more additional arguments supplied by PHPlot to 1178 the callback. Each implemented callback reason will define any 1179 additional arguments it uses. The existing defined callbacks have not 1180 changed and do not currently pass any extra arguments. 1181 11822007-11-10 (lbayuk) 1183 * Fix bug 1827263 "Spoiled up pie-chart if $val is close to zero": 1184 Skip pie slices which would result in an integer angle of zero 1185 degrees, because the GD arc filling function will draw a complete 1186 circle for that case. 1187 Credit to Viacheslav <webdeveloper.ua at gmail.com> for finding this. 1188 1189 * Removed 8 of the functions (class methods) marked 'deprecated'. Only 1190 deprecated functions which seem to have been for internal use have 1191 been removed. Even old scripts shouldn't be using them, and they are 1192 becoming a problem to maintain. 1193 Removed: SetImageArea() DrawDotSeries() DrawLineSeries() CalcXHeights() 1194 CalcYWidths() DrawLabels() InitImage() DrawDashedLine(). 1195 11962007-10-20 (lbayuk) ===== Released as 5.0.4 ===== 1197 * phplot.php: Updated copyright, version, and authors comments at top. 1198 * README.txt: Updated for new release 1199 * NEWS.txt: Add text for new release 1200 12012007-10-18 (lbayuk) 1202 * Add callbacks - experimental feature: 1203 New functions SetCallback, GetCallback, RemoveCallback. 1204 New internal function DoCallback. 1205 Added callback hooks to DrawGraph. 1206 1207 Re-arranged code in DrawGraph to bring pie chart drawing into the main 1208 switch on plot type, rather than a special case in its own block. This 1209 makes it easier to follow and easier to add callback hooks. 1210 1211 * Callbacks: New file, documentation for the new callbacks feature. 1212 (This won't be in the manual while it is an experimental feature.) 1213 12142007-10-15 (lbayuk) 1215 * Fix for bug 1813021: Miss-positioned right-justified vertical GD text. 1216 Fixed DrawText() to correctly position 90 degree right-justified text 1217 drawn in a fixed GD font. This could be seen with 90 degree Y tick 1218 labels. (Found by accident while working on TrueType text problems.) 1219 Also some code cleanup in DrawText: use elseif where appropriate. 1220 12212007-10-09 (lbayuk) 1222 * Code cleanup: Simplify SetIndexColor() and SetIndexDarkColor(). 1223 There is no need to first try ImageColorExact, then ImageColorResolve 1224 if that fails. ImageColorResolve does all that for us. 1225 1226 Code cleanup: Rewrite SetRGBColor(). It now detects if an unrecognized 1227 color name or color value form is used, and draws an error message. 1228 Before this it would get a PHP index error and "headers already sent" 1229 condition. 1230 1231 * Code cleanup: Remove duplicated code for loading image files. 1232 Added new class-private function GetImage() which loads an image based 1233 on the image type, and also returns the image size. This replaces 1234 duplicated code in tile_img() and SetInputFile(). 1235 Also fixed comment at top of SetImageFile which said it was deprecated. 1236 It isn't - it is used by the constructor. Moved the function out of the 1237 'deprecated' area up to below where it is used. 1238 1239 * Code cleanup: PHPlot should not define or affect anything outside its 1240 own class. 1241 - Removed the check for __FUNCTION__ (PHP 4.3 and up). This is obsolete. 1242 - Do not set error_reporting to E_ALL. Although it is recommended that 1243 scripts do this, it is not the place of loaded classes to do it. 1244 - Remove unused global constant TOTY. 1245 - Removed constants MAXY and MINY. Global constants like this are bad. 1246 These were used as magic index values into data[] to hold min and max Y 1247 values for the row. Instead, put them in separate arrays which are 1248 named data_miny[] and data_maxy[]. (This seems to be only used by the 1249 data line drawing function.) 1250 1251 Comment cleanup: Remove one commented-out partial function DrawPlotLabel, 1252 and fix another commented-out code fragment in DrawYErrorBar. Both of 1253 these had unmatched braces in them which caused a balance-braces check 1254 to fail. 1255 1256 * Code cleanup, array padding: Get rid of functions outside the class 1257 and remove the interim fix for PHP 5 (which changed the behavior of 1258 array_merge). Rewrote external function array_pad_array() as a new 1259 class function pad_array(). It does not need access to the class, 1260 but I don't think PHPlot should add to the global namespace more 1261 than necessary. The third argument (array to use for padding) was 1262 never used, so it was removed. It always pads the array with itself. 1263 It now only works on 'usual integer indexed' arrays (0-based 1264 sequential integer index). The was previously required but 1265 undocumented for some of the arrays (like line_widths); now it is 1266 required for all style arrays and will be documented. Now we can pad 1267 the array to the required length, not just N times its previous 1268 length, and we don't need array_merge. Deleted external function 1269 array_merge_php4() as it is no longer used. 1270 1271 Deleted PHP end marker ?>. You don't need this and it can cause 1272 problems with extra whitespace in your output. 1273 12742007-09-24 (lbayuk) 1275 * Code cleanup: Fix ternary operator misuse. This doesn't change 1276 behavior, but it was annoying me so I fixed it. 1277 Replaced all cases of code like this: $a = ($a > $b) ? $b : $a 1278 With just: if ($a > $b) $a = $b 1279 1280 * Fix Makefile 'release' target to set owner/group when creating 1281 the tar file. This avoids having to run it as root, but it needs 1282 GNU tar to work. 1283 12842007-09-08 (lbayuk) 1285 * Fix for bug 1790441: Removed the PHPlot quasi-destructor function and 1286 the register_shutdown_function() call which arranged for it to be used. 1287 This was preventing release of memory when a PHPlot object was unset, 1288 because the registered shutdown function held a reference to it. 1289 So rather than improving memory use, it had the opposite effect. 1290 Note: It is no longer necessary or recommended to use reference 1291 assignment ($plot =& new PHPlot) for PHPlot object creation. 1292 Thanks to annajilly for the thorough analysis, bug report, and fix. 1293 12942007-09-05 (lbayuk) 1295 * Rewrote FormatLabel() to ignore blank label values. Adapted from a 1296 patch and feature request submitted by Gerhard Reithofer (exgerhardr). 1297 Blank labels used to produce an error if the LabelType was set to 1298 'time', and zero if set to 'data'. Now they are just ignored. This 1299 provides a simple way to have labels only at selected intervals when 1300 using time or data formats. For example, you can have a date/time 1301 label at every 10th data point by setting the labels for the other 9 1302 to be empty strings. Also: Removed $which_pos values 'plotx' and 1303 'ploty'. These were unused by PHPlot and this is an internal-only 1304 function so there is no compatibility issue. Removed error checking on 1305 $which_pos for the same reason; the error message used an undefined 1306 variable anyway so it wouldn't have worked. 1307 13082007-08-26 (lbayuk) 1309 * Allow SetLegendStyle colorbox_align argument to be 'none', to suppress 1310 the colorboxes in the legend. 1311 1312 Fix comment on $legend_text_align: empty means right, not left. 1313 1314 Rewrote DrawLegend layout code to make it easier to understand. The 1315 result should be within 1 or 2 pixels of the previous size and position. 1316 1317 * Fixes for bug 1779115: SetLegendWorld() fails on undefined vars 1318 Store the given coordinates and remember that they need to be converted 1319 from world to pixel coordinates, but defer trying to actually convert 1320 them until it is time to draw the legend. This way, there are no 1321 problems with the scale having to being set up first (which is nearly 1322 impossible to do). Made the following changes: 1323 1324 Changed legend class variables to be uninitialized, and unset (rather 1325 than empty string) means use the defaults. Added a new variable: 1326 $legend_xy_world. If it is set, (legend_x_pos, legend_y_pos) need to 1327 be converted to pixel coords. If it is unset, they are already pixel 1328 coords (or undefined, meaning defaults). 1329 1330 Changed usage of internal function DrawLegend(): removed all arguments. 1331 X and Y were always the class variables anyway, and now it needs to 1332 also use the new flag to tell it if X and Y are world or pixel coords. 1333 The third argument was unused. 1334 1335 Removed third, unused, default NULL argument from SetLegendPixels and 1336 SetLegendWorld. 1337 1338 Changes to DrawLegend to convert x, y coords to pixel coordinates 1339 if they came from SetLegendWorld. Also account for new usage of 1340 the class variables: Test for unset to mean use default. 1341 13422007-08-04 (lbayuk) 1343 * New feature: control legend text and color box alignment. 1344 Adds a new function SetLegendStyle to adjust the alignment of the 1345 text and the color boxes inside the legend. 1346 Based on part of bug 1208054, contributed by David Hern�ndez Sanz. 1347 13482006-12-02 (lbayuk) 1349 * Fixes for bug 1605555: Y Data Labels use wrong font and not formatted. 1350 Use y_label_font (not x_label_font) for Y Data Labels. 1351 Use the formatted value for the label, not the original text. 1352 (This applies to bar charts only, with the new Y data labels.) 1353 1354 * One fix for bug 1208054: Localization of number format. 1355 If number formatting is enabled with 'data' format type, PHPlot previously 1356 used dot for decimal point and comma for thousands separator, and there 1357 was no way to change it. 1358 1359 This fix adds a new function: 1360 SetNumberFormat($decimal_point, $thousands_separator) 1361 to set the separators. In addition, if that function is not used, 1362 PHPlot will now try to use locale-dependent separators. If locale 1363 information is not available, it will fall back to the old defaults 1364 of dot and comma. 1365 1366 Note: This change may have some negative effects. 1) If your locale is 1367 "C" or "Posix", you might not get a thousands separator now by default. 1368 You should be using a more specific locale. 2) If your PHP script is 1369 forcing a specific locale with setlocale(), PHPlot will probably undo 1370 that because it uses setlocale(LC_ALL, '') to import locale information 1371 from the environment. We have to do that, or a locale set through 1372 the environment is ignored. But it will override a manually set locale. 1373 1374 * Fix for bug 937944: X/Y Tick Counts 1375 PHPlot could draw one too few Y tick marks, and one too many X tick marks. 1376 1377 Changed the code to stop drawing X (Y) tick marks when the current X (Y) 1378 value exceeds the maximum X (Y) value plus a small fudge factor. The fudge 1379 factor accounts for cumulative error when repeatedly adding a delta to 1380 the X (Y) value. 1381 1382 Notes: The bug report was writing about Y tick counts only, but X tick 1383 counts can also be wrong. The proposed fix in the bug report does not 1384 work in all cases. 1385 1386 This fix changes the appearance of many plots which were missing the 1387 top-most Y tick mark. The extra X-tick mark problem is less common. 1388 1389===== Released as 5.0rc3 ===== 1390 13912006-11-13 (lbayuk) 1392 * Fix for bug 1437912: x-axis label misalignment [bar charts] 1393 The calculations were redone from scratch. 1394 New control variable 'bar_extra_space', which works in addition to 1395 'group_frac_width' to control how much extra space is around the bars. 1396 Made bar widths match for 'stackedbars' and 1-bar-per-group 'bars'. 1397 1398 NOTE: This changes the appearance of charts. bars in 'stackedbars' 1399 will now be thinner, and bars in 'bars' graphs will be thicker. I 1400 saw no reason for them being different before. 1401 1402 This fix required fixing the positioning on the new bar data labels, 1403 which was off before. The bar data labels will now be centered. 1404 Additional fixes to bar chart data labels: 1405 For negative values, the label will center under the bar. 1406 Fixed X-adjustment to account for shading. 1407 Fixed to not suppress the data label if the value is 0. 1408 1409 14102006-11-10 (lbayuk) 1411 * Fix for bug 1594457: DrawError text wrap and background fix 1412 Do error image white background correctly, and word-wrap the text. 1413 1414 * Fix for bug 1594458: Suppress lines or points in 'linepoints' 1415 Don't draw X data labels twice for 'linepoints'. 1416 Allow SetPointShapes value 'none' to suppress points, and allow 1417 SetLineStyles value 'none' to suppress lines. This allows a 'linepoints' 1418 graph to mix lines only, points only, and both on the same graph. 1419 1420 14212006-11-09 (lbayuk) 1422 * Fixes for bug 1446523: 1423 + Wrong variable name in deprecated SetAxisFontSize() 1424 + Fails to properly handle error if SetDataValues() was never 1425 called, or not called with a data array. 1426 1427 * Fix for bug 1117122: Pie Chart ignores SetPlotAreaPixels 1428 Don't let DrawGraph recalculate the plot area for pie charts if the 1429 user already set it with SetPlotAreaPixels. 1430 1431 NOTE: This fix may slightly change the appearance of some pie charts, 1432 whether or not they use SetPlotAreaPixels. 1433 1434 * Fix for bug 1103992: Wrong max Y calculated for stackedbars 1435 Changes FindDataLimits to calculate max Y correctly. It was counting 1436 the first Y value in each record twice, which is always wrong but 1437 only affected stackedbars because the Y values are summed. 1438 1439 * Fix for bug 1096199: Wrong error bar colors in DrawDotsError. 1440 Rewrites DrawDotsError to make it work like DrawLinesError to 1441 correctly increment the record and color indexes. 1442 Also fixes uninitialized x_now_pixels. 1443 1444 * Fix for bug 1096197: No borders on unshaded Draw[Stacked]Bars 1445 Unshaded Bars and StackedBars covered the border with the rectangle. 1446 The fix is to draw the rectangle, then the border. 1447 1448 NOTE: This fix changes chart appearance. Bars and Stacked Bars 1449 will now get a black border around each bar by default, if you 1450 turn off the 3D-shading. If you want borderless, unshaded bars 1451 you need to use SetDataBorderColors to set the data border colors 1452 to be the same as the data colors. 1453 1454 * Fix for bug 1333164: Negative data values, if string variables, result 1455 in unfilled bars. The problem was a string-to-string compare of a 1456 negative number with the empty string x_axis_position. Fixed by 1457 initializing x_axis_y_pixels to 0 if SetXAxisPosition was not used. 1458 1459 14602005-04-17 (afan) 1461 * Fix for bug [ 1161072 ] SetInputFile warning, background overwrite 1462 1463 * Bug 1182672 fixed 1464 14652005-04-15 (afan) 1466 * fix for bug: [ 1182666 ] Y Auto-scale rounds in wrong direction 1467 1468 * Fix for bugs 1144644 TrueType font path problems and 1106328 TTF 1469 path/filename inconsistency 1470 1471 * Fix Bug: [ 1117120 ] X Title sizing uses Y Title font height 1472 14732005-04-13 (afan) 1474 * Error in SetLineStyles() - does not accept an array argument 1475 1476 14772005-03-29 (afan) 1478 * Small typo fixed in SetYDataLabelPos 1479 1480 * Update SetDataLabelPos: For past compatibility we accept plotleft, 1481 ...but pass it to SetTickLabelPos 1482 14832005-03-26 (afan) 1484 * Change to line 3802: data lables now work with multiple bars with *$idx 1485 14862005-03-25 (afan) 1487 * Added Function DrawDataLabels to put data labels in world coords, 1488 added call from DrawBars and modified SetYDataLabelPos to flag 1489 whether or not to call DrawDataLabels. 1490 14912005-01-20 (migueldb) 1492 * Many bugfixes reported and solved by L. J. Bayuk. Thanks! 1493 + fixed bug #1096190 1494 + FindDataLimits(): fixed bug #1096192 1495 + CalcTranslation(): fixed bug #1101317 1496 + DrawImageBorder(): fixed bug 1096200 1497 + DrawXDataLabel(): fixed bug 1099879 1498 + DrawDots(): fixed bug #1096194 1499 1500===== Released as 5.0rc2 ===== 1501 15022004-10-24 (migueldb) 1503 * array_merge_php4(): added to cope with the bug introduced by 1504 the change in array_merge() from PHP4 to PHP5 (I haven't verified this) 1505 * Fixed some divisions by zero, thanks to an old bug report. 1506 15072004-09-09 (migueldb) 1508 * SetPointSize(): deprecated 1509 * SetPointSizes(): added as replacement for SetPointSize(). 1510 Now able to set point sizes on a per line basis. 1511 * SetPointShape(): deprecated. 1512 * SetPointShapes(): added as replacement for SetPointShape(). 1513 Now able to set point shape on a per line basis. 1514 * DrawDot(): now needs record number to decide which dot shape and 1515 size to draw. 1516 * CalcMargins(): dirty fix for x data label placing. 1517 * tile_img(): fixed tile placement. 1518 15192004-06-14 (migueldb) 1520 * SetXTickLabelPos() and others: more on the bug reported by Jo Demol. 1521 * Fixed bug reported by Jo Demol. 1522 15232004-05-11 (migueldb) 1524 * SetBgImage(): added. 1525 * SetPlotAreaBgImage(): added. 1526 * SetInputFile(): deprecated. 1527 * DrawBackground(): now accepts images as backgrounds. 1528 * DrawPlotAreaBackground(): now accepts images as backgrounds. 1529 * tile_img(): internal method added. 1530 1531.......... 1532Editor's Note: For older changes to PHPlot, please see the CVS logs. 1533