in reply to Re^2: Help with GD::Graph
in thread Help with GD::Graph

Try this. I will say, that you are going to run into a problem of having too many x values for the width of the graph, then you need to adjust this x_label_skip value to condense it. A Tk canvas would be a nice way to do this. You could plot every value on a scrolled canvas, and scroll to the current time(or time of interest). Of course if it's for the web, Tk won't help.
#!/usr/bin/perl use warnings; use GD::Graph::lines; use strict; my @time; my @temp; my @rad; while(my $line = <DATA>){ chomp $line; my ($celcius, $radiation, $time) = split(/ /, $line); push @temp, $celcius; push @rad, $radiation; push @time, $time; } my $graph_data = [ [@time], # X-values [@rad], # Y-value 1 [@temp], #Y-value 2 reference line ]; my $mygraph = GD::Graph::lines->new(600, 300); $mygraph->set( transparent => '0', bgclr => 'white', boxclr => 'lgray', fgclr => 'white', x_label => 'Time', y_label => 'Value', title => 'Temperature and Radiation', x_labels_vertical => 1, # x_label_skip => 1, # line_types => [1, 1], line_width => 2, dclrs => ['blue', 'green'], ) or warn $mygraph->error; $mygraph->set_legend_font(GD::gdLargeFont); $mygraph->set_legend('Radiation','Temperature'); my $myimage = $mygraph->plot($graph_data) or die $mygraph->error; open(GRAPH, ">$0.png"); print GRAPH $myimage->png; close(GRAPH); __END__ 36 85 13:37 36 86 13:38 37 85 13:39 37 86 13:40 38 85 13:41 38 86 13:42 38 85 13:43 39 86 13:44 39 85 13:45 39 88 13:46 39 88 13:47 39 88 13:48 39 88 13:49 39 88 13:50 39 88 13:51 38 87 13:52 38 85 13:53 38 86 13:54 38 85 13:55 38 86 13:56 38 85 13:57 38 86 13:58 37 85 13:59 37 86 14:00 37 85 14:01 37 86 14:02 37 85 14:03 37 86 14:04 37 85 14:05 36 86 14:06 36 85 14:07 36 86 14:08

I'm not really a human, but I play one on earth. flash japh