Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
98 - 1
This is the Change Log for PHPlot.
2
The project home page is http://sourceforge.net/projects/phplot/
3
-----------------------------------------------------------------------------
4
 
5
2015-11-03 ===== Released as 6.2.0 =====
6
    * phplot.php: Updated version comment
7
    * README.txt: Updated for new release
8
    * NEWS.txt: Add text for new release
9
 
10
2015-10-31
11
    * Feature Request #58 "data borders for area plot types":
12
      Moved the code for data borders from DrawSquaredArea() into a new
13
      internal function DrawAreaFillBorders(). Use that function in both
14
      DrawSquaredArea() and DrawArea() to implement data borders for all 4
15
      plot types (area, stackedarea, squaredarea, and stackedsquaredarea).
16
 
17
      Note: There is a problem with the data borders in area and squaredarea
18
      plots, when the data values are not decreasing in Y. The areas overlap
19
      but the data borders are drawn without regard for the overlap. This is
20
      not from this change, but the previous change which implemented data
21
      borders for squaredarea plots. More on this to come.
22
 
23
2015-10-30
24
    * Fixed comments on functions and variables for data borders, which are
25
      no longer used only for bar and stackedbar plot types.
26
 
27
2015-10-25
28
    * Feature Request #57 "squarefilled plot type":
29
      + Defined 2 new plot types: squaredarea and stackedsquaredarea.
30
      + Added new internal function SetupAreaPlot() which sets up for an
31
        area fill plot, using code moved from DrawArea().
32
      + Changed DrawArea() to use SetupAreaPlot(). Also fixed mis-named
33
        variables: row versus column.
34
      + Added new internal function DrawSquaredArea() to draw the new plot
35
        types squaredarea and stackedsquaredarea.  This uses the new
36
        SetupAreaPlot(), draws the area fills and optional border.
37
 
38
2015-10-22
39
    * Changed version to 6.2.0-unreleased (was: 6.1.1-unreleased).
40
 
41
    * Feature Request #56 "Hidden Y values when zero":
42
      Extended the 'printf' label formatting type by allowing 1-3 format
43
      strings. Selection of a format string depends on the sign of the value
44
      being formatted (similar to the way spreadsheets do cell formatting).
45
      This supports a wide variety of format variations, including the one
46
      requested in this FR, without having to use a custom function.
47
      + Changed SetLabelType() to accept up to 3 format strings, and store
48
        then in the class variable as an array.
49
      + Changed FormatLabel() to accept a format string, or an array of
50
        1, 2, or 3 format strings, and select among them based on the sign
51
        of the value being formatted.
52
 
53
2015-08-29
54
    * Fixed bug #172 "Fixes for PHP7":
55
      PHP7 (currently pre-release) deprecates the use of the class name
56
      as the constructor, which was how PHP4 did it. Fixed the constructor
57
      name to work with PHP7. Note this may affect extended classes.
58
 
59
2015-03-25
60
    * Fixed bug #170 "Replace eval():...":
61
      Removed the one use of eval() in PHPlot, because eval() makes people
62
      nervous, is incompatible with some VM setups, and the specific usage
63
      was hard to understand.  Changed SetDefaultDashedStyle() to create a
64
      string template (rather than a code string) in the class variable
65
      default_dashed_style. Changed internal SetDashedStyle() to apply the
66
      template without eval(). There is no change to the API or behavior,
67
      except PHPlot now validates the dashed line specification argument to
68
      SetDefaultDashedStyle() more thoroughly.
69
 
70
2015-03-21
71
    * Feature Request #55 "Method documentation in phpdoc format":
72
      Added phpdoc comments (docblocks). All class functions (methods) now
73
      have docblocks with summary, parameters, and return value (other than
74
      the old deprecated functions, which have just a @deprecated tag).
75
      phpDocumentor2 is able to generate documentation from the source, but
76
      there is no plan to use this to replace any portion of the PHPlot
77
      Reference Manual.
78
 
79
      In order to accommodate phpDocumentor2 problems with functions that take
80
      variable argument lists, while remaining compatible with PHP 5.5 and
81
      PHP 5.4, it was necessary to change the parameter lists for 5 public
82
      methods and 2 protected methods. No change was made to the usage of
83
      these functions: unused parameter names were added, with NULL defaults,
84
      so phpdoc '@param' tags could be used for them.
85
 
86
    * Mark as pre-release 6.1.1
87
    * Makefile: Added phpdoc target to run phpDocumentor2.
88
 
89
2013-05-11 ===== Released as 6.1.0 =====
90
    * phplot.php: Updated version comment and version constant
91
    * README.txt: Updated for new release, fix copyright year
92
    * NEWS.txt: Add text for new release
93
 
94
2013-04-22
95
    * Feature request #52 "Box Plots":
96
      + New plot type 'boxes'.
97
      + New internal method DrawBoxes() draws a box plot.
98
      + Added 4 new tuning variables for box plot feature size tuning.
99
 
100
2013-04-16
101
    * Mark as pre-release 6.1.0
102
 
103
    * Feature Request #47 "Extend horizontal plots to more types":
104
      Implemented horizontal error plots. (This is the remaining,
105
      unimplemented part the feature request.)
106
      + Added new datatype 'data-data-yx-error' for horizontal error plots.
107
      + Added new internal static array $datatypes to hold information
108
        about the available data types.
109
      + Added new internal static array $datatypes_map to handle the old
110
        data type names, and also a new alias 'data-data-error-yx'.
111
      + Rewrote internal DecodeDataType() to use the new array instead
112
        of code to set the datatype flags from the data type.
113
      + Changed SetDataType() to use the 2 new arrays to map and validate
114
        the data type.
115
      + Replaced internal function DrawYErrorBar() - draw one error bar
116
        for vertical plots - with DrawYErrorBars() and DrawXErrorBars(),
117
        each of which draws both parts of an error bar pair.
118
      + Changed DrawDots() and DrawLines() to support both vertical and
119
        horizontal error plots.
120
 
121
2013-04-03 ===== Released as 6.0.0 =====
122
    * README.txt: Fix PHP versions used for testing - should be 5.4.13 on
123
      both Linux and XP.
124
 
125
2013-04-02
126
    * phplot.php: Fixed 2 comment errors. No code changes.
127
    * NEWS.txt: Add 4 missing items: 2 more compatibility issues, and 2
128
      changes that were made along side feature requests but were not
129
      directly described in those requests.
130
 
131
2013-04-01
132
    Preparing for 6.0.0 release on 2013-04-03
133
    * phplot.php: Updated version comment and version constants
134
    * README.txt: Updated for new release
135
    * NEWS.txt: Add text for new release
136
 
137
2013-03-27
138
    * Merged /branches/Rel6 changes back into trunk. Changes recorded below
139
      with "(/branches/Rel6)" were made on the branch. Note: Subversion
140
      change history for those changes is only available by looking at
141
      revision 1558 on the branch, for example:
142
         svn log ^/branches/Rel6/phplot/phplot.php@1558
143
      The /branches/Rel6 tree has not been deleted, but may be in the future
144
      (as recommended in Subversion documentation).
145
 
146
2013-03-22 (/branches/Rel6)
147
    * Changed default minimum number of ticks intervals (min_ticks) for both
148
      X and Y from 5 to 8. Considering PHPlot previously used 10 intervals
149
      by default, 5 is just too low.
150
 
151
    * Numeric change to CalcStep125() - slight tweak to make the tick steps
152
      come out right for exact powers of 2.
153
 
154
2013-03-19 (/branches/Rel6)
155
    * Fixed bug #166 "Legend, UsePointShapes, and shape='none'":
156
      Added argument to DrawShape() to disallow using 'none' as a shape.  This
157
      is used when drawing markers in the legend. DrawShape will draw the
158
      'line' shape instead of 'none' in this case.
159
 
160
    * Code cleanup: minor cleanup in CalcMaxDataLabelSize() and
161
      CalcMaxTickLabelSize() in selecting 'x' vs 'y' cases.
162
    * Code cleanup: minor cleanup in GetDataColor().
163
 
164
2013-03-18 (/branches/Rel6)
165
    * Added adjustment factor in CalcStepBinary() to avoid round-off errors
166
      for a few values where log2(2^N) < N.
167
    * Fixed CalcPlotRange() to prevent the plot range ends from crossing
168
      to the wrong side of 0 when there is a tick anchor. Instead, the
169
      range will clip to zero, and there won't be a tick mark at that end.
170
    * Fixed local variable names in CalcTicks(): data_min/data_max corrected
171
      to plot_min/plot_max which is more descriptive.
172
 
173
    * Fixed bug #167 "Fails to find a default font on Ubuntu":
174
      Debian changed the install location for the LiberationSans fonts,
175
      which also affects Ubuntu and related distributions. Added a new
176
      entry to the default font search list in GetDefaultTTFont() so the
177
      font will be found at the new location.
178
 
179
2013-03-11 (/branches/Rel6)
180
    * Expanded the two modes for calculating a tick increment to three:
181
      decimal (1,2,5 * 10^N), date, and binary (2^N).
182
      + Changed member array $tickctl[] key 'datetime_interval' (boolean) to
183
        'tick_mode' (3 valued string).
184
      + New internal function CalcStepBinary() for binary mode.
185
      + Changed CalcStep() to select from 3 modes now, using tick_mode.
186
      + Changed internal function TuneAutoTicks() and public functions
187
        TuneXAutoTicks() and TuneYAutoTicks() parameter 'datetime_interval'
188
        to 'tick_mode', checked for validity.
189
 
190
    * Account for tick anchor when adjusting the plot range to start and
191
      end at a tick mark. After this change, the range will start and end
192
      at a tick mark (when in the default mode) even when a non-zero tick
193
      anchor has been set.
194
      + Change CalcPlotRange() so that when adjusting the range endpoints
195
        to the next tick mark, it uses tick_anchor in the equation. It will
196
        not adjust through zero, though. (Example: Range 0-10, tick anchor
197
        at 1, resulting range will start at 0, not -9, so the range in this
198
        case will not start at a tick mark.)
199
 
200
    * Code cleanup: Avoid use of variable property names such as
201
      '$this->{"num_$which" . "_ticks"}' to refer to either num_x_ticks or
202
       num_y_ticks, depending on $which. Although these work and are more
203
       compact, they make debugging harder (e.g. trying to find everywhere
204
       num_x_ticks is used can overlook these).
205
 
206
 
207
2013-03-01 (/branches/Rel6)
208
    * Changes to range and tick calculations, still trying to get more
209
      cases to come out right.
210
      + Add per-plot-type tuning variable plots[]['adjust_type']. This is
211
        to address the issue that some plot types need extra room around
212
        the data points, and some do not.
213
      + Moved the 6 class variables for tuning range and tick calculations
214
        into 2 arrays $rangectl[] and $tickctl[], to make it easier to
215
        access especially for new tuning functions.
216
      + Added 2 new public functions for tuning plot range:
217
        TuneXAutoRange() and TuneYAutoRange().
218
        These are implemented by a new internal function TuneAutoRange().
219
      + Added 2 new public functions for tuning tick calculations:
220
        TuneXAutoTicks() and TuneYAutoTicks().
221
        These are implemented by a new internal function TuneAutoTicks().
222
      + New internal function GetRangeEndAdjust() which implements the new
223
        per-plot-type default for range end adjustment.
224
      + Changed usage of internal CalcStep(), which now gets parameters
225
        directly from the new class variable arrays.
226
      + Rewrote CalcPlotRange() - use the new class variable arrays, and
227
        now implements 3 methods for adjusting the range endpoints.
228
    Note: This is almost done. There is one known issue with tick anchors.
229
 
230
2013-01-19 (/branches/Rel6)
231
    * Minor changes related to range and tick calculations.
232
      + Changed FindDataLimits() results for 'implied' range case to include
233
        the margins, so CalcRangeInit() does not have to adjust them now.
234
      + Simplified usage of internal CalcRangeInit().
235
      + Moved debug_scale callbacks from CalcStep() and CalcPlotRange() to
236
        caller CalcPlotAreaWorld(), to make it more consistent with 5.8.0.
237
 
238
2013-01-17 (/branches/Rel6)
239
    * More changes for feature request #29 "Finer control over plot element
240
      colors":
241
      + Added new method SetLegendBgColor() to set the legend background
242
        color, overriding the image background color.
243
      + Added new method SetLegendTextColor() to set the legend text color,
244
        overriding the general text color.
245
      + Added new class variables for above: legend_bg_color, legend_text_color,
246
        ndx_legend_bg_color, ndx_legend_text_color.
247
      + Changed SetColorIndexes() to allocate and default the new colors.
248
      + Changed DrawLegend() to use the new colors.
249
 
250
2013-01-02 (/branches/Rel6)
251
    * Extend copyright years to 2013.
252
    * Changed the static plots[] class variable element 'draw_axes' (default
253
      if absent is True) to 'suppress_axes' (default if absent is False).
254
    * In DrawGraph(), don't use extract() on the whole static plots[] array
255
      entry when only 3 variables are used. Access each needed variable.
256
 
257
2012-12-27 (/branches/Rel6)
258
    * Added constant PHPlot::version_id which is an integer (vs
259
      PHPlot::version which is a string). This is for the test suite so it
260
      can check for a minimum version. For PHPlot-6.0.0 the value is 60000.
261
 
262
2012-12-23 (/branches/Rel6)
263
    * Feature request #50 "Control legend colorbox borders":
264
 
265
      + Added new method SetLegendColorboxBorders($mode) to control the color
266
        and presence of legend color box borders. The default behavior is
267
        backward compatible (color box borders use Text color).
268
        + Added new class variable: legend_colorbox_borders.
269
        + Changed DrawLegend() to add new controls for color box borders.
270
 
271
      + Added new method SetDrawDataBorders() to enable or disable data
272
        borders on bars and stackedbars plots. This makes it possible to have
273
        the same appearance for the legend color boxes and the data bars, for
274
        both shaded and unshaded plots. The default behavior is backward
275
        compatible (borders for unshaded, no borders if shaded).
276
        + Added new class variable: draw_data_borders
277
        + Changed usage of internal GetBarColors() to return both shade and
278
          border colors (they were never both needed before).
279
        + Change usage of internal DrawBars() to take both shade and border
280
          colors, and to control border drawing using the new flag.
281
        + Changed 4 bar-chart drawing functions to get both shade and border
282
          color and pass both to DrawBar().
283
 
284
    * Feature request #51 "Lines instead of colorboxes in legend":
285
 
286
      Extended the use of SetLegendUseShapes() to apply to more plot types.
287
      For lines and squared plots, this will replace the color boxes in the
288
      legend with short line segments, with color, style, and width. The new
289
      behavior is backward compatible, as SetLegendUseShapes(True) only
290
      worked with points and linepoints plots before.
291
 
292
      + Added a new optional key to the internal static $plots array called
293
        'legend_alt_marker' to indicate the type of alternate marker that
294
        can be used in the legend for this plot type, if any.
295
 
296
      + Changed description of SetLegendUseShapes(), which applies to more
297
        plot types now.
298
 
299
      + Changed return variables from internal GetLegendSizeParams() to
300
        replace do_colorbox with the more general colorbox_mode. Also, this
301
        function implements the 4x scale-up on the color box width for 'line'
302
        mode.
303
 
304
      + Changed usage of internal SetDashedStyle() to streamline all the
305
        places where line styles are available.
306
 
307
      + Changed functions using styled lines per new SetDashedStyle() usage:
308
        Draw[XY]Ticks(), Draw[XY]DataLine(), DrawLines(), DrawSquared().
309
 
310
      + Changed DrawLegend() code for shape vs color box. Don't use
311
        point_counts to determine if point shapes should be used - use the
312
        new key in $plots[].  Implement line shape markers, including color,
313
        width and style.
314
 
315
    * Unrelated fix, found when testing above changes:
316
      + Added a work-around in DrawBar() when drawing a bar with height 0.
317
        The GD function for drawing unfilled rectangles puts "whiskers" at the
318
        ends when height is 0 (see PHP bug #53154), so draw a line instead.
319
 
320
 
321
2012-09-23 (/branches/Rel6)
322
    * Bug #164 (old #3557510) "Calculated defaults applied to subsequent
323
      plots":
324
      Fixed for X and Y data label formats.
325
      + CheckLabels(): Don't copy X or Y entries to XD or YD as defaults,
326
        because these will stick for additional plots.
327
      + FormatLabel(): Use the X or Y entries when XD or YD are needed
328
        but found to be empty.
329
 
330
2012-09-18 (/branches/Rel6)
331
    * Feature request #47 "Extend horizontal plots to more types":
332
 
333
      Implemented horizontal form of lines, points, and linepoints plots
334
      (using data types data-data-yx and text-data-yx). Merged error plot
335
      cases into drawing functions for lines and points.  As a side effect,
336
      data value labels now work with error plots.  (Note: Horizontal error
337
      plots are not available, but could be added without much work.)
338
      + Rewrote internal DrawDots() to draw error bars and horizontal plots
339
        too.  Removed internal DrawDotsError() which is now unused.
340
      + Rewrite internal DrawLines() to draw error bars and horizontal plots
341
        too.  Removed internal DrawLinesError() which is now unused.
342
      + Changed usage of internal DrawYErrorBar(): removed error_bar_type
343
        argument because this is always the class variable error_bar_shape.
344
 
345
      Implemented Y data label lines, for horizontal plots.
346
      + New public function SetDrawYDataLabelLines()
347
      + New internal function DrawYDataLine()
348
      + Added argument to internal DrawYDataLabel() for plot types that
349
        support data label lines, and call DrawYDataLine() if enabled.
350
      + Changed DrawDots() and DrawLines() to request data label lines
351
        for horizontal plots too.
352
 
353
2012-09-12 (/branches/Rel6)
354
    * Feature request #46 "Control pie chart borders":
355
      Added a separate color control for pie chart segment borders (vs
356
      over-used Grid color), and a flag to enable or disable the borders.
357
      Borders now work with shaded pie charts too. The defaults are
358
      compatible: no borders for shaded pie charts, borders using grid
359
      color for unshaded pie charts.
360
      + New function SetPieBorderColor($color)
361
      + New function SetDrawPieBorders($draw)
362
      + Added separate color index value for pie chart borders, defaulting
363
        to the grid color index.
364
      + Changed DrawPieChart() to use the new controls, including
365
        new ability to have borders with shaded pie charts.
366
 
367
2012-09-10 (/branches/Rel6)
368
    * Fixed bug #165 "Missing axis labels on some empty plots":
369
      Don't skip the body of DrawLines(), DrawLinesError(), DrawSquared(),
370
      or DrawBubbles() when the data column count is zero. Even though there
371
      are no points to plot, the outer loops need to run in order to get
372
      the X axis data labels drawn.
373
 
374
    Note: Bug and Feature Request numbers above this point refer to the
375
    new "Sourceforge2" trackers (low numbers). Below this point, the older
376
    tracker numbers (large numbers, unique across all trackers) are used.
377
 
378
2012-08-27 (/branches/Rel6)
379
    Ongoing effort to provide 'reset to default' options where missing:
380
    * Fixed SetTransparentColor() to accept NULL (or no argument) to mean
381
      reset to default - no transparency.
382
    * Allow missing argument to SetDefaultTTFont() to mean the same thing
383
      as NULL - reset to default TrueType font name.
384
 
385
2012-08-20 (/branches/Rel6)
386
    * Declare all class variables at top, initialize where valid, and make
387
      most PHPlot class variables 'protected' rather than 'public' visibility.
388
      This is a significant change, and undoes the change of 2012-06-14
389
      below ("Code cleanup: Avoid static initialization of class member
390
      variables that can just as well be unset by default").
391
 
392
      All variables listed in the "Tuning Parameters" section of the manual
393
      remain public. In addition, the $img and $fonts member variables
394
      remain public, although use in scripts is discouraged. (These are
395
      public due to historical use, including use in the PHPlot Test Suite.)
396
 
397
      Compatibility warning: This will break any script that accesses PHPlot
398
      member variables other than those listed above as remaining public.
399
 
400
      Code changes were made (mostly undoing changes from 2012-06-14) to
401
      account for variable initialization, in many places. For example,
402
      we can now test $this->use_ttf directly, rather than using empty() on it.
403
      Replace unset() with assignment to NULL where variables have a special
404
      state of "unspecified default".
405
 
406
    * Bug #3557510 "Calculated defaults applied to subsequent plots":
407
      Use two variables for X Data Label Angle: one for user-set value, and
408
      one for the effective value. This fixes a problem with multiple plots,
409
      where the X Data Label angle was calculated for the first plot, then
410
      applied to subsequent plots as if it was user-set (rather than being
411
      recalculated).
412
 
413
    * Renamed variables: x_tick_inc to x_tick_inc_u, and tick_step to
414
      x_tick_inc (similar for y_tick) for consistency with above X Data
415
      Label Angle variables. The _u suffix is set by the user; the other
416
      is the effective value.
417
 
418
    * Changed return from internal GetLegendSizeParams() - removed text_align
419
      and colorbox_align from the array. These were the same as the two
420
      class variables (with defaults applied), but now the defaults are
421
      initialized so there is no need to return them separately.
422
 
423
 
424
2012-08-14 (/branches/Rel6)
425
    * Code cleanup: Use 'self::' to access static properties and constants,
426
      rather than the actual class name.
427
    * Cleanup SetDefaultFonts(); no functional change.
428
 
429
2012-08-09 (/branches/Rel6)
430
    * Fixed problem with grid defaults and multiple plots. The default
431
      setting, to draw the grid or not, was being stored back to the class
432
      variables, and then this was used for the next plot rather than a new
433
      default being calculated. This was wrong when mixing vertical and
434
      horizontal plots. Removed internal CalcGridSettings() and added new
435
      internal GetGridSetting(), so the default is not stored back into the
436
      class variables.
437
      Also changed DrawXGrid() and DrawYGrid() to allow NULL or omitted
438
      argument to mean restore the default behavior.
439
 
440
2012-08-03 (/branches/Rel6)
441
    * Fixed problem with multiple plots and calculated tick increments.
442
      The calculated values were stored back into the object, using the same
443
      class variables as SetXTickIncrement() and SetYTickIncrement(). With
444
      subsequent plots using the same object, the calculated values were seen
445
      as user-provided, so new values were not calculated even if the data
446
      range changed. This differs from the 5.x behavior and the manual.
447
      Now, new class variables x_tick_step y_tick_step are used to store
448
      the effective values for the tick increments. If not user-set, the
449
      values will be recalculated for each plot.
450
 
451
2012-07-09 (/branches/Rel6)
452
    * Feature request #3541471 "Control pie chart start angle":
453
      Added SetPieStartAngle() and SetPieDirection(), and changed
454
      DrawPieChart() to work with any start angle and either direction.
455
 
456
2012-07-07 (/branches/Rel6)
457
    * Changed internal DrawText() and SizeText() to take a text element
458
      name (e.g. 'x_title') rather than a font name. This is actually
459
      implemented in the lower-level ProcessText().  For compatibility,
460
      however, ProcessText() still does accept a font array.  The reason for
461
      the change is that when using a drawing annotation callback with a pie
462
      chart, this makes it much easier for the callback to draw text using a
463
      different font than the one used for the pie chart labels.
464
      Changed all internal callers of DrawText() and SizeText() to pass the
465
      text element name rather than the $fonts[] array entry.
466
 
467
2012-06-26 (/branches/Rel6)
468
    * Fixed conflict between setting number of ticks (SetNum[XY]Ticks) and the
469
      new range calculations. (The range was adjusted after calculating the
470
      tick increment, but the tick increment depended on the range here. So if
471
      you asked for N tick intervals, you probably got N+1.) Moved code to
472
      handle pre-specified tick increment or number of ticks from CalcStep()
473
      to CalcPlotRange(), and let CalcPlotRange() do special handling for the
474
      case with number of ticks set.
475
 
476
2012-06-25 (/branches/Rel6)
477
    * Removed TuneAutoRange(). The tuning parameters will be documented as
478
      class variables that can be set directly, like other existing variables
479
      that tune things. (The problem with TuneAutoRange is that it is a new,
480
      3rd way to change plot settings - Set*() functions and directly changing
481
      a class variable being the other two. We don't need another interface.)
482
 
483
2012-06-20 (/branches/Rel6)
484
    * Fix validation in SetPlotAreaWorld(). Enforce min<max rather than
485
      min<=max. Allowing min==max was pointless, as it just produced an
486
      error later in CheckPlotRange rather than sooner in SetPlotAreaWorld.
487
      (Found while doing documentation updates)
488
 
489
2012-06-14 (/branches/Rel6)
490
    * Code cleanup: Avoid static initialization of class member variables
491
      that can just as well be unset by default. (Some variables had been
492
      removed in prior releases, when they needed dynamic initialization.
493
      So the top of the class declaration was no longer useful as
494
      documentation of all the class variables.) A comment was added to
495
      direct the reader to the Reference Manual, which documents all member
496
      class variables. The following class variables no longer get
497
      declared and initialized:
498
          $bar_extra_space, $bar_width_adjust, $browser_cache,
499
          $color_array, $draw_broken_lines, $draw_plot_area_background,
500
          $draw_x_data_label_lines, $grid_at_foreground,
501
          $group_frac_width, $is_inline, $legend, $output_file, $use_ttf,
502
          $x_axis_position, $x_label_angle, $y_axis_position,
503
          $y_data_label_angle, $y_label_angle
504
 
505
      Except for the minor differences noted below, there are no changes
506
      in behavior (provided one does not access the internal variables):
507
      + SetRGBArray(): Report an error if an invalid color map name is used,
508
        rather than just using a black and white array with no error reported.
509
      + Removed unneeded class variable: $color_array
510
      + GetLegendSize() now returns FALSE if there is no legend.
511
 
512
    * Code cleanup: In CalcMargins(), don't make unnecessary local copies
513
      of member variables.
514
 
515
2012-06-09 (/branches/Rel6)
516
    * Minor fixes for incorrect use of empty(). (Need to remember that
517
      empty("0") and empty(0) are true, so this cannot be used on string
518
      or number variables that could be "0" or 0.)
519
      + Fixed handling of output_file and input_file.
520
      + Fixed DrawMessage() - don't use empty() on color index (could be 0).
521
      Checked and found no other misuses of empty().
522
 
523
2012-06-06 (/branches/Rel6)
524
    * Remove obsolete file: Imagemaps.txt - This feature is now documented
525
      in the Reference Manual and no longer 'experimental'.
526
      Makefile: Remove Imagemaps.txt from release.
527
 
528
2012-06-01 (/branches/Rel6)
529
    More changes for automatic range and tick increment calculations:
530
 
531
    + CalcPlotRange() - renamed "top_adjust" to "end_adjust", since it
532
      now potentially applies to both ends of the plot range.
533
 
534
      Added more comments explaining some of the more opaque expressions.
535
 
536
      Redid adjustment of max (for positive) and min (if negative) ends
537
      of the plot range.  The plot range will now always begin and end at a
538
      tick mark. (PHPlot-5.8.0 does this, but previous changes on this
539
      branch made it stop ending on a tick mark.)
540
 
541
      Also, it will now leave more space at the ends away from zero - by
542
      default, at least 0.3 * tick increment (since it ends at a tick, you
543
      get between 0.3 and 1.3 tick increments of space). This also means
544
      data value labels are much less likely to run off the plot area.
545
 
546
    + TuneAutoRange() - renamed "top_adjust" to "end_adjust".
547
      Added top comments explaining the parameters in more detail.
548
 
549
    Note: Range ends are much better now, and as a result the PHPlot
550
    Test Suite results are greatly improved.
551
    There are still issues with tick anchors and date/time ranges.
552
 
553
2012-05-28 (/branches/Rel6)
554
    More changes for automatic range and tick increment calculations:
555
 
556
    + Changed internal CalcStep() usage - pass the range, not the min and
557
      max.  This is possible because the range checking was moved
558
      to CheckPlotRange().
559
 
560
    + New internal CheckPlotRange() makes sure the plot range is positive,
561
      after defaults are applied. This expands on code moved from
562
      CalcStep().  Called by CalcPlotRange().
563
 
564
    + CalcPlotRange() - renamed "zero affinity" to "zero magnet". Call
565
      new CheckPlotRange() to validate and adjust (if necessary) the range.
566
 
567
      Changed the zero magnet algorithm. This is based on some experiments
568
      with Libreoffice Calc charting. First, greatly increased the default
569
      value for zero_magnet from 0.1 (which gives 11% range expansion) to
570
      0.857 (or 6/7, which gives 600% range expansion). This means PHPlot
571
      will now expand the range up to 6 times if that would result in
572
      including 0 in the range.  Second, the tests were corrected, so now
573
      it compares the range with zero versus the original range when
574
      deciding whether to extend the range to include zero.
575
 
576
    + TuneAutoRange() - renamed "zero affinity" to "zero magnet".
577
 
578
    + CalcPlotAreaWorld() - pass back any error return from CalcPlotRange().
579
 
580
    Note: There is still work to be done on how it automatically adjusts the
581
    end of the range away from zero.  Currently, it tends to leave too
582
    little space, which is a problem with data value labels.
583
 
584
 
585
2012-05-09 (/branches/Rel6)
586
    * Incorporate in-progress changes for bug #2919086 "Improve tick
587
      interval calculations" and bug #1795969 "Fix automatic Y range
588
      calculations". This is planned for PHPlot-6.0.0.
589
      NOTE: This is not complete, stable, or  ready for use!
590
 
591
      + Remove initialization of 8 class variables: num_[xy]_ticks,
592
        [xy]_tick_inc, skip_*_tick. "Unset" is now the default value.
593
 
594
      + New internal function CalcStep125(), which calculates a tick
595
        increment of the form TI = K * 10 ** I, where K = 1, 2, or 5.
596
 
597
      + New internal function CalcStepDateTime(), which calculates a tick
598
        increment for date/time scales.
599
 
600
      + New internal function CalcStep(), which calculates a good tick
601
        increment given the data range and scale type, among other factors.
602
 
603
      + New internal function CalcRangeInit(), which provides the initial
604
        guesses at the plot area range limits.
605
 
606
      + New internal function CalcPlotRange(), which calculates the limits
607
        of the plot area range for either X or Y (if not user-provided).
608
        It also calculates the tick increment, if necessary.
609
 
610
      + Rewrote internal function CalcPlotAreaWorld(). This now just calls
611
        CalcPlotRange() twice - once for X, and once for Y.
612
 
613
      + Changed SetPlotAreaWorld() to validate any provided values, making
614
        sure the range is non-negative (which would break the later
615
        calculations). It now throws an error on invalid range.
616
 
617
      + Rewrote internal function CalcTicks(). This no longer calculates
618
        the tick increment, which was calculated by CalcPlotRange() because
619
        the range adjustment is tied to the tick increment now.
620
 
621
      + Remove an unneeded error check in protected function
622
        CalcMaxTickLabelSize().
623
 
624
      + Changed public functions SetXTickIncrement() and SetYTickIncrement()
625
        to not reset the number of tick marks.  Changed public functions
626
        SetNumXTicks() and SetNumYTicks() to not reset the tick increments.
627
        These changes are part of fixing an order-dependency problem with
628
        these function pairs (different result from calling SetXTickIncrement()
629
        then SetNumXTicks(), versus calling them in the other order).
630
 
631
      + New public function TuneAutoRange(). This allows setting (currently)
632
        5 parameters for either X or Y axis that are used to adjust the range
633
        and tick increment calculations. For example, one parameter sets the
634
        minimum number of tick intervals when the tick increment is
635
        automatically calculated.
636
 
637
2012-05-07 (/branches/Rel6)
638
    * Branch for Release 6.0.0. Mark as unreleased version.
639
 
640
2012-04-06       ===== Released as 5.8.0 =====
641
    * Feature request #3515519 "Support object serialize/unserialize":
642
      Add __sleep() and __wakeup() magic methods to support serialize
643
      and unserialize.
644
 
645
    * phplot.php: Updated version comment and version constant
646
    * README.txt: Updated for new release
647
    * NEWS.txt: Add text for new release
648
 
649
2012-03-31
650
    * Feature request #3501500 "Looping plot section":
651
      Implemented streaming plots (motion-JPEG).
652
      + New public functions StartStream(), EndStream(), PrintImageFrame().
653
      + New protected function DisableCaching(), code from PrintImage().
654
 
655
2012-03-26
656
    * Code cleanup: Don't format tick labels unless they are on.
657
      + Pass the actual tick value, not an already-formatted label, from
658
        Draw[XY]Ticks() to Draw[XY]Tick(), so they can format it if needed.
659
      + Clean up loop in DrawXTicks(), DrawYTicks(). No functional changes.
660
 
661
2012-03-24
662
    * Feature request #3488042 "Display only some data value labels":
663
      A custom formatting callback function for Data Value Labels will now
664
      receive 2 extra arguments: the data array row and column indexes for the
665
      point. A custom formatting callback function for Axis Data Labels will
666
      now receive 1 extra argument: the data array row index. This allows
667
      selective formatting (or skipping) of labels based on their position
668
      in the data array. For example, you can skip data value labels
669
      for some data sets, and label others.
670
      + Changed usage of internal CheckDataValueLabels() to combine 4
671
        arguments into an array. This is to correspond to the new usage of
672
        DrawDataValueLabel().
673
      + In CalcMaxDataLabelSize(), when calculating the maximum axis data
674
        label size, pass the row to the formatting function.
675
      + Changed internal FormatLabel() to pass any additional arguments to a
676
        custom label formatting function.
677
      + Changed usage of internal DrawDataValueLabel(). Added arguments for
678
        row and column, and combined 6 arguments into an array (because the
679
        argument list was already too long). Pass the row and column to
680
        FormatLabel() so they are available for custom label formatting.
681
      + Changed usage of internal DrawXDataLabel(). The row argument is now
682
        required, and used for custom label formatting and data label lines.
683
        There is a new argument $do_lines to control drawing of data label
684
        lines. (Previously, one argument served both purposes.)
685
      + Changed usage of internal DrawYDataLabel(). Add a row argument to
686
        pass to FormatLabel() for use in custom label formatting.
687
      + Changed all plotting functions that call DrawXDataLabel() or
688
        DrawYDataLabel() to include the new row argument.
689
      + Changed all functions that call CheckDataValueLabels() and
690
        DrawDataValueLabel() per new usage.
691
 
692
2012-03-16
693
    * Mark as unreleased version, and change minimum requirement to PHP-5.3.
694
      (Since PHP-5.4 is released, PHP-5.2.x will no longer be tested.)
695
 
696
    * Fixed bug #3506408 "Data Label Lines vs new plot types":
697
      Bubble plots do work with data label lines. No code change.
698
      OHLC plots do not work well with data label lines, so don't draw them.
699
 
700
2012-02-25       ===== Released as 5.7.0 =====
701
    * phplot.php: Updated version comment and version constant
702
    * README.txt: Updated for new release
703
    * NEWS.txt: Add text for new release
704
 
705
2012-02-19
706
    * Feature request #3442041 "Provide data for generating image maps":
707
      Note: This is being added as an experimental feature, subject to change
708
      or removal. It will not be documented in the PHPlot Reference Manual
709
      unless and until this becomes an accepted part of PHPlot.
710
 
711
      + Added a new callback 'data_points', called after each data point is
712
        plotted (for supported plot types). It passes information to a handler
713
        which can generate an <area> tag in an HTML image map.
714
 
715
      + Changed usage of internal function DrawDot(). Added 2 arguments, $row
716
        and $column, to support the data_points callback. However, the
717
        existing $record arg was the same as $column, so it was removed.
718
            Old usage: DrawDot($x_word, $y_world, $record, $color)
719
            Now usage: DrawDot($row, $col, $x_world, $y_world, $color)
720
 
721
      + Change usage of internal function DrawBar(). Added 2 arguments, $row
722
        and $column, to support the data_points callback.
723
            Old usage: DrawBar($x1, $y1, $x2, $y2, ...)
724
            New usage: DrawBar($row, $col, $x1, $y1, $x2, $y2, ...)
725
 
726
      + Changed the logic in DrawPieChart() to accommodate the data_points
727
        callback, which needs to happen on the last (or only) pass.
728
 
729
      + Changed internal functions DrawDot(), DrawBar(), DrawPieChart(),
730
        DrawBubbles(), and DrawOHLC() to call the data_points callback,
731
        sending it the coordinates it needs for each plotted point or shape.
732
 
733
    * New file: Imagemaps.txt - documentation for new feature
734
 
735
2012-02-18
736
    * Fixed bug #3486834 "Wrong color for data value labels":
737
      Use 'text' color, not 'title' color, for data value labels.
738
      Compatibility warning: This will change the appearance of plots that
739
      use SetTitleColor or SetTextColor and data value labels.
740
 
741
      Also includes changes for feature request #3077554 "Finer control
742
      over plot element colors":
743
      Add new controls to independently set label color types.
744
 
745
      + New public function: SetDataLabelColor()
746
      + New public function: SetDataValueLabelColor()
747
      + New public function: SetTickLabelColor()
748
      + New public function: SetPieLabelColor()
749
      + Add default_color_index argument to internal GetColorIndex()
750
      + Add code to SetColorIndexes() to default the tick label color
751
        and data label color to the text color, default the data value
752
        label color to the data label color, and default the pie label
753
        color to the grid color. This is backwards-compatible, except that
754
        the data value labels used to use the title color.
755
      + Use separate color index values for ticks, axis data labels,
756
        data value labels, and pie labels. Use title color only for titles.
757
 
758
2012-02-17
759
    * Fixed bug #3488064 "Pie label failures in locales with comma decimal":
760
      This contains 2 work-arounds which together should avoid the problem.
761
      + Changed internal method number_format() to restore the previous
762
        locale settings that were in place after it gets the decimal and
763
        thousands separators. Also, use LC_NUMERIC rather than LC_ALL to
764
        limit the scope of locale loading.
765
      + Changed internal method FormatPieLabel() to avoid a number-to-string
766
        conversion if there is a single label source (the most common case).
767
        This conversion was resulting in use of a locale-specific decimal
768
        point, which PHP then fails to convert back to a number when it
769
        tries to format it.
770
 
771
2012-02-05
772
    * Feature request #3481195 "Custom message image":
773
      + New public function DrawMessage() to create an image with a message.
774
      + Changed protected function PrintError() to now use DrawMessage().
775
      + New protected function SetBgColorIndexes(), split off from
776
        SetColorIndexes() so that DrawMessage() can set just the colors it
777
        needs.
778
      + Added optional argument $overwrite to protected functions
779
        DrawBackground() and DrawImageBorder(), to force drawing even if it
780
        seems it was already done. This is needed for DrawMessage().
781
      + Moved protected function DrawError() to deprecated section.
782
 
783
2012-01-16
784
    * Added missing 'return TRUE' in SetFailureImage() and 2 internal
785
      functions. Return values are unused, but fixed to be more consistent.
786
 
787
    * Fixed bug #3396931 "Top dropshadow of stacked bars is always the
788
      same color":
789
      This is a follow-on to the fix for bug #3296884, which resulted in
790
      drawing (not skipping) segments of size 0 in stacked bar plots. A
791
      side-effect of the change was that a color 'cap' was drawn at the top of
792
      a stack if the last value in the row was 0.  This was considered to be
793
      the correct behavior at the time. But based on this new bug report, and
794
      looking at how LibreOffice handles this case, it was decided to change
795
      the way PHPlot handles this.
796
 
797
      + Changed DrawStackedBars() and DrawHorizStackedBars() to ignore
798
        segments that do not increase the stack's current size. (This is
799
        not the same as ignoring segments of size 0, because a row can have
800
        both positive and negative values. Also, if the axis was moved, an
801
        initial 0 value will be drawn from the axis to 0.)
802
 
803
        Resulting changes:
804
        + A trailing zero value in a row will no longer result in a color cap
805
          on shaded bar charts (that is, the top color of the stack would
806
          differ from the last segment color).
807
        + A row with all zero values will not be drawn at all (if the axis
808
          remains at 0).
809
 
810
2012-01-15
811
    * Mark as unreleased version.
812
    * Code cleanup: combine an assign and a test when processing data array
813
      (11 cases), and remove 5 cases of casting the data value to double.
814
      (The cast was in 4 of the plot drawing functions and FindDataLimits.
815
      The other plot drawing functions did not do this, so it was removed for
816
      consistency. Removal should have no impact, although there is an odd
817
      case (hex value in a string) where the explicit cast would not work,
818
      but the new code without casting will work.)
819
 
820
2012-01-02       ===== Released as 5.6.0 =====
821
    * phplot.php: Updated version comment and version constant
822
    * README.txt: Updated for new release
823
    * NEWS.txt: Add text for new release; new file.
824
    * NEWS_part1.txt: Moved text for prior releases from NEWS.txt
825
 
826
2012-01-01
827
    * Extend copyright years to 2012.
828
 
829
2011-12-30
830
    * Fixed bug #3403297 "Pie chart sizing and label issues":
831
      Most of the pie chart label and sizing code has been rewritten.
832
      (Note: This documents changes in the code.  See other documentation
833
      for a higher-level view and user-visible changes.)
834
 
835
      Compatibility warning: This changes the appearance of pie charts.
836
      See the NEWS file with the release for more information.
837
 
838
    + $label_format['p'] is now used for pie label formatting
839
    + Removed $plot_border_type static initialization
840
    + New public SetPieLabelType() controls pie label source and formatting
841
    + $label_scale_position = 0 or False now means no pie labels
842
    + New internal GetTextAlignment() moves code from CheckDataValueLabels()
843
    + New public SetPieAutoSize() to control use of labels in sizing pies
844
    + CalcMargins() changed to not calculate unused title sizes for pies
845
    + Added arg to  internal DrawPlotBorder(), now handles pie charts too
846
    + New internal FormatPieLabel() to format pie chart labels
847
    + New internal DrawPieLabel() to draw each pie chart label
848
    + New internal CheckPieLabels() to apply dynamic default values
849
    + Rewrote much of internal DrawPieChart() to:
850
    ++ Can suppress labels using SetLabelScalePosition
851
    ++ Fix use of label_scale_position, remove 1.2x factor
852
    ++ Use new $pie_diam_factor controls aspect ratio of shaded pies
853
    ++ Fix pie size calculation, use actual aspect ratio
854
    ++ Pre-calculate label strings to get their sizes, if needed
855
    ++ Use new $pie_full_size from SetPieAutoSize() to control autosizing
856
    ++ Pie size accounts for largest label (if labels are outside the pie)
857
    ++ Leave safe_margin between labels and pie/plot area edges
858
    + Changed DrawGraph() to:
859
    ++ Skip irrelevant data and scale calculations for pie charts
860
    ++ Call DrawPlotBorder() even for pie charts
861
 
862
2011-12-10
863
    * Comment typo fixes (found during work on upcoming change).
864
 
865
2011-11-13
866
    * Moved duplicated code from the 2 constructors into a new function.
867
 
868
2011-07-30 (lbayuk)     ===== Released as 5.5.0 =====
869
    * phplot.php: Updated version comment and version constant
870
    * README.txt: Updated for new release
871
    * NEWS.txt: Add text for new release
872
 
873
2011-07-28
874
    * Fixed problem found in testing with bubbles plot: data array
875
      with no Y,Z values at all got undefined property warnings.
876
 
877
    * Feature request #3352301 "Bubble plots":
878
      + Added new data type 'data-data-xyz', which includes a Z value
879
        for each Y.
880
      + Extended CheckDataArray(), DecodeDataType() and
881
        FindDataLimits() to understand new data type.
882
      + Added new plot type 'bubbles' for bubble plots, using data
883
        type 'data-data-xyz'. The Z value controls the bubble size.
884
      + New internal function DrawBubbles() to draw bubble plot.
885
      + New tunable parameters bubbles_min_size and bubbles_max_size.
886
 
887
2011-07-25
888
    * Feature request #3374495 "Data URL encoding":
889
      + New function EncodeImage() returns the plot image as a string,
890
        with 3 available encodings: raw, base64, and dataurl. The dataurl
891
        encoding implements RFC2397 embedding of image data in a URL,
892
        and allows a single PHP script to produce an HTML page with the
893
        plot image embedded within.
894
      + New internal function GetImageType() for code shared between
895
        PrintImage() and EncodeImage().
896
      + New function SetFailureImage() disables the normal behavior
897
        where PHPlot produces an image containing an error message in
898
        case of a fatal error. Suppressing this is necessary when using
899
        the new EncodeImage(), to avoid unexpected image data on stdout.
900
      + New member variable suppress_error_image, set by
901
        SetFailureImage(), checked by PrintError() to not make an image.
902
 
903
2011-07-22
904
    Preparing for move from CVS to Subversion.
905
    * Makefile: Remove 'tag' target. This was unused (and CVS-specific).
906
    * phplot.php: Remove reference to CVS in comment and version const.
907
 
908
2011-07-21
909
    * Fixed bug #3370548 "Reverse legend line order for stackedbars":
910
      New function SetLegendReverse(True) to draw lines in the legend
911
      in order from the bottom up, rather than top down. This is
912
      mostly intended for stackedbars and stackedarea plots.
913
 
914
2011-07-04
915
    * Code cleanup: Removed extra loop variable $cnt from plot drawing
916
      functions, where it was either unused or redundant.
917
 
918
2011-06-12
919
    * Fixed bug 3312064 "PHP errors with invalid data arrays":
920
      PHPlot now checks the data array more carefully, to reject invalid
921
      arrays and prevent PHP warning or notice errors with bad data arrays.
922
      + SetDataValues() checks the data array argument to make sure it uses
923
        0-based, sequential integer indexes, and that each element is an array.
924
      + CheckDataArray() (called early by DrawGraph()) uses the data type for
925
        more specific checking.  It makes sure each row has the right number of
926
        entries. (E.g. text-data >=1, data-data >=2, data-data-error =2+3N.)
927
      + DrawArea() ('area' and 'stackedarea' plots) returns without drawing
928
        anything if there are < 2 rows, to avoid a PHP warning from
929
        ImageFilledPolygon(). The 2-row minimum requirement is now documented.
930
      + DrawLines(), DrawLinesError(), and DrawSquared() return without
931
        drawing anything if there are no data values at all, to avoid a PHP
932
        warning from array_fill().
933
      + DrawOHLC() ('ohlc', 'candlesticks', and 'candlesticks2' plots) now
934
        checks early that there are 4 data columns, and fails if not.  This
935
        is to avoid a PHP warning when assigning line thicknesses.
936
 
937
2011-06-05
938
    * Fixed bug 3312134 "Allow missing points in OHLC plots":
939
      You can now skip points in the 3 OHLC plot types by using empty strings
940
      ('') for the 4 values in the row. All rows must still have 4 values, but
941
      if any is non-numeric the row will be skipped.
942
 
943
2011-05-27 (lbayuk)     ===== Released as 5.4.0 =====
944
    * phplot.php: Updated version comment and version constant
945
    * README.txt: Updated for new release
946
    * NEWS.txt: Add text for new release
947
 
948
2011-05-25
949
    * Added class constant PHPlot::version with the PHPlot release version.
950
 
951
2011-05-23
952
    * Fix bug 3296884 "Undefined variable with stackedbars":
953
      This is part 2 of the fix. (Part 1 fixed the undefined variable error
954
      when the first stack was all zeros, but did not fix related problems.)
955
 
956
      Changed DrawStackedBars() and DrawHorizStackedBars():
957
      + Do not ignore zero values. A leading zero value is significant if the
958
        axis is moved in the direction opposite to the stack direction.  Now
959
        PHPlot will draw a bar segment from the axis to zero in this case.
960
        Also a trailing zero value will produce a color cap on shaded bars.
961
      + Determine each stack direction before drawing it.  This is necessary
962
        to be able to draw the leading 0 segment case correctly.
963
 
964
2011-05-21
965
    * Feature request #3303654 "Force tick mark at specific value":
966
      + New functions SetXTickAnchor and SetYTickAnchor.
967
      + CalcTicks() adjusts the starting tick point so that an anchor
968
        point, if set, will coincide with a tick mark (or would, if the
969
        data range were extended).
970
 
971
2011-05-15
972
    * Feature request #3291155 "More flexible legend positioning":
973
      You can now position the legend by specifying that any point on the
974
      legend box be placed at any point on the image, plot area, or relative
975
      to the main title.  You can get the legend box size from PHPlot, and
976
      use it (for example) to adjust the plot area margins.
977
      + Added new public function SetLegendPosition() which provides
978
        much move flexible control over the legend position.
979
      + Re-implemented SetLegendPixels() and SetLegendWorld() by
980
        just having them call SetLegendPosition().
981
      + Added new public function GetLegendSize() which returns the
982
        height and width of the legend box.
983
      + New internal function GetLegendSizeParams() with code split
984
        off from DrawLegend() and used by GetLegendSize() too.
985
      + New internal function GetLegendPosition() calculates the legend
986
        position. This implements all the new position modes.
987
      + Removed internal class variables legend_x_pos, legend_y_pos,
988
        and legend_xy_world. Replaced with an array: legend_pos, which
989
        holds the legend position parameters set by SetLegendPosition().
990
 
991
2011-05-08
992
    * Merged 5.3.2 release changes. (The two entries below this, 2011-05-01
993
      and 2011-04-26, came before 5.3.2, but 5.3.2 was a single patch applied
994
      against 5.3.1 and not against current CVS.)
995
 
996
2011-05-01
997
    * Feature request #3292825 "Use point shape markers in legend box":
998
      + Implement optional use of point shapes instead of color boxes in the
999
        legend, for use with points and linepoints plots.
1000
      + Add new function SetLegendUseShapes() to enable use of point shapes
1001
        in the legend.
1002
      + New internal class variable legend_use_shapes.
1003
      + Removed optional never-used 3rd argument to SetLegendStyle().
1004
      + Add new internal function DrawShape() which now implements DrawDot()
1005
        but takes device coordinates, for use by DrawLegend().
1006
 
1007
    * Fix bug #3294604 "Center vertical alignment for legend text":
1008
      + Legend text lines are now vertically centered on the middle of
1009
        the color box or marker shape, rather than using bottom alignment.
1010
 
1011
2011-04-26
1012
    * Moved legend functions together into one section, and removed
1013
      commented-out public variable declarations for legend variables.
1014
      No functionality changes are introduced.
1015
      (This is being done in anticipation of two upcoming changes to
1016
      legend code. I dislike moving functions around because it makes it
1017
      hard to use 'diff' to check changes, but it is helpful to have
1018
      functions that work together placed together in the script. As
1019
      a compromise, do the re-arrangement in its own change.)
1020
 
1021
2011-05-06 (lbayuk)     ===== Released as 5.3.2 =====
1022
    * phplot.php: Updated version
1023
    * README.txt: Updated for new release
1024
    * NEWS.txt: Add text for new release
1025
   Note: This release was built off of the CVS branch tagged
1026
   rel5_3_1_patches, not HEAD.
1027
 
1028
2011-05-06
1029
    * For bug 3296884 "Undefined variable with stackedbars":
1030
      A temporary fix was made against phplot-5.3.1 to avoid an undefined
1031
      variable error when the first stack in a stackedbars plot has all zero
1032
      values. The fix avoids the error message, and the plots are OK in most
1033
      cases. There are still issues with label position, and if the axis
1034
      is moved. These will be addressed in a future fix.
1035
 
1036
2011-01-15 (lbayuk)     ===== Released as 5.3.1 =====
1037
    * phplot.php: Updated version
1038
    * README.txt: Updated for new release
1039
    * NEWS.txt: Add text for new release
1040
 
1041
2011-01-09
1042
    * Fixed some style / indent errors, and 1 redundant test.
1043
 
1044
2011-01-03
1045
    * For bug 3143586 "Multiple plots per image - fixes & docs":
1046
      Make sure there is a documented way to reset PHPlot feature
1047
      settings, especially those for which the default settings result
1048
      in automatic calculated values. Where possible, calling a Set*()
1049
      function with no arguments should reset the feature to defaults.
1050
 
1051
      + Changed SetLegendPixels() arguments to be optional with default
1052
        NULL meaning reset to automatic positioning.
1053
 
1054
      + Fixed SetXAxisPosition() and SetYAxisPosition() to accept empty
1055
        string '' to mean reset to default automatic positioning.
1056
        Make arguments optional, defaulting to empty string.
1057
 
1058
      + Changed SetNumXTicks() and SetNumYTicks() arguments to be
1059
        optional with default empty string '' meaning reset to
1060
        of automatic calculation.
1061
 
1062
    * Changed SetPointShapes() to use CheckOptionArray(). This
1063
      simplifies the function with no change in operation.
1064
 
1065
    * Extend copyright years to 2011.
1066
 
1067
2010-12-30
1068
    * Fix for bug 3147397 "Data colors missing with multiple plots":
1069
      + Do not truncate the data_colors and related arrays, so the full
1070
        set of colors will be available for subsequent plots on the image.
1071
        (Color indexes are still allocated in the image only as needed.)
1072
      + New internal functions GetColorIndexArray() and
1073
        GetDarkColorIndexArray(), replacing previous use of array_map().
1074
      + Removed internal function truncate_array() - no longer used.
1075
      + Changed SetColorIndexes(), NeedDataDarkColors(), and
1076
        NeedErrorBarColors() to only allocate the color indexes that will
1077
        be needed (instead of allocating all colors in the truncated color
1078
        descriptor arrays).
1079
 
1080
2010-12-28
1081
    * Instead of throwing an error, SetLegend(NULL) now clears the legend
1082
      array. This can be useful with multiple plots on an image. Before
1083
      this change, only SetLegend(array()) did that (possibly by accident).
1084
 
1085
2010-12-27
1086
    * Do not have SetDefaultStyles() call deprecated SetLabelColor().
1087
 
1088
    * Fixes for bug 3143586 "Multiple plots per image - fixes & docs":
1089
      + Fix DrawLegend so it doesn't forget that the legend position
1090
        was specified in world coordinates. This fixes the legend
1091
        position for plots after the first.
1092
      + Don't draw the image border more than once (although this would
1093
        probably have no impact on the resulting image). This parallels
1094
        the behavior for the main plot title and the image background.
1095
        Replaced member variables background_done and title_done with a new
1096
        member array done[] which will track when these elements were done.
1097
 
1098
2010-12-06
1099
    * Fix comments above CalcPlotAreaWorld(). Deleted incorrect information
1100
      from before data-data-yx existed, and before DecodeDataType rewrite.
1101
 
1102
2010-12-04 (lbayuk)     ===== Released as 5.3.0 =====
1103
    * phplot.php: Updated version
1104
    * README.txt: Updated for new release
1105
    * NEWS.txt: Add text for new release
1106
 
1107
2010-12-03
1108
    * Feature request 3127005 "Ability to suppress X/Y axis lines":
1109
      Added SetDrawXAxis() and SetDrawYAxis() to control flags which
1110
      will suppress drawing the X or Y axis lines. (These lines were
1111
      probably the only PHPlot elements that could not be turned off.)
1112
      Changed DrawXAxis() and DrawYAxis() to conditionally draw the
1113
      axis lines.
1114
 
1115
2010-11-28
1116
    * Feature request 3117873 "Data value labels in more plot types":
1117
      Implemented Data Value Labels for plot types points, lines,
1118
      linepoints, and squared.  Added 2 class variables which can be
1119
      set to control the distance and angle of the labels from points.
1120
      New internal function CheckDataValueLabels() calculates position
1121
      and text alignment for these labels.
1122
 
1123
    * Updated comments for Set[XY]DataLabelPos to match the text in
1124
      the manual, which was rewritten to clarify label types.
1125
 
1126
2010-11-23
1127
    * Code cleanup. Moved some functions around to group "plot drawing
1128
      helpers" separately from "plot drawing". No changes to operation.
1129
 
1130
2010-11-21
1131
    * Feature request 3111166 "Control legend colorbox width":
1132
      Added a class variable legend_colorbox_width which can be changed
1133
      to make the colorboxes wider or narrower.
1134
 
1135
2010-11-16
1136
    * Feature request 3093483 "Investing support chart types":
1137
      Added 3 new plot types: Basic OHLC (Open/High/Low/Close), Candlesticks,
1138
      and Filled Candlesticks. Implemented with one new function to handle the
1139
      3 new plot types: ohlc, candlesticks, and candlesticks2.
1140
 
1141
2010-11-11
1142
    * Moved information about plot types into a new static member array
1143
      plots[]. (This is an internal change with no impact on usage, but will
1144
      make it easier to add new plot types.) SetPlotType() no longer needs a
1145
      list of plot types to check, FindDataLimits() does not need to check for
1146
      specific plot types to to process the data array, and DrawGraph() uses
1147
      data from the array rather than knowing about all the plot types.
1148
 
1149
2010-10-31
1150
    * Changed internal CalcBarWidths() to take two arguments which indicate
1151
      how it should calculate bar widths, rather than having it check the
1152
      plot_type directly. (Taken from another, experimental change. This
1153
      minimizes places where plot_type is directly used.)
1154
 
1155
2010-10-03 (lbayuk)     ===== Released as 5.2.0 =====
1156
    * phplot.php: Updated version
1157
    * README.txt: Updated for new release
1158
    * NEWS.txt: Add text for new release
1159
    * Makefile: Removed HorizontalBars.txt from release. This is now all
1160
          documented in the reference manual.
1161
 
1162
2010-10-01
1163
    * Rewrite color handling. Default and specified colors are now validated,
1164
      converted to RGBA arrays, and saved. The colors indexes are not
1165
      allocated until graph drawing time. Unneeded colors are not allocated.
1166
 
1167
      Fix bug 3045131 "SetTransparentColor problems": Transparency setup is
1168
      deferred to graph drawing time, after most other colors are allocated.
1169
      Fixes SetTransparentColor order dependency, and works with data colors.
1170
 
1171
      Fix bug 3049726 "Optimize color allocation": Colors allocation is
1172
      deferred to graph drawing time, and colors for most elements are only
1173
      allocated if needed. In particular, the data colors and dark colors,
1174
      which used 32 slots, now only get defined as needed.
1175
 
1176
      Feature request (partial) 3077554 "Finer control over plot element
1177
      colors": The colors of the main, X, and Y titles can now be controlled
1178
      separately.
1179
 
1180
      Change details:
1181
      New internal functions:
1182
          GetColorIndex(), GetDarkColorIndex()
1183
              Allocate pre-parsed colors for elements.
1184
          SetColorIndexes()
1185
              Does the deferred color allocation and defaults.
1186
          NeedDataDarkColors(), NeedErrorBarColors()
1187
              Called by graph drawing functions if those colors are needed.
1188
          GetDataColor(), GetDataErrorColors(), GetBarColors()
1189
              Custom or standard data color assignment for most plot types.
1190
          truncate_array()
1191
             Shorten an array. Used to limit data color allocation.
1192
 
1193
      Removed internal functions:
1194
          SetIndexColor(), SetIndexDarkColor()
1195
              Unneeded. Color handling is now in two separate phases.
1196
 
1197
      Removed internal member variable:
1198
          data_colors_alpha
1199
              PHPlot no longer calls SetDataColors before plotting, so this
1200
              variable is not needed to preserve the default alpha.
1201
 
1202
      New internal member variables:
1203
          transparent_color
1204
              Saves color value from SetTransparentColor. For bug 3045131.
1205
          x_title_color, y_title_color, ndx_x_title_color, ndx_y_title_color
1206
              For title colors. DrawXTitle and DrawYTitle use them now.
1207
 
1208
      Changed internal member variables:
1209
          i_border, plot_bg_color, bg_color, label_color, text_color, etc.
1210
              All variables for colors now always hold a parsed 4-component
1211
              (RGBA) color specification as an array, and are no longer
1212
              statically initialized to a color name.
1213
 
1214
      New public functions:
1215
          SetXTitleColor(), SetYTitleColor()
1216
              These can be used to make the 3 titles have different colors.
1217
 
1218
2010-09-26
1219
    * Don't let SetXDataLabelPos() accept 'xaxis' or 'all' as valid.
1220
      Don't let SetXTickLabelPos(), SetYTickLabelPos() accept 'all' as valid.
1221
      These were never implemented and never documented.
1222
 
1223
 
1224
    * Feature request #3073679 "Stacked bar plots with negative values":
1225
      Allow stacked bar plots (vertical and horizontal) to work with negative
1226
      values.  Changed FindDataLimits() to not take abs() values for
1227
      stackedbar when calculating the data range.  Changed DrawStackedBars()
1228
      and DrawHorizStackedBars() to handle negative values, including proper
1229
      label positions.  The first non-zero value in a row sets the direction
1230
      of the bar. Mixing positive and negative values within a row works but
1231
      the results are not useful.
1232
 
1233
    * New internal DrawBar() moves common code from 4 bars and stackedbars
1234
      drawing functions and makes it easier to deal with shading vs bar
1235
      direction.
1236
 
1237
2010-09-24
1238
    * Fix bug 3074402 "Fix Y axis default for horizontal plots":
1239
      Make the default axis positions symmetrical for vertical plots
1240
      (X and Y) and horizontal plots (Y and X). This fixes the problem
1241
      with horizontal bar/thinbarline plots that have negative data,
1242
      where the Y axis stayed on the left and the bars went rightward.
1243
 
1244
2010-09-01
1245
    * Fix bug 3056991 "Internal methods should be 'protected'":
1246
      Changed CheckDataArray(), number_format(), FindDataLimits(), and
1247
      DrawBackground() to be 'protected'. The test suite no longer calls
1248
      these directly. For SetIndexColor(), SetRGBColor(), DrawText(),
1249
      SizeText(), xtr(), and ytr(), left these as public with a comment
1250
      indicating they should be treated as protected.
1251
 
1252
    * Fix bug 3057000 "Review 'deprecated' methods":
1253
      + Changed deprecated method SetNewPlotAreaPixels() to just call
1254
      SetPlotAreaPixels(). It was suspicious as coded, and was found
1255
      to be equivalent to SetPlotAreaPixels().
1256
      +  Removed SetColor(), which didn't do anything. It was calling
1257
      SetRGBColor and discarding the result. After reviewing the
1258
      history of this in all CVS versions, it does not seem to have
1259
      ever been coded correctly, so there is no harm in removing it.
1260
      + All other deprecated methods seem OK and are left as is.
1261
 
1262
2010-08-30 (lbayuk)     ===== Released as 5.1.3 =====
1263
    * phplot.php: Updated version
1264
    * README.txt: Updated for new release
1265
    * NEWS.txt: Add text for new release
1266
 
1267
2010-08-27
1268
    * Fix bug 3051832 "Let PHP/GD find the font file":
1269
      Instead of checking for file existence, PHPlot now uses a non-drawing GD
1270
      operation to validate a TrueType font in SetFontTTF(). This allows GD to
1271
      use its internal search path, making it likely that fonts can be found
1272
      without needing a platform-dependent path in your script.  Full paths
1273
      will still work, so there is no compatibility issue.
1274
 
1275
    * Fix bug 3051906 "Better choice for default TT font":
1276
      Removed "benjamingothic.ttf" as the default TT font setting. This has
1277
      not been included in PHPlot since 2004. Changed SetFontTTF() to call
1278
      new GetDefaultFontTTF(), which will try a number of sans-serif font
1279
      names the first time it needs a default TT font. Considering the above
1280
      fix to finding fonts, this has a good chance of finding a working
1281
      font. It is known to work on Windows and some Linux distributions.
1282
 
1283
2010-08-19
1284
    * Makefile: Removed phplot_data.php from list of files to release.
1285
      Reference bug report 3048267. This file has not been maintained or
1286
      tested, and has bugs.  It will remain in CVS, but not be included
1287
      in PHPlot releases.
1288
 
1289
2010-08-17
1290
    * Change new DrawLinePoints(). It does not have to check and
1291
      handle error bar plots, as DrawDots and DrawLines will do that.
1292
 
1293
2010-08-16
1294
    * Rewrote DecodeDataType(). Previous implementation was hard to
1295
      extend and inefficient. Now it uses new class variables (not a
1296
      returned array) and is only called once, by DrawGraph. Changed all
1297
      users of data_type to use the new variables.
1298
 
1299
      In CheckDataArray(), calculate data_columns properly for
1300
      text-data-single data type (pie chart) too. Simplify DrawPie
1301
      to use this, and merge 2 of the 3 cases.
1302
 
1303
      Have a single function handle each plot type, so it can properly
1304
      check the data type and report a correct error message showing
1305
      all supported types. For example, DrawBars is now the entry point
1306
      for both bars and horizontal bars; DrawGraph does not directly
1307
      call DrawHorizBars. Similar for DrawStackedBars and
1308
      DrawHorizStackedBars.  Lines, Points, and Linepoints also now
1309
      have a single function each, dispatching to others as needed.
1310
      (These changes were split off from an upcoming, larger change.)
1311
 
1312
2010-08-14
1313
    * Fixes to SetDataValues: need to clear out the 2 arrays before
1314
      setting values in a loop, else if the function is used more than
1315
      once then old values will remain.
1316
      Move records_per_group calculation outside the loop.
1317
      (These were split off from upcoming, larger changes.)
1318
 
1319
    * Part 4 of horizontal plots: implement horizontal thinbarline plots.
1320
      Added new data type 'data-data-yx' (label, Y, X1, X2, ...).
1321
      DrawThinBarLines() now draws either vertical or horizontal plots, and
1322
      supports data types text-data, data-data, text-data-yx, data-data-yx.
1323
 
1324
      Fixed DecodeDataType() to handle text-data-single too, for completeness.
1325
 
1326
    * Fix for over-padding style and color arrays. These were padded to
1327
      records_per_group, but that is the maximum data array row size.
1328
      The number of actual data sets is less, and depends on the data type.
1329
      Calculate the correct number as data_columns at the top of DrawGraph,
1330
      and use that to pad the arrays. Also moved early error checking in
1331
      DrawGraph() into new CheckDataArray().
1332
 
1333
2010-08-09
1334
    * Code cleanup. This is a large change to unify the comment and
1335
      coding stye used in PHPlot. The PEAR style guide is being used
1336
      as a reference, but PHPlot will never be 100% compliant.
1337
      This patch introduces no functional changes at all.
1338
        - Limit line length to 110.
1339
        - Remove obsolete, partially implemented Doxygen comments.
1340
        - Add descriptive comment above functions where missing.
1341
        - Use consistent comment markers and control structure spacing.
1342
        - Remove ctags-confusing end of function comments.
1343
        - Rewrote a few if/else blocks for cleaner logic.
1344
        - Re-order some functions for consistency (X, then Y).
1345
 
1346
2010-08-04
1347
    * Implemented horizontal stacked bar plots:
1348
      Use the same data type introduced for horizontal bars, 'text-data-yx',
1349
      and the same plot type 'stackedbars', to make a horizontal stacked bar
1350
      plot.  Data value labels, both at the ends of the bars and within the
1351
      bars ('plotstack' labels) are available with horizontal stacked bars.
1352
 
1353
    * Internal function DrawDataLabel() is replaced by DrawDataValueLabel(),
1354
      with different usage. The new function can also check to see if a label
1355
      fits in the allocated space.
1356
 
1357
    * Fixed the text size check in stacked bar plots for data value labels
1358
      within the bars. The check only worked correctly for 0 degree labels. It
1359
      now works with any text angle. It suppresses the label if it is too high
1360
      (for vertical stacked bar plots) or too wide (for horizontal stacked bar
1361
      plots) to fit in the bar segment to which it belongs. Note that it only
1362
      checks in the bar direction. If the text is too wide (for vertical bars),
1363
      or too high (for horizontal bars), it will still be plotted, but will
1364
      cross the sides of the bar.
1365
 
1366
2010-07-28
1367
    * Allow callbacks to return a value (to support new data_color callback).
1368
    * Feature request 3034164 "Extended control of data colors":
1369
      Define new callback 'data_color' for picking the data color.
1370
      Changed internal plot drawing functions DrawDots, DrawLines, DrawSquared,
1371
      DrawBars, DrawStackedBars, DrawDotsError, DrawThinBarLines,
1372
      DrawLinesError, and DrawHorizBars to use the data_color callback
1373
      (if defined) to select the data colors.
1374
    * SetRGBArray code cleanup (no functional changes).
1375
 
1376
2010-07-27
1377
    * Fixes for error bars:
1378
      Code cleanup in DrawYErrorBar(), with no functional change.
1379
      Suppress duplicate drawing of error bars with 'linepoints' error plots.
1380
      This was already fixed for data labels. Now error bars will only be
1381
      drawn by the 'points' part, not the 'lines' part. There should be no
1382
      visible changes to plots. (This is needed for a future change).
1383
 
1384
2010-07-26
1385
    * Horizontal bar charts (still an experimental feature) can now have data
1386
      value labels.
1387
    * HorizontalBars.txt: Fix incorrect description of bar direction. Add
1388
      text explaining the new data value labels.
1389
 
1390
2010-06-29 (lbayuk)     ===== Released as 5.1.2 =====
1391
    * phplot.php: Updated version
1392
    * README.txt: Updated for new release
1393
    * NEWS.txt: Add text for new release
1394
 
1395
2010-06-26
1396
   * Feature request 2885930 "Horizontal Bars":
1397
     Horizontal bar charts are implemented, as an experimental feature.
1398
     A new data type 'text-data-yx' was added, which works with
1399
     'bars' plot type to produce a horizontal bar chart from a data
1400
     array with X values for each Y value. Changes were made to
1401
     FindDataLimits, CalcMargins, CalcPlotAreaWorld, CalcBarWidths,
1402
     and CalcMaxDataLabelSize to handle the new data type. Other
1403
     changes were made to handle label position defaults and grid
1404
     defaults. New drawing functions were added for horizontal bars.
1405
 
1406
   * HorizontalBars.txt: new documentation file for experimental feature.
1407
   * Makefile: List new documentation file.
1408
 
1409
2010-06-25
1410
   * Each plot-type drawing function now checks that it is getting a data
1411
     type that it knows how to handle. A new internal function unifies the
1412
     checking and error message. (This is associated with an upcoming,
1413
     bigger change.)
1414
 
1415
     Compatibility: If you were using an invalid data type for a plot type
1416
     whose function did not check, will now get an error.
1417
 
1418
   * Removed some dubious code from DrawLines() and DrawSquared() and
1419
     rewrote comments there. The code initialized lastx[0] and lasty[0],
1420
     but lasty was mapped using the X (rather than Y) function.  This was
1421
     obviously wrong, but closer inspection showed that the values were
1422
     never, used so the code was removed.
1423
 
1424
2010-06-13
1425
   * Truecolor.txt: removed
1426
   * Makefile, README.txt: Removed reference to Truecolor.txt. Full
1427
     documentation for truecolor images is now in the Reference Manual.
1428
 
1429
2010-06-02
1430
   * Fix bug 3010116 "Bad rendering of title in multi-plot image
1431
     when using TTF":
1432
     Make sure the main title is drawn only once. (If drawn multiple
1433
     times with TrueType font text, the anti-aliasing effects result
1434
     in poor quality text.)
1435
 
1436
2010-05-31
1437
   * Improvements to truecolor support (from feature request 2947679):
1438
     Truecolor support is now better integrated. The derived class only
1439
     has the constructor now, and the base class itself provides the alpha
1440
     color component support through the internal functions SetIndexColor(),
1441
     SetIndexDarkColor(), and SetRGBColor(). This means alpha channel
1442
     works with palette images too (in so far as GD supports this).
1443
 
1444
   * Truecolor.txt: Updated per changes to truecolor support.
1445
 
1446
   * Image tiling with mode 'scale' in tile_img(), used with image and
1447
     plot area backgrounds, now uses imagecopyresampled() rather than
1448
     imagecopyresized(). They are the same with palette images, but the
1449
     resampled copy gets better results with truecolor images.
1450
 
1451
2010-05-29
1452
    * Feature request 3002606 "Add to plot and image border options":
1453
        Added options 'right', 'top', and 'bottom' to SetPlotBorderType()
1454
      (existing options are 'left', 'sides', 'none', and 'full'). This
1455
      now also accepts an array of the above options, giving complete
1456
      control over which sides to draw.
1457
        Added option 'solid' to SetImageBorderType() to use the actual
1458
      color set with SetImageBorderColor(), rather than the darker
1459
      shade as type 'plain' does (for some reason).
1460
        New function SetImageBorderWidth() sets the width of the image
1461
      border. The image border width is now accounted for in margin
1462
      calculations, although existing plots will not change.
1463
 
1464
2010-04-04 (lbayuk)     ===== Released as 5.1.1 =====
1465
    * phplot.php: Updated version
1466
    * README.txt: Updated for new release
1467
    * NEWS.txt: Add text for new release
1468
 
1469
2010-04-01
1470
    * Remove & from argument in SetDataValues(). The data array is not
1471
      modified and does not need to be passed by reference. (There is
1472
      no performance advantage, either.)
1473
 
1474
2010-03-29
1475
    * Feature request 2947679 "Support for alpha blending/Truecolor":
1476
      Implemented truecolor image support with a new class
1477
      PHPlot_truecolor, extended color specifications to allow
1478
      specification of an alpha value, and added a new optional parameter
1479
      to SetDataColors for a default alpha value for all data colors.
1480
      This feature is *EXPERIMENTAL* (see next item).
1481
 
1482
    * Truecolor.txt: New file, documentation for the new truecolor capability.
1483
      (The Truecolor feature is experimental, which means it is subject to
1484
      change in incompatible ways and the documentation has not yet been
1485
      incorporated into the PHPlot Reference Manual.)
1486
 
1487
    * Makefile: Include new documentation file in release.
1488
 
1489
2010-03-26
1490
    Fixed bug 2976735 "Improvements and fixes for 'area' plots":
1491
    Rewrote DrawArea() function which handles 'area' plot.
1492
        Part 1: This is related to feature request 2947679, Truecolor support
1493
    with transparency. The area plot function was filling each area from the X
1494
    axis up to the Y value, resulting in area overlaps. This wasn't a problem
1495
    with opaque colors, but with transparency, the overlapping areas resulted
1496
    in changed colors. The rewritten function fills the area between each line
1497
    instead of from each line down to the X axis. Plots with opaque colors
1498
    will not change.
1499
        Part 2: Area plots now work when the X axis is moved up with
1500
    SetXAxisPosition().
1501
        Part 3: Fixed FindDataLimits() for area (and stackedbars too) to
1502
    take absolute values of Y values. The drawing function was doing this,
1503
    but not FindDataLimits, resulting in incorrect limits if any Y<0.
1504
        Part 4: The rewritten DrawArea() also handles a new plot type
1505
    'stackedarea'.  This is an area plot where the Y values are stacked,
1506
    similar to 'stackedbars'.
1507
        Note: As part of the changes, it is now an error to try an area plot
1508
    with an unequal number of Y points for each X.
1509
 
1510
2010-03-23
1511
    * Feature request 2973995 "Add y-Data to Stackedbars":
1512
      Implemented Y Data Labels for Stacked Bar charts (stackedbars).
1513
      The labels are enabled with SetYDataLabelPos, same as with bar charts.
1514
      There are two types of labels: above the stack with the total, and
1515
      within the bars at each segment. 'plotin' turns on the upper ones, and
1516
      'plotstack' turns both on.
1517
 
1518
    * Other changes:
1519
      + Removed unimplemented second argument to SetYDataLabelPos.
1520
      + Fixed questionable logic in SetYDataLabelPos when given an argument
1521
        that belongs with SetYTickLabelPos.
1522
      + Fix comments at top of plot-type Draw functions.
1523
 
1524
    * Fix for bug 2974639 "Stacked bars plot breaks with X axis != 0":
1525
      Stacked bar plots with non-zero X axis position no longer break apart
1526
      into segments with gaps. The bars are drawn up from the X axis, and
1527
      any segments or partial segments below the X axis are not drawn.
1528
 
1529
2010-03-22
1530
    * Change related to feature request 2947679 - Fix 'dot' point shape:
1531
      Use imagefilledellipse(), not imagefilledarc(), when drawing the 'dot'
1532
      point shape. The fix was needed for future support of truecolor images
1533
      with transparency, but filled dots from imagefilledellipse() look
1534
      better (rounder) with regular images and opaque colors.
1535
      Credit to mvaldez for identifying the problem and providing the fix.
1536
 
1537
2010-03-04
1538
    * Fix for bug 2963757 "point_counts undefined error in 5.1.0":
1539
      Fixed CheckPointParams so it sets point_counts even when the point shape
1540
      and point size arrays are already the same size and do not need padding.
1541
 
1542
2010-01-26
1543
    * Fix for bug 2938219 "Bars go in wrong direction":
1544
      Fixed CalcAxisPositions() to be consistent in positioning the X axis.
1545
      When all Y values are <0 and the Y=0 line is not part of the plot range,
1546
      PHPlot will now default the X axis to the top of the plot, not the
1547
      bottom.  This fixes the problem with bars to negative Y values being
1548
      drawn downward if Y=0 is visible, but upward if Y=0 is not visible.
1549
      This also affects thinbarline plots.
1550
      Credit to lauryn1298 for finding the bug.
1551
 
1552
2009-12-24 (lbayuk)     ===== Released as 5.1.0 =====
1553
 
1554
2009-12-18
1555
    * Change for bug 1795971 "Fix default data colors":
1556
      The default Data Color and Error Bar Color arrays now have 16
1557
      different colors, no duplicates, and nothing so light that it
1558
      is invisible.
1559
      Using '' or False as the argument to SetDataColors, SetErrorBarColors,
1560
      and SetDataBorderColors now re-initializes the map to the defaults.
1561
      This was previously undocumented, and in some cases set the map to
1562
      something different from the default.
1563
 
1564
2009-12-15
1565
    * Cleanup: Remove DrawAxisLegend() - empty function marked TODO,
1566
      not really clear what it was meant to do.
1567
 
1568
2009-12-14
1569
    * Fix for bug 2914403 "Pie + X/Y titles: Undefined property error":
1570
      In DrawGraph(), don't try to draw X or Y titles for pie charts.
1571
 
1572
    * Feature request 2899921: "allow different format for data and tick
1573
      labels"; Bug 2906436: "Fixes for X Tick Labels vs X Data Labels",
1574
      and partial implementation of changes from user 'adoll' regarding
1575
      tick vs data labels:
1576
 
1577
      New public functions:
1578
      + SetXDataLabelType() : Sets formatting for X Data Labels
1579
      + SetYDataLabelType() : Sets formatting for Y Data Labels (bar charts)
1580
      + SetXDataLabelAngle() : Sets text angle for X Data Labels
1581
      + SetYDataLabelAngle() : Sets text angle for Y Data Label (bar charts)
1582
      The defaults for these are set up to be fully backward compatible
1583
      with previous releases of PHPlot (except see the next item).
1584
 
1585
      Re-used function name SetXDataLabelAngle():
1586
      + This has been deprecated and undocumented since 2003-12-07, and
1587
        used to just call SetXLabelAngle(). For new behavior, see above.
1588
 
1589
      Changes to public functions:
1590
      + SetXDataLabelPos() and SetXTickLabelPos() no longer cancel each
1591
        other out (set the other control variable to 'none'). Instead,
1592
        they are both considered before plot drawing.
1593
 
1594
      Changes to internal functions:
1595
      + DrawDataLabel() now uses the font, angle, and color arguments as
1596
        provided, and does not substitute values if they are empty.
1597
      + SetLabelType() now takes mode='xd' and 'yd' for X Data and Y Data
1598
        label formatting; 'x' and 'y' are for tick labels only now.
1599
      + Functions that work on Data labels now call FormatLabel() with the
1600
        new mode parameter value 'xd' or 'yd, and use the new
1601
        data_label_angle variables.
1602
      + New CheckLabels(), used by DrawGraph to process label parameters.
1603
      + CalcMargins() - Rewritten to handle changes to Tick and Data labels.
1604
 
1605
      Changes to internal class variables:
1606
      + New: x_data_label_angle, y_data_label_angle
1607
      + Do not initialize x_tick_label_pos or x_data_label_pos, so that
1608
        CheckLabels() can tell if they were set or not and apply defaults.
1609
      + Initialize y_data_label_pos to 'none', not 'plotleft'.
1610
      + Add 2 more indexes to label_format[] array: 'xd' and 'yd'.
1611
 
1612
    * Cleanup:
1613
      + Delete unused internal class variable: draw_y_data_label_lines
1614
      + Delete unused function SetDrawYDataLabelLines()
1615
 
1616
2009-12-07
1617
    * Fix bug 1795972 "Fix default point shapes":
1618
      +  Added 10 new point shapes to the existing 10 shapes.
1619
      +  Changed the default point shape from all 'diamond' to a
1620
         selection of up to 10 different shapes.
1621
      +  Fixed bug in the code that tried to set the point shapes
1622
         and sizes arrays to be the same size. This was not working,
1623
         resulting in unexpected point sizes.
1624
      +  Changed default point size to 6 for all shapes. It was trying
1625
         to be "5, 5, 3" but due to several bugs this was not working.
1626
      +  Do not adjust shape sizes to even numbers (was done for only two
1627
         shapes).  Instead, consistently truncate size/2 when needed.
1628
      NOTE: These may change the look of 'points' and 'linepoints' plots.
1629
 
1630
    * Changed startup initialization code:
1631
      +  SetDefaultStyles() was doing some odd things using a variable
1632
         called "session_set", with comments referring to non-existent
1633
         session support code. This has been removed. There should be
1634
         no visible changes from this. PHPlot does not use PHP sessions.
1635
 
1636
2009-12-04
1637
    * Fix for bug 2908256, errors in pie charts with bad data array:
1638
      (From a Drupal contrib module report by thekevinday.)
1639
      With pie charts only, a data array with no valid Y values resulted
1640
      in PHP error messages. All other plot types handle this by producing
1641
      an image without a graph.
1642
      Fixed DrawPieChart to behave this way too. If there are no valid Y
1643
      values, or if the sum of all Y values is 0, do not error out, but
1644
      don't draw a pie chart either.
1645
      Also, pie charts now ignore non-numeric Y values, like other plot types.
1646
 
1647
2009-11-20 (lbayuk)
1648
    * Fix for bug 2900914 "Problem with display of 0 on Y axis":
1649
      Changed how X and Y values are stepped by tick intervals, to avoid
1650
      cumulative round-off error. This fixes the problem when Y crosses 0 with
1651
      a tick step such as 0.1 resulting in a long label for a very small but
1652
      non-zero number. Fixed DrawXTicks, DrawYTicks, and CalcMaxTickLabelSize.
1653
      (Originally reported by cncnet)
1654
 
1655
2009-11-19 (lbayuk)
1656
    * Improve support for using callbacks to annotate plots:
1657
      Added new callback 'draw_all', called after all drawing.
1658
      Supply plot_area[] as argument to some drawing callbacks.
1659
      Added new method GetDeviceXY() to translate from world coordinates.
1660
      Allow NULL or '' for $font in DrawText() internal method, meaning to
1661
          use the generic font. If callbacks want to use DrawText, this
1662
          avoids them having to reference the internal fonts[] array.
1663
 
1664
2009-11-01 (lbayuk)
1665
    * Address bug report 2886365 "Declare all functions and variables in
1666
      PHP5 style"
1667
      PHP5 deprecates the use of 'var' to declare a class member variable.
1668
      All initialized class member variables are now declared 'public'.
1669
      (It was tempting to make most or all 'protected' or 'private', but
1670
      that would likely break too much, including the PHPlot Test Suite.)
1671
 
1672
      Most class member functions which are meant for internal use only are
1673
      now declared 'protected', so they cannot be called from scripts
1674
      (except in child classes). (Note PHP5 does not deprecate the use of
1675
      just 'function' to mean public, so public functions were not changed.)
1676
      Internal functions are those documented in the manual under Developer's
1677
      Guide, Internal Functions. If your code breaks because you are using
1678
      a method which is now protected, please post the details on the help
1679
      forum.
1680
 
1681
      Some member variables which were set in the constructor are now
1682
      initialized with the class instead. (No impact.)
1683
 
1684
      Removed commented-out, FIXME-noted code for interim labels.
1685
 
1686
2009-10-12 (lbayuk)
1687
    * Bug report 2839547, allow SetImageBorderType('none') to reset the image
1688
      border type.  Also checked for other cases where there is no reset;
1689
      found one that exists (Set[XY]LabelType) but needs to be documented.
1690
 
1691
2009-07-09 (lbayuk)
1692
    * Added a hook $plot->locale_override which can be set to True to prevent
1693
      PHPlot from loading locale settings from the environment with
1694
      setlocale(LC_ALL, ''). This is necessary for testing PHPlot on Windows,
1695
      where you cannot force a locale with an environment variable. It might
1696
      also be needed for people who want PHPlot's locale to differ from the
1697
      web server's locale.
1698
 
1699
2009-06-12 (lbayuk)     ===== Released as 5.0.7 =====
1700
 
1701
2009-06-11 (lbayuk)
1702
    * Change PHPlot license to LGPL, per Afan.
1703
        phplot.php, phplot_data.php - Change license notice.
1704
        rgb.inc.php - Change top comments and remove bottom marker.
1705
        COPYING - new file, text of LGPL.
1706
        LICENSE.* - removed files - old licenses.
1707
        Makefile - change list of distributed files.
1708
 
1709
    * Fix for bug 2803900: SetRGBArray('large') does not work. The include
1710
      file defined a different array name than the main script expected.
1711
      (This bug seems to have happened over 8 years ago.) Fixed the array
1712
      names to match. Also removed the ./ prefix from the included filename
1713
      so it will be found if on the include path but not in the script
1714
      directory.  Also added error check if the rgb.inc.php include file
1715
      is needed and not found.
1716
 
1717
2009-05-25 (lbayuk)
1718
    * Added new feature to allow partial margin or plot area specification.
1719
      You can omit, or specify as NULL, any of the 4 arguments to
1720
      SetMarginsPixels() or SetPlotAreaPixels(), and this means PHPlot
1721
      should use the automatically calculated margin on that side.
1722
      Credit to adoll for this feature.
1723
 
1724
2009-05-17 (lbayuk)
1725
    * Fix for bug 2791502 "Error plots treat missing Y values as 0":
1726
      Plots with data type data-data-error now support missing Y values,
1727
      instead of treating them as 0. This works with lines, points,
1728
      and linepoints plot types, and also honors SetDrawBrokenLines.
1729
 
1730
 
1731
    * Fix for bug 2792860 "Wrong DataLabelLines with missing Y":
1732
      Do not draw X Data Label Lines at points with missing Y values.
1733
 
1734
 
1735
    * Fix for bug 2786350 "Missing Y data results in bad auto-range":
1736
      Rewrote FindDataLimits to ignore missing Y values, rather than
1737
      treating them as if 0, for calculating range.
1738
      Bug report and analysis by mrten.
1739
 
1740
    * Fix for bug 2786354 "Incorrect auto-range for data-data-error":
1741
      For data-data-error data type, apply the positive and negative error
1742
      amounts for each Y point to that point only, rather than applying the
1743
      largest errors to the overall minimum and maximum Y value for the row.
1744
 
1745
    Note: The two fixes above can change existing plots which rely on
1746
      automatic Y range calculation. The first fix affects plots with
1747
      missing Y values and min(Y)>0. The second fix can affect plots using
1748
      data-data-error data type and different error values for different
1749
      points. In both cases the new Y range can be smaller than before.
1750
 
1751
2009-01-20 (lbayuk)     ===== Released as 5.0.6 =====
1752
 
1753
2009-01-18 (lbayuk)
1754
    * Fix for bug 1891636 "Misaligned TTF X Labels":
1755
	  PHPlot was using the actual bounding box of each line of text
1756
      to allocate space and set the text positioning, but was ignoring the
1757
      fact that the text baseline is not the same as the bottom of the
1758
      bounding box. This resulted in uneven alignment of the X labels if
1759
      they had different heights (for example, month names Jul and Aug).
1760
 
1761
      PHPlot now calculates the size of text for allocation (SizeText) using
1762
      the descenders on the last line, and calculates the size for drawing
1763
      (DrawText) only to the baseline. PHPlot also now uses a fixed line
1764
      spacing for each line of text in a font, rather than the actual text
1765
      height. This allows separately drawn multi-line labels to align.
1766
 
1767
    * Changes to line spacing when using multi-line labels:
1768
	  PHPlot was using the class variable line_spacing to mean the
1769
      number of pixels between lines of multi-line labels. This made the
1770
      spacing too small for larger fonts, and it was not possible to adjust
1771
      line spacing for different types of text.
1772
 
1773
	  PHPlot now interprets line_spacing as the number of pixels only
1774
      for GD text, and as a scale factor for the font's built-in line
1775
      spacing for TrueType text. In addition, a new optional argument is
1776
      added to SetFont, SetFontGD, and SetFontTTF to set a line spacing
1777
      specific to that type of text.
1778
 
1779
    * Changes had to be made to the legend drawing code to accommodate the
1780
      changes to font handling.
1781
 
1782
      Note: The line spacing change results in slightly looser spacing on
1783
      multi-line TrueType text labels, and slightly taller legends, compared
1784
      to version 5.0.5.
1785
 
1786
2008-09-21 (lbayuk)
1787
    * Interim fix for bug 1932571 "Data-Data Plot fails with same X values".
1788
      PHPlot will no longer hang when the range of X values is 0 (that is, when
1789
      x_min == x_max). It will arbitrarily set an X range of 1, so the
1790
      calculated tick step is not 0. This is a temporary fix. Work on a smarter
1791
      X and Y range calculation is in progress, which will handle edge cases
1792
      like this better, but it isn't ready and this bug has been open too long.
1793
      Credit to andyl for finding the bug.
1794
 
1795
    * Fix font path: Use DIRECTORY_SEPARATOR constant not '/'.
1796
 
1797
    Extended the label formatting capabilities, adding 'printf' and 'custom'
1798
    types, added a prefix and suffix for 'data' type, and allow format controls
1799
    to be included in SetXLabelType and SetYLabelType.
1800
 
1801
    External changes:
1802
    * Added 'printf' label type. The caller specifies the print format as the
1803
      2nd argument to SetXLabelType or SetYLabelType (default '%e').
1804
             $plot->SetXLabelType('printf', '%5.2f');
1805
 
1806
    * Added 'custom' label type. The caller supplies a callback (typically a
1807
      function name) and optional pass-through argument as the 2nd and 3rd
1808
      arguments to Set[XY]LabelType.  The function is called as $f($value, $arg)
1809
      to return the formatted $value.
1810
             $plot->SetXLabelType('custom', 'myfunction', $arg_value);
1811
 
1812
    * In addition to Set[XY]TimeFormat, the format string for type 'time' can
1813
      now be set as the 2nd argument to Set[XY]LabelType.
1814
             $plot->SetXLabelType('time', '%H:%M');
1815
 
1816
    * In addition to SetPrecision[XY], the precision for type 'data' can now be
1817
      set as the 2nd argument to Set[XY]LabelType. A 3rd and 4th argument
1818
      can supply a prefix and suffix for 'data' formatting. (All optional)
1819
             $plot->SetXLabelType('data', 2, '$', 'US');
1820
 
1821
    Internal changes:
1822
    * Class variables x_precision, y_precision, x_label_type, y_label_type,
1823
      x_time_format, and y_time_format have been removed.
1824
 
1825
    * New class array variable label_format[], with elements 'x' and 'y' which
1826
      are arrays for label formatting. Elements in the sub-arrays are not
1827
      initialized until needed.
1828
 
1829
    * New function SetLabelType, which implements Set[XY]LabelType now.
1830
 
1831
    * FormatLabel() was rewritten to support the new label formatting.
1832
 
1833
    Compatibility:
1834
    * Any code that directly references class variables related to label
1835
      formatting will break, except for data_units_text. Use the documented
1836
      function methods instead.  Setting data_units_text as a suffix is
1837
      deprecated but still works.
1838
 
1839
    * The 'data' type precision for 'Y' is still used for pie chart labels.
1840
 
1841
2008-07-12 (lbayuk)
1842
    Multiple comment spelling error fixes. No functional changes.
1843
 
1844
2008-07-06 (lbayuk)
1845
    Changes to allow mixing GD fixed-font text and TrueType Font (TTF) text
1846
    on the same plot.
1847
    (This change came from work done trying to fix TTF text positioning,
1848
    where it looks like additional information needs to be stored for TrueType
1849
    fonts. The old font data structure was awkward to extend, and allowing
1850
    mixed GD/TTF text was on the to-do list anyway.)
1851
 
1852
    External changes:
1853
    * SetFontGD(), SetFontTTF(): New functions to set a font, with type.
1854
    * SetFont(): Now calls SetFontGD or SetFontTTF depending on $use_ttf.
1855
    These changes should be fully compatible with existing programs.
1856
 
1857
    Internal changes:
1858
    * Updated comments explaining SetUseTTF() now sets the default type
1859
      (not the only type) of text used.
1860
    * Put all the font data into a class array. (Replaces $this->generic_font
1861
      with $this->fonts['generic'], etc.)
1862
    * ProcessTextGD() and ProcessTextTTF() now take the font array as one
1863
      argument, rather than separate arguments for font path and size.
1864
 
1865
2008-01-13 (lbayuk)     ===== Released as 5.0.5 =====
1866
    * phplot.php: Updated version
1867
    * README.txt: Updated for new release
1868
    * NEWS.txt: Add text for new release
1869
    * Makefile: Remove 'Callbacks' from release target, as this material is
1870
      now in the reference manual.
1871
 
1872
2008-01-07 (lbayuk)
1873
    Copyright updated to 2008 and PHP4 no longer listed as supported.
1874
 
1875
    Major rewrite of the margin calculation functions to address multiple
1876
    problems.  Fixes for bugs 1856207 "Margin error with 'xaxis'/'yaxis'
1877
    position, 1843012 "Make margins, drawing consistent", and 945439
1878
    "x_tick_label_height not set correctly".
1879
 
1880
    Note: These changes are inter-dependent and cannot be split up.
1881
 
1882
    * Defer all calculations to DrawGraph time, to eliminate order dependencies.
1883
      These functions now just store their arguments in the object, and all
1884
      calculations happen later:
1885
    + SetXAxisPosition, SetYAxisPosition
1886
    + SetMarginsPixels
1887
    + SetPlotAreaPixels (Stores margins, not area, now.)
1888
    + SetPlotAreaWorld
1889
    + SetXTickIncrement, SetYTickIncrement
1890
 
1891
    * A new callback 'debug_scale' was added to trace the margin and scale
1892
      calculations.
1893
 
1894
    * CalcMargins was rewritten. Actual sizes of tick and data labels are now
1895
      used, rather than guesses like "use size of biggest Y value". A minimum
1896
      value (3 x safe_margin, or 15 pixels) applies to each margin.
1897
 
1898
    * FindDataLimits no longer needs to find the longest data label, since
1899
      CalcMargins now does that more precisely.
1900
 
1901
    * DrawXTitle and DrawYTitle now use position offsets calculated by
1902
      CalcMargins. Note: These titles are now offset from the plot area,
1903
      not the image area. The titles will move if you had set the plot area
1904
      or margins.
1905
 
1906
    * DrawYTick, DrawXTick rewritten to use pre-calculated offsets, and common
1907
      code moved to new CalcTicks().
1908
 
1909
    * DrawXDataLabel: Use pre-calculated offsets for text.
1910
 
1911
    * DrawGraph: Rewrote top section (before drawing anything) to do the
1912
      calculations in the proper order, unconditionally.
1913
 
1914
    * Class variables removed:
1915
      x_label_inc, y_label_inc, _x_label_cnt : These were never used.
1916
      title_height, x_title_height, y_title_width : Now internal to CalcMargins.
1917
      data_limits_done : No more need to remember if FindDataLimits called.
1918
 
1919
    * New class variables added:
1920
      plot_margins_set : Keeps track of user-set plot area or automatic.
1921
      x_label_top_offset, x_label_bot_offset, x_offset_axis_offset,
1922
          y_label_left_offset, y_label_right_offset, y_label_axis_offset,
1923
          x_title_top_offset, x_title_bot_offset,
1924
          y_title_left_offset, y_title_left_offset : Label offsets
1925
 
1926
    * New internal functions:
1927
      CalcPlotAreaPixels : Deferred calculations taken out of SetPlotAreaPixels
1928
        and SetMarginsPixels.
1929
      CalcPlotAreaWorld : Deferred calculations taken out of SetPlotAreaWorld.
1930
      CalcAxisPositions : Calculate axis positions, moved from CalcTranslation.
1931
      CalcTicks : Calculate X and Y tick interval. This still uses the
1932
        same simple method (basically range/10), but now we could drop in a new
1933
        algorithm much more easily. This is now also used by CalcMargins.
1934
        Code taken out of DrawXTicks and DrawYTicks.
1935
      CalcMaxTickLabelSize : So CalcMargins can use the exact tick label sizes.
1936
      CalcMaxDataLabelSize : So CalcMargins can use the exact data label sizes.
1937
      DrawXTick : Code split out from DrawXTicks for symmetry with DrawYTick.
1938
 
1939
 
1940
2007-12-13 (lbayuk)
1941
    * Changed ProcessTextTTF() so SizeText() will return integers. It rounds
1942
      the calculated values up, so the bounding box really contains the text.
1943
      This also prevents unneeded float calculations in derived values.
1944
 
1945
2007-12-09 (lbayuk)
1946
    Major rewrite of the text drawing functions to address multiple problems.
1947
    Note: These changes are inter-dependent and cannot be split up.
1948
 
1949
    * Fixed bug 1813070 "Bad position for multi-line TrueType text":
1950
      TTF text is now drawn line-by-line, not as a block, for proper
1951
      alignment and positioning.
1952
 
1953
    * Fixed bug 1813071 "Wrong title height for multi-line TTF text":
1954
      Corrected miscalculation of overall height of multi-line TTF titles.
1955
      This bug resulted in over-sized margins.
1956
      The height is now computed line-by-line, including the inter-line spacing.
1957
 
1958
    * Fixed bug 1813474 "DrawText alignment arguments wrong":
1959
      Corrected meaning of 'top' vs 'bottom' alignment. PHPlot now follows
1960
      the usual conventions: 'top' alignment means top of text to reference.
1961
      DrawText default for vertical alignment is still 'bottom', but the
1962
      meaning was corrected.  All callers of DrawText were fixed.
1963
 
1964
    * Fixed bug 1816844 "Fix order dependency for setting titles":
1965
      Defer processing titles strings until DrawGraph(), so there is no
1966
      more order dependency (no need to set font before setting title strings).
1967
 
1968
    * Fixed bug 1819668 "Horiz. align multi-line text: GD vs TTF":
1969
      The new text routines draw TTF text line-by-line and correctly do
1970
      right-, center-, and left- alignment of each line within a text block.
1971
 
1972
    * Fixed bug 1826513 "FIXME in DrawLegend: Max label length":
1973
      Use actual width of widest legend line to calculate legend box size.
1974
 
1975
    * Partial fix for bug 945439 "x_tick_label_height not set correctly":
1976
      In FindDataLimits(), save the longest data label, not just its length,
1977
      and use the actual rendered size of that string in CalcMargins() for
1978
      the margin calculations.
1979
      Also take into account which of the tick or data labels are visible.
1980
      This is not a complete fix, but is a significant improvement.
1981
 
1982
    The following changes were made related to the above fixes:
1983
 
1984
    + Replaced internal function TTFBBoxSize(), which didn't work right, with
1985
      SizeText(). It returns the orthogonal bounding box of a block of text,
1986
      and works with both GD and TTF text.
1987
 
1988
    + DrawText() and SizeText() call a single function ProcessText(), which is
1989
      the only place GD text and TTF text are distinguished. (So eventually
1990
      we will be able to mix GD and TTF text on a plot.)
1991
 
1992
    + New internal functions ProcessTextGD() and ProcessTextTTF() draw (or size)
1993
      GD and TTF text respectively. These are only called by ProcessText().
1994
      These are re-implementations which properly position and align text.
1995
 
1996
    + Removed class variables title_angle, x_title_angle, and y_title_angle. The
1997
      titles only work at their fixed angles anyway (0, 0, and 90 respectively).
1998
 
1999
    + Line spacing set with SetLineSpacing() now affects TTF text as well as
2000
      GD text. Previously, it only affected GD text. The default line spacing
2001
      happens to be usable for TTF text.
2002
 
2003
    + Added new callback hook 'debug_textbox' for developing, testing, and
2004
      documenting. It provides access to the text area bounding box.
2005
 
2006
    + Removed unneeded class variables x_tick_label_height, y_tick_label_width,
2007
      x_tot_margin, y_tot_margin.
2008
 
2009
2007-11-25
2010
    * Improve error handling:
2011
      Internal functions PrintError() and DrawError() are now the same. Both
2012
      will draw the error message into the image and output it, and then
2013
      trigger a user-level error. If no error handler has been set, it will
2014
      exit, as before. But now the error message should also get logged, or
2015
      written to the standard error stream, depending on the SAPI in use.
2016
      You can now establish an error handler to catch most PHPlot errors and
2017
      do some cleanup before exit.
2018
 
2019
      This fix also covers bug #1823774 "Default Font Path and Error Message
2020
      Output".
2021
 
2022
      Fixed the return value of most PHPlot functions, to return False on
2023
      error, else True. Since uncaught errors are fatal anyway, this only
2024
      affects code with an error handler that returns, which is not
2025
      recommended and unsupported at this time. These changes are for
2026
      possible future error handling options.
2027
 
2028
2007-11-22
2029
    * Fix bug 1836528 "Insufficient checking of parameter values":
2030
      Rewrote CheckOption to correctly validate option choices.
2031
      (It previously accepted substrings and other incorrect values.)
2032
      PHPlot methods that use CheckOption now must be called with valid option
2033
      values. Empty strings are also no longer accepted.
2034
 
2035
2007-11-17 (lbayuk)
2036
    * Change to callbacks to support extra arguments.
2037
      The PHPlot class can now pass extra arguments to a callback function.
2038
      Callback functions now take the following form:
2039
          my_callback($img, $passthru_arg, ...)
2040
      Where '...' is zero or more additional arguments supplied by PHPlot to
2041
      the callback. Each implemented callback reason will define any
2042
      additional arguments it uses. The existing defined callbacks have not
2043
      changed and do not currently pass any extra arguments.
2044
 
2045
2007-11-10 (lbayuk)
2046
    * Fix bug 1827263 "Spoiled up pie-chart if $val is close to zero":
2047
      Skip pie slices which would result in an integer angle of zero
2048
      degrees, because the GD arc filling function will draw a complete
2049
      circle for that case.
2050
      Credit to Viacheslav <webdeveloper.ua at gmail.com> for finding this.
2051
 
2052
    * Removed 8 of the functions (class methods) marked 'deprecated'.  Only
2053
      deprecated functions which seem to have been for internal use have
2054
      been removed. Even old scripts shouldn't be using them, and they are
2055
      becoming a problem to maintain.
2056
      Removed: SetImageArea() DrawDotSeries() DrawLineSeries() CalcXHeights()
2057
      CalcYWidths() DrawLabels() InitImage() DrawDashedLine().
2058
 
2059
2007-10-20 (lbayuk)     ===== Released as 5.0.4 =====
2060
    * phplot.php: Updated copyright, version, and authors comments at top.
2061
    * README.txt: Updated for new release
2062
    * NEWS.txt: Add text for new release
2063
 
2064
2007-10-18 (lbayuk)
2065
    * Add callbacks - experimental feature:
2066
      New functions SetCallback, GetCallback, RemoveCallback.
2067
      New internal function DoCallback.
2068
      Added callback hooks to DrawGraph.
2069
 
2070
      Re-arranged code in DrawGraph to bring pie chart drawing into the main
2071
      switch on plot type, rather than a special case in its own block. This
2072
      makes it easier to follow and easier to add callback hooks.
2073
 
2074
    * Callbacks: New file, documentation for the new callbacks feature.
2075
      (This won't be in the manual while it is an experimental feature.)
2076
 
2077
2007-10-15 (lbayuk)
2078
    * Fix for bug 1813021: Miss-positioned right-justified vertical GD text.
2079
      Fixed DrawText() to correctly position 90 degree right-justified text
2080
      drawn in a fixed GD font. This could be seen with 90 degree Y tick
2081
      labels. (Found by accident while working on TrueType text problems.)
2082
      Also some code cleanup in DrawText: use elseif where appropriate.
2083
 
2084
2007-10-09 (lbayuk)
2085
    * Code cleanup: Simplify SetIndexColor() and SetIndexDarkColor().
2086
      There is no need to first try ImageColorExact, then ImageColorResolve
2087
      if that fails. ImageColorResolve does all that for us.
2088
 
2089
      Code cleanup: Rewrite SetRGBColor(). It now detects if an unrecognized
2090
      color name or color value form is used, and draws an error message.
2091
      Before this it would get a PHP index error and "headers already sent"
2092
      condition.
2093
 
2094
    * Code cleanup: Remove duplicated code for loading image files.
2095
      Added new class-private function GetImage() which loads an image based
2096
      on the image type, and also returns the image size. This replaces
2097
      duplicated code in tile_img() and SetInputFile().
2098
      Also fixed comment at top of SetImageFile which said it was deprecated.
2099
      It isn't - it is used by the constructor. Moved the function out of the
2100
      'deprecated' area up to below where it is used.
2101
 
2102
    * Code cleanup: PHPlot should not define or affect anything outside its
2103
      own class.
2104
      - Removed the check for __FUNCTION__ (PHP 4.3 and up). This is obsolete.
2105
      - Do not set error_reporting to E_ALL. Although it is recommended that
2106
      scripts do this, it is not the place of loaded classes to do it.
2107
      - Remove unused global constant TOTY.
2108
      - Removed constants MAXY and MINY. Global constants like this are bad.
2109
      These were used as magic index values into data[] to hold min and max Y
2110
      values for the row. Instead, put them in separate arrays which are
2111
      named data_miny[] and data_maxy[]. (This seems to be only used by the
2112
      data line drawing function.)
2113
 
2114
      Comment cleanup: Remove one commented-out partial function DrawPlotLabel,
2115
      and fix another commented-out code fragment in DrawYErrorBar. Both of
2116
      these had unmatched braces in them which caused a balance-braces check
2117
      to fail.
2118
 
2119
    * Code cleanup, array padding: Get rid of functions outside the class
2120
      and remove the interim fix for PHP 5 (which changed the behavior of
2121
      array_merge).  Rewrote external function array_pad_array() as a new
2122
      class function pad_array().  It does not need access to the class,
2123
      but I don't think PHPlot should add to the global namespace more
2124
      than necessary.  The third argument (array to use for padding) was
2125
      never used, so it was removed. It always pads the array with itself.
2126
      It now only works on 'usual integer indexed' arrays (0-based
2127
      sequential integer index). The was previously required but
2128
      undocumented for some of the arrays (like line_widths); now it is
2129
      required for all style arrays and will be documented. Now we can pad
2130
      the array to the required length, not just N times its previous
2131
      length, and we don't need array_merge.  Deleted external function
2132
      array_merge_php4() as it is no longer used.
2133
 
2134
      Deleted PHP end marker ?>. You don't need this and it can cause
2135
      problems with extra whitespace in your output.
2136
 
2137
2007-09-24 (lbayuk)
2138
    * Code cleanup: Fix ternary operator misuse.  This doesn't change
2139
      behavior, but it was annoying me so I fixed it.
2140
      Replaced all cases of code like this: $a = ($a > $b) ? $b : $a
2141
      With just: if ($a > $b) $a = $b
2142
 
2143
    * Fix Makefile 'release' target to set owner/group when creating
2144
      the tar file. This avoids having to run it as root, but it needs
2145
      GNU tar to work.
2146
 
2147
2007-09-08 (lbayuk)
2148
    * Fix for bug 1790441: Removed the PHPlot quasi-destructor function and
2149
      the register_shutdown_function() call which arranged for it to be used.
2150
      This was preventing release of memory when a PHPlot object was unset,
2151
      because the registered shutdown function held a reference to it.
2152
      So rather than improving memory use, it had the opposite effect.
2153
        Note: It is no longer necessary or recommended to use reference
2154
        assignment ($plot =& new PHPlot) for PHPlot object creation.
2155
      Thanks to annajilly for the thorough analysis, bug report, and fix.
2156
 
2157
2007-09-05 (lbayuk)
2158
    * Rewrote FormatLabel() to ignore blank label values. Adapted from a
2159
      patch and feature request submitted by Gerhard Reithofer (exgerhardr).
2160
      Blank labels used to produce an error if the LabelType was set to
2161
      'time', and zero if set to 'data'. Now they are just ignored. This
2162
      provides a simple way to have labels only at selected intervals when
2163
      using time or data formats. For example, you can have a date/time
2164
      label at every 10th data point by setting the labels for the other 9
2165
      to be empty strings. Also: Removed $which_pos values 'plotx' and
2166
      'ploty'.  These were unused by PHPlot and this is an internal-only
2167
      function so there is no compatibility issue. Removed error checking on
2168
      $which_pos for the same reason; the error message used an undefined
2169
      variable anyway so it wouldn't have worked.
2170
 
2171
2007-08-26 (lbayuk)
2172
    * Allow SetLegendStyle colorbox_align argument to be 'none', to suppress
2173
      the colorboxes in the legend.
2174
 
2175
      Fix comment on $legend_text_align: empty means right, not left.
2176
 
2177
      Rewrote DrawLegend layout code to make it easier to understand. The
2178
      result should be within 1 or 2 pixels of the previous size and position.
2179
 
2180
    * Fixes for bug 1779115: SetLegendWorld() fails on undefined vars
2181
      Store the given coordinates and remember that they need to be converted
2182
      from world to pixel coordinates, but defer trying to actually convert
2183
      them until it is time to draw the legend. This way, there are no
2184
      problems with the scale having to being set up first (which is nearly
2185
      impossible to do).  Made the following changes:
2186
 
2187
        Changed legend class variables to be uninitialized, and unset (rather
2188
        than empty string) means use the defaults. Added a new variable:
2189
        $legend_xy_world. If it is set, (legend_x_pos, legend_y_pos) need to
2190
        be converted to pixel coords. If it is unset, they are already pixel
2191
        coords (or undefined, meaning defaults).
2192
 
2193
        Changed usage of internal function DrawLegend(): removed all arguments.
2194
        X and Y were always the class variables anyway, and now it needs to
2195
        also use the new flag to tell it if X and Y are world or pixel coords.
2196
        The third argument was unused.
2197
 
2198
        Removed third, unused, default NULL argument from SetLegendPixels and
2199
        SetLegendWorld.
2200
 
2201
        Changes to DrawLegend to convert x, y coords to pixel coordinates
2202
        if they came from SetLegendWorld. Also account for new usage of
2203
        the class variables: Test for unset to mean use default.
2204
 
2205
2007-08-04 (lbayuk)
2206
    * New feature: control legend text and color box alignment.
2207
      Adds a new function SetLegendStyle to adjust the alignment of the
2208
      text and the color boxes inside the legend.
2209
      Based on part of bug 1208054, contributed by David Hernández Sanz.
2210
 
2211
2006-12-02 (lbayuk)
2212
    * Fixes for bug 1605555: Y Data Labels use wrong font and not formatted.
2213
      Use y_label_font (not x_label_font) for Y Data Labels.
2214
      Use the formatted value for the label, not the original text.
2215
      (This applies to bar charts only, with the new Y data labels.)
2216
 
2217
    * One fix for bug 1208054: Localization of number format.
2218
      If number formatting is enabled with 'data' format type, PHPlot previously
2219
      used dot for decimal point and comma for thousands separator, and there
2220
      was no way to change it.
2221
 
2222
      This fix adds a new function:
2223
               SetNumberFormat($decimal_point, $thousands_separator)
2224
      to set the separators.  In addition, if that function is not used,
2225
      PHPlot will now try to use locale-dependent separators. If locale
2226
      information is not available, it will fall back to the old defaults
2227
      of dot and comma.
2228
 
2229
      Note: This change may have some negative effects. 1) If your locale is
2230
      "C" or "Posix", you might not get a thousands separator now by default.
2231
      You should be using a more specific locale. 2) If your PHP script is
2232
      forcing a specific locale with setlocale(), PHPlot will probably undo
2233
      that because it uses setlocale(LC_ALL, '') to import locale information
2234
      from the environment.  We have to do that, or a locale set through
2235
      the environment is ignored. But it will override a manually set locale.
2236
 
2237
    * Fix for bug 937944: X/Y Tick Counts
2238
      PHPlot could draw one too few Y tick marks, and one too many X tick marks.
2239
 
2240
      Changed the code to stop drawing X (Y) tick marks when the current X (Y)
2241
      value exceeds the maximum X (Y) value plus a small fudge factor. The fudge
2242
      factor accounts for cumulative error when repeatedly adding a delta to
2243
      the X (Y) value.
2244
 
2245
      Notes: The bug report was writing about Y tick counts only, but X tick
2246
      counts can also be wrong. The proposed fix in the bug report does not
2247
      work in all cases.
2248
 
2249
      This fix changes the appearance of many plots which were missing the
2250
      top-most Y tick mark. The extra X-tick mark problem is less common.
2251
 
2252
===== Released as 5.0rc3 =====
2253
 
2254
2006-11-13 (lbayuk)
2255
    * Fix for bug 1437912: x-axis label misalignment [bar charts]
2256
      The calculations were redone from scratch.
2257
      New control variable 'bar_extra_space', which works in addition to
2258
      'group_frac_width' to control how much extra space is around the bars.
2259
      Made bar widths match for 'stackedbars' and 1-bar-per-group 'bars'.
2260
 
2261
      NOTE: This changes the appearance of charts. bars in 'stackedbars'
2262
      will now be thinner, and bars in 'bars' graphs will be thicker. I
2263
      saw no reason for them being different before.
2264
 
2265
      This fix required fixing the positioning on the new bar data labels,
2266
      which was off before.  The bar data labels will now be centered.
2267
      Additional fixes to bar chart data labels:
2268
         For negative values, the label will center under the bar.
2269
         Fixed X-adjustment to account for shading.
2270
         Fixed to not suppress the data label if the value is 0.
2271
 
2272
 
2273
2006-11-10 (lbayuk)
2274
    * Fix for bug 1594457: DrawError text wrap and background fix
2275
      Do error image white background correctly, and word-wrap the text.
2276
 
2277
    * Fix for bug 1594458: Suppress lines or points in 'linepoints'
2278
      Don't draw X data labels twice for 'linepoints'.
2279
      Allow SetPointShapes value 'none' to suppress points, and allow
2280
      SetLineStyles value 'none' to suppress lines. This allows a 'linepoints'
2281
      graph to mix lines only, points only, and both on the same graph.
2282
 
2283
 
2284
2006-11-09 (lbayuk)
2285
    * Fixes for bug 1446523:
2286
      + Wrong variable name in deprecated SetAxisFontSize()
2287
      + Fails to properly handle error if SetDataValues() was never
2288
        called, or not called with a data array.
2289
 
2290
    * Fix for bug 1117122: Pie Chart ignores SetPlotAreaPixels
2291
      Don't let DrawGraph recalculate the plot area for pie charts if the
2292
      user already set it with SetPlotAreaPixels.
2293
 
2294
      NOTE: This fix may slightly change the appearance of some pie charts,
2295
      whether or not they use SetPlotAreaPixels.
2296
 
2297
    * Fix for bug 1103992: Wrong max Y calculated for stackedbars
2298
      Changes FindDataLimits to calculate max Y correctly. It was counting
2299
      the first Y value in each record twice, which is always wrong but
2300
      only affected stackedbars because the Y values are summed.
2301
 
2302
    * Fix for bug 1096199: Wrong error bar colors in DrawDotsError.
2303
      Rewrites DrawDotsError to make it work like DrawLinesError to
2304
      correctly increment the record and color indexes.
2305
      Also fixes uninitialized x_now_pixels.
2306
 
2307
    * Fix for bug 1096197: No borders on unshaded Draw[Stacked]Bars
2308
      Unshaded Bars and StackedBars covered the border with the rectangle.
2309
      The fix is to draw the rectangle, then the border.
2310
 
2311
      NOTE: This fix changes chart appearance. Bars and Stacked Bars
2312
      will now get a black border around each bar by default, if you
2313
      turn off the 3D-shading. If you want borderless, unshaded bars
2314
      you need to use SetDataBorderColors to set the data border colors
2315
      to be the same as the data colors.
2316
 
2317
    * Fix for bug 1333164: Negative data values, if string variables, result
2318
      in unfilled bars. The problem was a string-to-string compare of a
2319
      negative number with the empty string x_axis_position. Fixed by
2320
      initializing x_axis_y_pixels to 0 if SetXAxisPosition was not used.
2321
 
2322
 
2323
2005-04-17 (afan)
2324
    * Fix for bug [ 1161072 ] SetInputFile warning, background overwrite
2325
 
2326
    * Bug 1182672 fixed
2327
 
2328
2005-04-15 (afan)
2329
    * fix for bug: [ 1182666 ] Y Auto-scale rounds in wrong direction
2330
 
2331
    * Fix for bugs 1144644 TrueType font path problems and 1106328 TTF
2332
      path/filename inconsistency
2333
 
2334
    * Fix Bug: [ 1117120 ] X Title sizing uses Y Title font height
2335
 
2336
2005-04-13 (afan)
2337
    * Error in SetLineStyles() - does not accept an array argument
2338
 
2339
 
2340
2005-03-29 (afan)
2341
    * Small typo fixed in SetYDataLabelPos
2342
 
2343
    * Update SetDataLabelPos: For past compatibility we accept plotleft,
2344
      ...but pass it to SetTickLabelPos
2345
 
2346
2005-03-26 (afan)
2347
    * Change to line 3802: data lables now work with multiple bars with *$idx
2348
 
2349
2005-03-25 (afan)
2350
    * Added Function DrawDataLabels to put data labels in world coords,
2351
      added call from DrawBars and modified SetYDataLabelPos to flag
2352
      whether or not to call DrawDataLabels.
2353
 
2354
2005-01-20 (migueldb)
2355
    * Many bugfixes reported and solved by L. J. Bayuk. Thanks!
2356
      + fixed bug #1096190
2357
      + FindDataLimits(): fixed bug #1096192
2358
      + CalcTranslation(): fixed bug #1101317
2359
      + DrawImageBorder(): fixed bug 1096200
2360
      + DrawXDataLabel(): fixed bug 1099879
2361
      + DrawDots(): fixed bug #1096194
2362
 
2363
===== Released as 5.0rc2 =====
2364
 
2365
2004-10-24 (migueldb)
2366
    * array_merge_php4(): added to cope with the bug introduced by
2367
        the change in array_merge() from PHP4 to PHP5 (I haven't verified this)
2368
    * Fixed some divisions by zero, thanks to an old bug report.
2369
 
2370
2004-09-09 (migueldb)
2371
    * SetPointSize(): deprecated
2372
    * SetPointSizes(): added as replacement for SetPointSize().
2373
      Now able to set point sizes on a per line basis.
2374
    * SetPointShape(): deprecated.
2375
    * SetPointShapes(): added as replacement for SetPointShape().
2376
      Now able to set point shape on a per line basis.
2377
    * DrawDot(): now needs record number to decide which dot shape and
2378
      size to draw.
2379
    * CalcMargins(): dirty fix for x data label placing.
2380
    * tile_img(): fixed tile placement.
2381
 
2382
2004-06-14 (migueldb)
2383
    * SetXTickLabelPos() and others: more on the bug reported by Jo Demol.
2384
    * Fixed bug reported by Jo Demol.
2385
 
2386
2004-05-11 (migueldb)
2387
    * SetBgImage(): added.
2388
    * SetPlotAreaBgImage(): added.
2389
    * SetInputFile(): deprecated.
2390
    * DrawBackground(): now accepts images as backgrounds.
2391
    * DrawPlotAreaBackground(): now accepts images as backgrounds.
2392
    * tile_img(): internal method added.
2393
 
2394
..........
2395
Editor's Note: For older changes to PHPlot, please see the CVS logs.