##### build a cpu graph... $poop = 'CPU - Wait IO data from '.$startdate.' - '.$enddate; # a fancy title for our graph @data = (\@dateline, \@graphcpu_usr, \@graphcpu_sys, \@graphcpu_wio ); # this is an array of arrays. The first one is the X axis # which is the time, the others are the Y axis my $data = GD::Graph::Data->new() or die GD::Graph::Data->error; $data->copy_from(\@data); # this tells the graph to get the data from the data array my $my_graph = new GD::Graph::area(400,300); # and this says what type (area) and it's size $my_graph->set( # and set up all the particulars... r_margin => 1, x_label => 'Time', y_label => 'CPU Utilization', title => $poop, y_min_value => 0, y_tick_number => 8, y_label_skip => 1, x_ticks => 1, x_label_skip => $x_label_skip, x_labels_vertical => 1, x_label_position => 1/2, cumulate => 1, transparent => 1, )or warn $my_graph->error; open (IMG, ">dbcpu.png") or die "Can't open up the dpcpu graph file"; binmode IMG; $my_graph->set( dclrs => [ qw(lgreen lblue lred) ] ); # here is the colors in the graph $my_graph->set_legend("usr","sys","wio" ); # and the legend text $my_graph->set_title_font(GD::Font->MediumBold); print IMG $my_graph->plot($data)->png(); # and this plots the image out to a png format close IMG; #### $fr = $mw->Frame(-relief => 'groove', -borderwidth => 5)->pack( -side => 'left', -expand => 1 ); # the canvas has scroll bars and we sized the viewable part at 625x800 $canvas = $fr->Scrolled('Canvas', -height => 625, -width =>800,)->pack( -side => 'right', -expand => 1 ); # here we define the cpu graph and where we find it $dbcpu = $canvas->Photo(-format => 'png', -file => '/home/mjacobs/scripts/perl/dbcpu.png', -palette => '16/16/16'); # and this actually puts the image on the canvas $dbcpu_gr = $canvas->createImage(300,250, -image => $dbcpu, -tags => "dbcpu", -anchor => "center");