in reply to GD::Graph input file

Assuming your data files hold the values in the more natural 'lines of pairs' arrangement, something like this might work for you:

#!/usr/bin/perl use strict; use GD::Graph::bars3d; use Date::Calc qw(:all); use GD::Graph::Data; my ($d,$m,$y) = (localtime)[3,4,5]; my $mdy = sprintf '%02d-%02d-%02d', $d, $m+1, $y+1900; my $title="IPTV - Video Server Bandwidth Report del "."$mdy"; my @data; while( <DATA> ) { my @pair = split; push @{ $data[0] }, $pair[0]; push @{ $data[1] }, $pair[1]; } my $graph = new GD::Graph::bars3d( 1000, 500 ); $graph->set( x_label => 'Intervallo Orario', y_label => 'Traffico in Mbit/s', title => $title, x_labels_vertical => 1, x_label_position => 1/2, y_tick_number => 10, y_label_skip => 1, x_label_skip => 1, x_all_ticks => 1, x_labels_vertical => 1, box_axis => 0, y_long_ticks => 1, dclrs => [ qw(green) ], borderclrs => [ qw(black) ], #white,lgray,gray,dgray,black,lblue,blue,dblue,gold,lyellow,yellow,dye +llow,lgreen,green,dgreen,lred,red,dred,lpurple,purple,dpurple,lorange +,orange,pink,dpink,marine,cyan,lbrown,dbrown show_values => 1, values_vertical => 1, values_space => 15, bar_spacing => 10, ); my $gd = $graph->set_values_font(GD::gdGiantFont); my $gd = $graph->set_title_font(GD::gdGiantFont); my $gd = $graph->set_x_label_font(GD::gdGiantFont); my $gd = $graph->set_y_label_font(GD::gdGiantFont); my $gd = $graph->set_x_axis_font(GD::gdGiantFont); my $gd = $graph->set_y_axis_font(GD::gdGiantFont); my $gd = $graph->plot( \@data ); open(IMG, '>file.jpeg') or die $!; binmode IMG; print IMG $gd->jpeg; close IMG; __DATA__ 00:00 2585.54 01:00 Z095.44 02:00 1748.02 03:00 1454.55 04:00 1290.86 05:00 1235.33 06:00 1151.04 07:00 1160.86 08:00 1191.82 09:00 1343 10:00 1514.33 11:00 1693.67 12:00 1773.7 13:00 1897.82 14:00 2733.04 15:00 3257.12 16:00 3375.69 17:00 2949.53 18:00 2573.52 19:00 2139.65 20:00 1697.83 21:00 1989.94 22:00 2746.92 23:00 2998.7

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: GD::Graph input file
by lorenzob (Acolyte) on Jul 19, 2011 at 13:36 UTC

    Hi Browser, your example work perfectly.

    Many thanks