Gene Boggs >
SVG-Graph-Kit >
SVG::Graph::Kit

Module Version: 0.0401
SVG::Graph::Kit - Simplified data plotting with SVG

version 0.0401

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; my $n; for my $dim (qw(x y z)) { for my $stat (qw(min max mean mode median range stdv percentile)) { $n = $stat eq 'percentile' ? 90 : undef; # Inspect the 90th percentile. printf "%s %s = %0.2f\n", $dim, $stat, $g->stat($dim, $stat, $n); } }

An `SVG::Graph::Kit`

object is an automated data plotter that is a subclass of `SVG::Graph`

.

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

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

Return a new `SVG::Graph::Kit`

instance.

Optional arguments:

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

Except for the `plot type`

, `axis => 0`

and `axis ticks`

, the `plot`

and `axis`

arguments are ordinary CSS, 'a la `SVG::Graph`

.

The `plot type`

is given in `SVG::Graph`

. `axis => 0`

turns off the rendering of the axis. The `axis ticks`

, `xticks`

and `yticks`

values represent the number of labeled tick marks displayed on a scaled graph axis.

$g->stat($dimension, $name); $g->stat('x', 'mean'); $g->stat('y', 'stdv'); $g->stat('z', 'percentile'); # etc.

This method is a direct call to the appropriate `SVG::Graph::Data`

"x-method" (i.e. min, max, mean, mode, median, range, stdv and percentile).

Allow 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.

Add an `SVG::Graph::polar`

chart?

The code in *t/**.

Gene Boggs <gene@cpan.org>

This software is copyright (c) 2013 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.

syntax highlighting: