oren.gozlan
04-19-2005, 10:34 AM
Hi .. i was looking for a way to draw charts and bars with perl and came accross: http://www.wdvl.com/Authoring/Languages/Perl/Weave/chart1-1.html
i'm trying to use this example:
1 use strict;
2 use GD::Graph::bars;
3
4 my @data = (
5 ["Jan-01","Feb-01","Mar-01", "Apr-01","May-01",
"Jun-01","Jul-01","Aug-01","Sep-01"],
6 [21,25,33,39,49,48,40,45,15]
7 );
8
9 my $graph = new GD::Graph::bars;
10
11 $graph->set(
12 x_label => 'Month',
13 y_label => 'Revenue ($1,000s)',
14 title => 'Monthly Online Sales for 2001',
15 bar_spacing => 10
16 )
17 or warn $graph->error;
18
19 $graph->plot(\@data) or die $graph->error;
20
21 open(GRAPH,">graph1.jpg") || die "Cannot open graph1.jpg: $!\n";
22 print GRAPH $graph->gd->jpeg(100);
but it seems that the jpeg output is illigal or incoerect ... do you guys have any idea ?
Oren
i'm trying to use this example:
1 use strict;
2 use GD::Graph::bars;
3
4 my @data = (
5 ["Jan-01","Feb-01","Mar-01", "Apr-01","May-01",
"Jun-01","Jul-01","Aug-01","Sep-01"],
6 [21,25,33,39,49,48,40,45,15]
7 );
8
9 my $graph = new GD::Graph::bars;
10
11 $graph->set(
12 x_label => 'Month',
13 y_label => 'Revenue ($1,000s)',
14 title => 'Monthly Online Sales for 2001',
15 bar_spacing => 10
16 )
17 or warn $graph->error;
18
19 $graph->plot(\@data) or die $graph->error;
20
21 open(GRAPH,">graph1.jpg") || die "Cannot open graph1.jpg: $!\n";
22 print GRAPH $graph->gd->jpeg(100);
but it seems that the jpeg output is illigal or incoerect ... do you guys have any idea ?
Oren