I'm guessing this is what you want, a 2 bar graph
#!perl use strict; use warnings; use GD::Graph::bars; my $tb2 = "Date Start Time End Time Egress Sent 08-15-2013 00:22:22 00:22:29 16.53 3.85 08-15-2013 01:22:22 01:22:28 17.05 3.6 08-15-2013 02:22:23 02:22:28 16.79 3.61 08-15-2013 03:22:24 03:23:27 103.89 37.29 08-15-2013 04:22:24 04:22:26 2.1 0.18 08-15-2013 11:22:25 11:25:11 73.72 60.98 08-15-2013 12:22:25 12:27:55 146.65 133.68"; my @records = split /\n/,$tb2; my $header = shift @records; my @graph=([],[],[]); for my $line (@records){ my @f = split /\s+/,$line; print join '|',@f,"\n"; push $graph[0],"$f[0] $f[1]"; push $graph[1],$f[3]; push $graph[2],$f[4]; } my $my_graph = GD::Graph::bars->new(600,450); print STDERR "Processing Graph\n"; $my_graph->set( x_label => 'Timestamp', x_labels_vertical => 1, y_label => 'Data Conveyed/Sent', title => 'Conveyed Vs. Sent', long_ticks => 1, y_max_value => 200, y_tick_number => 8, y_label_skip => 2, bar_spacing => 3, bargroup_spacing => 10, shadow_depth => 4, accent_treshold => 200, transparent => 0, ); $my_graph->set_legend('Conveyed', 'Sent'); my $gd = $my_graph->plot(\@graph); # save graph my $gif = 'file.gif'; open(IMG, '>',$gif) or die "Could not open $gif $!"; binmode IMG; print IMG $gd->gif; close IMG; print "$gif created\n";
poj

In reply to Re: Loading specific columns into arrays by poj
in thread Loading specific columns into arrays by sidsinha

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.