| 1 | #!/opt/Perl5.6.0/bin/perl -w -I. | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use SVGGraph; | ||
| 5 | |||
| 6 | my @a = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20); | ||
| 7 | my @b = (-5, 2, 1, 5, 8, 8, 9, 5, 4, 10, 2, 1, 5, 8, 8, 9, 5, 4, 10, 5); | ||
| 8 | my @c = (6, -4, 2, 1, 5, 8, 8, 9, 5, 4, 10, 2, 1, 5, 8, 8, 9, 5, 4, 10); | ||
| 9 | my @d = (1, 2, 3, 4, 9, 8, 7, 6, 5, 12, 30, 23, 12, 17, 13, 23, 12, 10, 20, 11); | ||
| 10 | my @e = (3, 1, 2, -3, -4, -9, -8, -7, 6, 5, 12, 30, 23, 12, 17, 13, 23, 12, 10, 20); | ||
| 11 | |||
| 12 | my $SVGGraph = new SVGGraph; | ||
| 13 | print "Content-type: image/svg-xml\n\n"; | ||
| 14 | print $SVGGraph->CreateGraph( { | ||
| 15 | 'graphtype' => 'spline', ### verticalbars or spline | ||
| 16 | 'imageheight' => 500, ### The total height of the whole svg image | ||
| 17 | 'barwidth' => 4, ### Width of the bar or dot in pixels | ||
| 18 | 'horiunitdistance' => 30, ### This is the distance in pixels between 1 x-unit | ||
| 19 | 'title' => 'Financial Results Q1 2002', | ||
| 20 | 'titlestyle' => 'font-size:24;fill:#FF0000;', | ||
| 21 | 'xlabel' => 'Week', | ||
| 22 | 'xlabelstyle' => 'font-size:32;fill:darkblue', | ||
| 23 | 'ylabel' => 'Revenue (x1000 USD)', | ||
| 24 | 'ylabelstyle' => 'font-size:16;fill:brown', | ||
| 25 | 'legendoffset' => '10, 10' ### In pixels from top left corner 'x, y' | ||
| 26 | }, | ||
| 27 | [\@a, \@b, 'Bananas', '#FF0000'], | ||
| 28 | [\@a, \@c, 'Apples', '#006699'], | ||
| 29 | [\@a, \@d, 'Strawberries', '#FF9933'], | ||
| 30 | [\@a, \@e, 'Melons', 'green'] | ||
| 31 | ); |