in reply to Help with GD::Graph
#!/usr/bin/perl use strict; use warnings; use GD::Graph::lines; my $data_ref = [ ['2004-01-08','2004-01-09','2004-01-10'], # X-values [ 15.9, 10.7, 15.8 ], # Y-value 1 [ 18,18,18 ], #Y-value 2 reference line [ 12,12,12 ], ]; my $graph = GD::Graph::lines->new(400, 300); $graph->set( transparent => '0', bgclr => 'lgray', boxclr => 'white', fgclr => 'white', x_label => 'Time', x_labels_vertical => 1, x_label_skip => 50, y_label => 'Price', title => 'Some simple graph', y_max_value => 20, y_tick_number => 1, y_label_skip => 2, long_ticks => 0, # make a grid of all the ticks ) or die $graph->error; my $gd_image = $graph->plot($data_ref) or die $graph->error; open(OUTPUT, ">$0.png") or die "Can't open $0.png: $!\n"; print OUTPUT $gd_image->png(); close(OUTPUT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help with GD::Graph
by jeiku (Acolyte) on May 12, 2006 at 04:47 UTC | |
by zentara (Cardinal) on May 12, 2006 at 12:03 UTC | |
by zentara (Cardinal) on May 12, 2006 at 14:54 UTC |