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

NAME

SVG::Graph::Kit - Simplified SVG data plotting

VERSION

version 0.0403

SYNOPSIS

  use SVG::Graph::Kit;

  my $data = [ [ 1,  2, 0 ],
               [ 2,  3, 1 ],
               [ 3,  5, 1 ],
               [ 4,  7, 2 ],
               [ 5, 11, 3 ],
               [ 6, 13, 5 ], ];

  my $g = SVG::Graph::Kit->new(data => $data);

  print $g->draw; # > plot.svg

DESCRIPTION

An SVG::Graph::Kit object is an automated data plotter that is a subclass of SVG::Graph (which unfortunately rotates the x-axis tick labels 90 degrees).

NAME

SVG::Graph::Kit - Data plotting with SVG

METHODS

new

  $g = SVG::Graph::Kit->new(data => \@LoL);
  $g = SVG::Graph::Kit->new(data => \@LoL, axis => 0);
  $g = SVG::Graph::Kit->new(
    data => \@LoL,
    axis => { xticks => 10, yticks => 20 },
  );
  $g = SVG::Graph::Kit->new(
    width  => 300,
    height => 300, margin => 20,
    data   => \@LoL,
    plot   => {
      type => 'line', # default: scatter
      'fill-opacity' => 0.5, # etc.
    },
    axis => {
      'stroke-width' => 2, # etc.
      ticks => scalar @$LoL,
    },
  );

Return a new SVG::Graph::Kit instance.

Arguments:

  data => Numeric vectors (the datapoints)
  plot => Chart type and data rendering properties
  axis => Axis rendering properties or 0 for off

axis => 0 turns off the rendering of the axis.

TO DO

Log scaling.

Position axis origin.

Call any Statistics::Descriptive method, not just those given by SVG::Graph.

Highlight data points or areas.

Draw grid lines.

Plot polar axes for polar plots.

SEE ALSO

The t/* tests.

SVG::Graph

AUTHOR

Gene Boggs <gene@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2022 by Gene Boggs.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.