This is the Change Log for PHPlot.
The project home page is http://sourceforge.net/projects/phplot/
-----------------------------------------------------------------------------

2008-01-13 (lbayuk)     ===== Released as 5.0.5 =====
    * phplot.php: Updated version
    * README.txt: Updated for new release
    * NEWS.txt: Add text for new release
    * Makefile: Remove 'Callbacks' from release target, as this material is
      now in the reference manual.

2008-01-07 (lbayuk)
    Copyright updated to 2008 and PHP4 no longer listed as supported.

    Major rewrite of the margin calculation functions to address multiple
    problems.  Fixes for bugs 1856207 "Margin error with 'xaxis'/'yaxis'
    position, 1843012 "Make margins, drawing consistent", and 945439
    "x_tick_label_height not set correctly".

    Note: These changes are inter-dependent and cannot be split up.

    * Defer all calculations to DrawGraph time, to eliminate order dependencies.
      These functions now just store their arguments in the object, and all
      calculations happen later:
    + SetXAxisPosition, SetYAxisPosition
    + SetMarginsPixels
    + SetPlotAreaPixels (Stores margins, not area, now.)
    + SetPlotAreaWorld
    + SetXTickIncrement, SetYTickIncrement

    * A new callback 'debug_scale' was added to trace the margin and scale
      calculations.

    * CalcMargins was rewritten. Actual sizes of tick and data labels are now
      used, rather than guesses like "use size of biggest Y value". A minimum
      value (3 x safe_margin, or 15 pixels) applies to each margin.

    * FindDataLimits no longer needs to find the longest data label, since
      CalcMargins now does that more precisely.

    * DrawXTitle and DrawYTitle now use position offsets calculated by
      CalcMargins. Note: These titles are now offset from the plot area,
      not the image area. The titles will move if you had set the plot area
      or margins.

    * DrawYTick, DrawXTick rewritten to use pre-calculated offsets, and common
      code moved to new CalcTicks().

    * DrawXDataLabel: Use pre-calculated offsets for text.

    * DrawGraph: Rewrote top section (before drawing anything) to do the
      calculations in the proper order, unconditionally.

    * Class variables removed:
      x_label_inc, y_label_inc, _x_label_cnt : These were never used.
      title_height, x_title_height, y_title_width : Now internal to CalcMargins.
      data_limits_done : No more need to remember if FindDataLimits called.

    * New class variables added:
      plot_margins_set : Keeps track of user-set plot area or automatic.
      x_label_top_offset, x_label_bot_offset, x_offset_axis_offset,
          y_label_left_offset, y_label_right_offset, y_label_axis_offset,
          x_title_top_offset, x_title_bot_offset,
          y_title_left_offset, y_title_left_offset : Label offsets
      
    * New internal functions:
      CalcPlotAreaPixels : Deferred calculations taken out of SetPlotAreaPixels
        and SetMarginsPixels.
      CalcPlotAreaWorld : Deferred calculations taken out of SetPlotAreaWorld.
      CalcAxisPositions : Calculate axis positions, moved from CalcTranslation.
      CalcTicks : Calculate X and Y tick interval. This still uses the
        same simple method (basically range/10), but now we could drop in a new
        algorithm much more easily. This is now also used by CalcMargins.
        Code taken out of DrawXTicks and DrawYTicks.
      CalcMaxTickLabelSize : So CalcMargins can use the exact tick label sizes.
      CalcMaxDataLabelSize : So CalcMargins can use the exact data label sizes.
      DrawXTick : Code split out from DrawXTicks for symmetry with DrawYTick.


2007-12-13 (lbayuk)
    * Changed ProcessTextTTF() so SizeText() will return integers. It rounds
      the calculated values up, so the bounding box really contains the text.
      This also prevents unneeded float calculations in derived values.

2007-12-09 (lbayuk)
    Major rewrite of the text drawing functions to address multiple problems.
    Note: These changes are inter-dependent and cannot be split up.

    * Fixed bug 1813070 "Bad position for multi-line TrueType text":
      TTF text is now drawn line-by-line, not as a block, for proper
      alignment and positioning.

    * Fixed bug 1813071 "Wrong title height for multi-line TTF text":
      Corrected miscalculation of overall height of multi-line TTF titles.
      This bug resulted in over-sized margins.
      The height is now computed line-by-line, including the inter-line spacing.

    * Fixed bug 1813474 "DrawText alignment arguments wrong":
      Corrected meaning of 'top' vs 'bottom' alignment. PHPlot now follows
      the usual conventions: 'top' alignment means top of text to reference.
      DrawText default for vertical alignment is still 'bottom', but the
      meaning was corrected.  All callers of DrawText were fixed.

    * Fixed bug 1816844 "Fix order dependency for setting titles":
      Defer processing titles strings until DrawGraph(), so there is no
      more order dependency (no need to set font before setting title strings).

    * Fixed bug 1819668 "Horiz. align multi-line text: GD vs TTF":
      The new text routines draw TTF text line-by-line and correctly do
      right-, center-, and left- alignment of each line within a text block.

    * Fixed bug 1826513 "FIXME in DrawLegend: Max label length":
      Use actual width of widest legend line to calculate legend box size.

    * Partial fix for bug 945439 "x_tick_label_height not set correctly":
      In FindDataLimits(), save the longest data label, not just its length,
      and use the actual rendered size of that string in CalcMargins() for
      the margin calculations.
      Also take into account which of the tick or data labels are visible.
      This is not a complete fix, but is a significant improvement.

    The following changes were made related to the above fixes:

    + Replaced internal function TTFBBoxSize(), which didn't work right, with
      SizeText(). It returns the orthogonal bounding box of a block of text,
      and works with both GD and TTF text.

    + DrawText() and SizeText() call a single function ProcessText(), which is
      the only place GD text and TTF text are distinguished. (So eventually
      we will be able to mix GD and TTF text on a plot.)

    + New internal functions ProcessTextGD() and ProcessTextTTF() draw (or size)
      GD and TTF text respectively. These are only called by ProcessText().
      These are re-implementations which properly position and align text.

    + Removed class variables title_angle, x_title_angle, and y_title_angle. The
      titles only work at their fixed angles anyway (0, 0, and 90 respectively).

    + Line spacing set with SetLineSpacing() now affects TTF text as well as
      GD text. Previously, it only affected GD text. The default line spacing
      happens to be usable for TTF text.

    + Added new callback hook 'debug_textbox' for developing, testing, and
      documenting. It provides access to the text area bounding box.

    + Removed unneeded class variables x_tick_label_height, y_tick_label_width,
      x_tot_margin, y_tot_margin.

2007-11-25
    * Improve error handling:
      Internal functions PrintError() and DrawError() are now the same. Both
      will draw the error message into the image and output it, and then
      trigger a user-level error. If no error handler has been set, it will
      exit, as before. But now the error message should also get logged, or
      written to the standard error stream, depending on the SAPI in use.
      You can now establish an error handler to catch most PHPlot errors and
      do some cleanup before exit.

      This fix also covers bug #1823774 "Default Font Path and Error Message
      Output".

      Fixed the return value of most PHPlot functions, to return False on
      error, else True. Since uncaught errors are fatal anyway, this only
      affects code with an error handler that returns, which is not
      recommended and unsupported at this time. These changes are for
      possible future error handling options.

2007-11-22
    * Fix bug 1836528 "Insufficient checking of parameter values":
      Rewrote CheckOption to correctly validate option choices.
      (It previously accepted substrings and other incorrect values.)
      PHPlot methods that use CheckOption now must be called with valid option
      values. Empty strings are also no longer accepted.

2007-11-17 (lbayuk)
    * Change to callbacks to support extra arguments.
      The PHPlot class can now pass extra arguments to a callback function.
      Callback functions now take the following form:
          my_callback($img, $passthru_arg, ...)
      Where '...' is zero or more additional arguments supplied by PHPlot to
      the callback. Each implemented callback reason will define any
      additional arguments it uses. The existing defined callbacks have not
      changed and do not currently pass any extra arguments.

2007-11-10 (lbayuk)
    * Fix bug 1827263 "Spoiled up pie-chart if $val is close to zero":
      Skip pie slices which would result in an integer angle of zero
      degrees, because the GD arc filling function will draw a complete
      circle for that case.
      Credit to Viacheslav <webdeveloper.ua at gmail.com> for finding this.

    * Removed 8 of the functions (class methods) marked 'deprecated'.  Only
      deprecated functions which seem to have been for internal use have
      been removed. Even old scripts shouldn't be using them, and they are
      becoming a problem to maintain.
      Removed: SetImageArea() DrawDotSeries() DrawLineSeries() CalcXHeights()
      CalcYWidths() DrawLabels() InitImage() DrawDashedLine().

2007-10-20 (lbayuk)     ===== Released as 5.0.4 =====
    * phplot.php: Updated copyright, version, and authors comments at top.
    * README.txt: Updated for new release
    * NEWS.txt: Add text for new release

2007-10-18 (lbayuk)
    * Add callbacks - experimental feature:
      New functions SetCallback, GetCallback, RemoveCallback.
      New internal function DoCallback.
      Added callback hooks to DrawGraph.

      Re-arranged code in DrawGraph to bring pie chart drawing into the main
      switch on plot type, rather than a special case in its own block. This
      makes it easier to follow and easier to add callback hooks.

    * Callbacks: New file, documentation for the new callbacks feature.
      (This won't be in the manual while it is an experimental feature.)

2007-10-15 (lbayuk)
    * Fix for bug 1813021: Miss-positioned right-justified vertical GD text.
      Fixed DrawText() to correctly position 90 degree right-justified text
      drawn in a fixed GD font. This could be seen with 90 degree Y tick
      labels. (Found by accident while working on TrueType text problems.)
      Also some code cleanup in DrawText: use elseif where appropriate.

2007-10-09 (lbayuk)
    * Code cleanup: Simplify SetIndexColor() and SetIndexDarkColor().
      There is no need to first try ImageColorExact, then ImageColorResolve
      if that fails. ImageColorResolve does all that for us.

      Code cleanup: Rewrite SetRGBColor(). It now detects if an unrecognized
      color name or color value form is used, and draws an error message.
      Before this it would get a PHP index error and "headers already sent"
      condition.

    * Code cleanup: Remove duplicated code for loading image files.
      Added new class-private function GetImage() which loads an image based
      on the image type, and also returns the image size. This replaces
      duplicated code in tile_img() and SetInputFile().
      Also fixed comment at top of SetImageFile which said it was deprecated.
      It isn't - it is used by the constructor. Moved the function out of the
      'deprecated' area up to below where it is used.

    * Code cleanup: PHPlot should not define or affect anything outside its
      own class.
      - Removed the check for __FUNCTION__ (PHP 4.3 and up). This is obsolete.
      - Do not set error_reporting to E_ALL. Although it is recommended that
      scripts do this, it is not the place of loaded classes to do it.
      - Remove unused global constant TOTY.
      - Removed constants MAXY and MINY. Global constants like this are bad.
      These were used as magic index values into data[] to hold min and max Y
      values for the row. Instead, put them in separate arrays which are
      named data_miny[] and data_maxy[]. (This seems to be only used by the
      data line drawing function.)

      Comment cleanup: Remove one commented-out partial function DrawPlotLabel,
      and fix another commented-out code fragment in DrawYErrorBar. Both of
      these had unmatched braces in them which caused a balance-braces check
      to fail.

    * Code cleanup, array padding: Get rid of functions outside the class
      and remove the interim fix for PHP 5 (which changed the behavior of
      array_merge).  Rewrote external function array_pad_array() as a new
      class function pad_array().  It does not need access to the class,
      but I don't think PHPlot should add to the global namespace more
      than necessary.  The third argument (array to use for padding) was
      never used, so it was removed. It always pads the array with itself.
      It now only works on 'usual integer indexed' arrays (0-based
      sequential integer index). The was previously required but
      undocumented for some of the arrays (like line_widths); now it is
      required for all style arrays and will be documented. Now we can pad
      the array to the required length, not just N times its previous
      length, and we don't need array_merge.  Deleted external function
      array_merge_php4() as it is no longer used.

      Deleted PHP end marker ?>. You don't need this and it can cause
      problems with extra whitespace in your output.

2007-09-24 (lbayuk)
    * Code cleanup: Fix ternary operator misuse.  This doesn't change
      behavior, but it was annoying me so I fixed it.
      Replaced all cases of code like this: $a = ($a > $b) ? $b : $a
      With just: if ($a > $b) $a = $b

    * Fix Makefile 'release' target to set owner/group when creating
      the tar file. This avoids having to run it as root, but it needs
      GNU tar to work.

2007-09-08 (lbayuk)
    * Fix for bug 1790441: Removed the PHPlot quasi-destructor function and
      the register_shutdown_function() call which arranged for it to be used.
      This was preventing release of memory when a PHPlot object was unset,
      because the registered shutdown function held a reference to it.
      So rather than improving memory use, it had the opposite effect.
        Note: It is no longer necessary or recommended to use reference
        assignment ($plot =& new PHPlot) for PHPlot object creation.
      Thanks to annajilly for the thorough analysis, bug report, and fix.

2007-09-05 (lbayuk)
    * Rewrote FormatLabel() to ignore blank label values. Adapted from a
      patch and feature request submitted by Gerhard Reithofer (exgerhardr).
      Blank labels used to produce an error if the LabelType was set to
      'time', and zero if set to 'data'. Now they are just ignored. This
      provides a simple way to have labels only at selected intervals when
      using time or data formats. For example, you can have a date/time
      label at every 10th data point by setting the labels for the other 9
      to be empty strings. Also: Removed $which_pos values 'plotx' and
      'ploty'.  These were unused by PHPlot and this is an internal-only
      function so there is no compatibility issue. Removed error checking on
      $which_pos for the same reason; the error message used an undefined
      variable anyway so it wouldn't have worked.

2007-08-26 (lbayuk)
    * Allow SetLegendStyle colorbox_align argument to be 'none', to suppress
      the colorboxes in the legend.

      Fix comment on $legend_text_align: empty means right, not left.

      Rewrote DrawLegend layout code to make it easier to understand. The
      result should be within 1 or 2 pixels of the previous size and position.

    * Fixes for bug 1779115: SetLegendWorld() fails on undefined vars
      Store the given coordinates and remember that they need to be converted
      from world to pixel coordinates, but defer trying to actually convert
      them until it is time to draw the legend. This way, there are no
      problems with the scale having to being set up first (which is nearly
      impossible to do).  Made the following changes:

        Changed legend class variables to be uninitialized, and unset (rather
        than empty string) means use the defaults. Added a new variable:
        $legend_xy_world. If it is set, (legend_x_pos, legend_y_pos) need to
        be converted to pixel coords. If it is unset, they are already pixel
        coords (or undefined, meaning defaults).

        Changed usage of internal function DrawLegend(): removed all arguments.
        X and Y were always the class variables anyway, and now it needs to
        also use the new flag to tell it if X and Y are world or pixel coords.
        The third argument was unused.

        Removed third, unused, default NULL argument from SetLegendPixels and
        SetLegendWorld.
 
        Changes to DrawLegend to convert x, y coords to pixel coordinates
        if they came from SetLegendWorld. Also account for new usage of
        the class variables: Test for unset to mean use default.

2007-08-04 (lbayuk)
    * New feature: control legend text and color box alignment.
      Adds a new function SetLegendStyle to adjust the alignment of the
      text and the color boxes inside the legend.
      Based on part of bug 1208054, contributed by David Hernández Sanz.

2006-12-02 (lbayuk)
    * Fixes for bug 1605555: Y Data Labels use wrong font and not formatted.
      Use y_label_font (not x_label_font) for Y Data Labels.
      Use the formatted value for the label, not the original text.
      (This applies to bar charts only, with the new Y data labels.)

    * One fix for bug 1208054: Localization of number format.
      If number formatting is enabled with 'data' format type, PHPlot previously
      used dot for decimal point and comma for thousands separator, and there
      was no way to change it.
      
      This fix adds a new function:
               SetNumberFormat($decimal_point, $thousands_separator)
      to set the separators.  In addition, if that function is not used,
      PHPlot will now try to use locale-dependent separators. If locale
      information is not available, it will fall back to the old defaults
      of dot and comma.

      Note: This change may have some negative effects. 1) If your locale is
      "C" or "Posix", you might not get a thousands separator now by default.
      You should be using a more specific locale. 2) If your PHP script is
      forcing a specific locale with setlocale(), PHPlot will probaby undo
      that because it uses setlocale(LC_ALL, '') to import locale information
      from the environment.  We have to do that, or a locale set through
      the environment is ignored. But it will override a manually set locale.

    * Fix for bug 937944: X/Y Tick Counts
      PHPlot could draw one too few Y tick marks, and one too many X tick marks.

      Changed the code to stop drawing X (Y) tick marks when the current X (Y)
      value exceeds the maximum X (Y) value plus a small fudge factor. The fudge
      factor accounts for cumulative error when repeatedly adding a delta to
      the X (Y) value.

      Notes: The bug report was writting about Y tick counts only, but X tick
      counts can also be wrong. The proposed fix in the bug report does not
      work in all cases.

      This fix changes the appearance of many plots which were missing the
      top-most Y tick mark. The extra X-tick mark problem is less common.

===== Released as 5.0rc3 =====

2006-11-13 (lbayuk)
    * Fix for bug 1437912: x-axis label misalignment [bar charts]
      The calculations were redone from scratch.
      New control variable 'bar_extra_space', which works in addition to
      'group_frac_width' to control how much extra space is around the bars.
      Made bar widths match for 'stackedbars' and 1-bar-per-group 'bars'.

      NOTE: This changes the appearance of charts. bars in 'stackedbars'
      will now be thinner, and bars in 'bars' graphs will be thicker. I
      saw no reason for them being different before.

      This fix required fixing the positioning on the new bar data labels,
      which was off before.  The bar data labels will now be centered.
      Additional fixes to bar chart data labels:
         For negative values, the label will center under the bar.
         Fixed X-adjustment to account for shading.
         Fixed to not suppress the data label if the value is 0.


2006-11-10 (lbayuk)
    * Fix for bug 1594457: DrawError text wrap and background fix
      Do error image white background correctly, and word-wrap the text.

    * Fix for bug 1594458: Suppress lines or points in 'linepoints' 
      Don't draw X data labels twice for 'linepoints'.
      Allow SetPointShapes value 'none' to suppress points, and allow
      SetLineStyles value 'none' to suppress lines. This allows a 'linepoints'
      graph to mix lines only, points only, and both on the same graph.


2006-11-09 (lbayuk)
    * Fixes for bug 1446523:
      + Wrong variable name in deprecated SetAxisFontSize()
      + Fails to properly handle error if SetDataValues() was never
        called, or not called with a data array.

    * Fix for bug 1117122: Pie Chart ignores SetPlotAreaPixels
      Don't let DrawGraph recalculate the plot area for pie charts if the
      user already set it with SetPlotAreaPixels.

      NOTE: This fix may slightly change the appearance of some pie charts,
      whether or not they use SetPlotAreaPixels.

    * Fix for bug 1103992: Wrong max Y calculated for stackedbars
      Changes FindDataLimits to calculate max Y correctly. It was counting
      the first Y value in each record twice, which is always wrong but
      only affected stackedbars because the Y values are summed.

    * Fix for bug 1096199: Wrong error bar colors in DrawDotsError.
      Rewrites DrawDotsError to make it work like DrawLinesError to
      correctly increment the record and color indexes.
      Also fixes uninitialized x_now_pixels.

    * Fix for bug 1096197: No borders on unshaded Draw[Stacked]Bars
      Unshaded Bars and StackedBars covered the border with the rectangle.
      The fix is to draw the rectangle, then the border.

      NOTE: This fix changes chart appearance. Bars and Stacked Bars
      will now get a black border around each bar by default, if you
      turn off the 3D-shading. If you want borderless, unshaded bars
      you need to use SetDataBorderColors to set the data border colors
      to be the same as the data colors.

    * Fix for bug 1333164: Negative data values, if string variables, result
      in unfilled bars. The problem was a string-to-string compare of a
      negative number with the empty string x_axis_position. Fixed by
      initializing x_axis_y_pixels to 0 if SetXAxisPosition was not used.


2005-04-17 (afan)
    * Fix for bug [ 1161072 ] SetInputFile warning, background overwrite

    * Bug 1182672 fixed

2005-04-15 (afan)
    * fix for bug: [ 1182666 ] Y Auto-scale rounds in wrong direction

    * Fix for bugs 1144644 TrueType font path problems and 1106328 TTF
      path/filename inconsistency

    * Fix Bug: [ 1117120 ] X Title sizing uses Y Title font height

2005-04-13 (afan)
    * Error in SetLineStyles() - does not accept an array argument


2005-03-29 (afan)
    * Small typo fixed in SetYDataLabelPos

    * Update SetDataLabelPos: For past compatability we accept plotleft,
      ...but pass it to SetTickLabelPos

2005-03-26 (afan)
    * Change to line 3802: data lables now work with multiple bars with *$idx

2005-03-25 (afan)
    * Added Function DrawDataLabels to put data labels in world coords,
      added call from DrawBars and modified SetYDataLabelPos to flag
      whether or not to call DrawDataLabels.

2005-01-20 (migueldb)
    * Many bugfixes reported and solved by L. J. Bayuk. Thanks!
      + fixed bug #1096190
      + FindDataLimits(): fixed bug #1096192
      + CalcTranslation(): fixed bug #1101317
      + DrawImageBorder(): fixed bug 1096200
      + DrawXDataLabel(): fixed bug 1099879
      + DrawDots(): fixed bug #1096194

===== Released as 5.0rc2 =====

2004-10-24 (migueldb)
    * array_merge_php4(): added to cope with the bug introduced by
        the change in array_merge() from PHP4 to PHP5 (I haven't verified this)
    * Fixed some divisions by zero, thanks to an old bug report.

2004-09-09 (migueldb)
    * SetPointSize(): deprecated
    * SetPointSizes(): added as replacement for SetPointSize().
      Now able to set point sizes on a per line basis.
    * SetPointShape(): deprecated.
    * SetPointShapes(): added as replacement for SetPointShape().
      Now able to set point shape on a per line basis.
    * DrawDot(): now needs record number to decide which dot shape and
      size to draw.
    * CalcMargins(): dirty fix for x data label placing.
    * tile_img(): fixed tile placement.

2004-06-14 (migueldb)
    * SetXTickLabelPos() and others: more on the bug reported by Jo Demol.
    * Fixed bug reported by Jo Demol.

2004-05-11 (migueldb)
    * SetBgImage(): added.
    * SetPlotAreaBgImage(): added.
    * SetInputFile(): deprecated.
    * DrawBackground(): now accepts images as backgrounds.
    * DrawPlotAreaBackground(): now accepts images as backgrounds.
    * tile_img(): internal method added.

..........
Editor's Note: For older changes to PHPlot, please see the CVS logs.
