The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

GD::Graph::sparklines - plot "sparkline" graphs

SYNOPSIS

  use GD::Graph::sparklines;

  my $graph = GD::Graph::sparklines->new(100, 30);
  my $gd = $graph->plot( [[0,1,2,3], [16, 40, 35, 20]] );
  print $gd->png();

DESCRIPTION

GD::Graph::sparklines is a Perl module for creating sparklines using the GD::Graph infrastructure -- if you want a sparkline of your data, you can just replace

  use GD::Graph::lines;

with

  use GD::Graph::sparklines;

and it will "just work", assuming you've not used any esoteric options.

GD::Graph::sparklines was originally a simple wrapper around GD::Graph::lines but it turned out very difficult to get the graph sizing correct without subclassing and overriding methods.

(It's also very difficult to get ploticus to draw sparklines.)

OPTIONS

GD::Graph::sparklines adds a few options to the GD::Graph set.

y_min_clip, y_max_clip (no defaults)

If set, clips the graph to those values (overriding any minimum or maximum values in the data sets).

y_band_min, y_band_max (no defaults)

If set, plots a background "range" band between the two values.

traditional (default: set)

If set, forces the first colour to be light grey and plots a small red blob on the last value point.

If not, uses the standard GD::Graph colours (as set by dclrs) and doesn't plot the blob.

BUGS

Undoubtedly lots. In particular, the full power of GD::Graph isn't implemented and will probably go terribly wrong if attempted.

The graphs are generally ugly -- I tend to render them at 4x and use "| convert -scale 25%" to generate the final smoothed output. (GD's copyResampled method doesn't seem to work very well otherwise there'd be a resample option for generating anti-aliased graphs.)

Plotting more than one dataset on a sparkline will look ugly.

CREDITS

Edward Tufte for his chapter about sparklines in "Beautiful Evidence" Martien Verbruggen for GD::Graph George A. Fitch III for GD::Graph::boxplot which helped me a lot

AUTHOR

Copyright (c) 2004, Rob Partington <perl-ggs@frottage.org>

SEE ALSO

http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0001Eb&topic_id=1 http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0001OR&topic_id=1