transiency has asked for the wisdom of the Perl Monks concerning the following question:
## Creates hash ##
my $time_ = localtime; my $date = ParseDate($time_); $date =~ s/://g; my $unix_date = UnixDate($date, @d_format); $unix_date =~ s/ //g; $ash_{date} = $unix_date; $ash_{temp} = gct();
my %cash = build_comp_hash(); push @aoh, { %cash }; graphable_arrays();
@xdata = (); @ydata = (); my($i, $datum); for $i (0 .. $#aoh){ for $datum (keys %{ $aoh[$i] }){ if($datum =~ m/date/){ push @xdata, $aoh[$i]{$datum}; } elsif($datum =~ m/temp/){ push @ydata, $aoh[$i]{$datum}; } else{} }
my @plot_title = ("CryoCooler Temperature Data", -5); if(!defined $gwidth){$gwidth = '700';} if(!defined $gheight){$gheight = '500';} $mw->destroy if Tk::Exists($mw); $mw = MainWindow->new; $mw -> title('Thoth -- Plot'); my $pw_plot = $mw->PlotPTk(-width=>$gwidth, -height=>$gheight, -xlabel +=> "Time", -ylabel=>"Temperature", -autoScaleY => "On +", -scale => "@scale_vals", -plotTitle => \@plot_title)->grid; my $ds = DataSet->new(-yData=>\@ydata, -xData=>\@xdata, -name=>"Cryoco +oler"); $pw_plot->plot(-dataSet=>$ds); MainLoop;
PS I can post the entirety of the code if need be, just didnt because its ~1000 lines.
-----------------------------------------
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems with graphing time vs data with Tk
by jwkrahn (Abbot) on Apr 16, 2009 at 00:34 UTC | |
by transiency (Sexton) on Apr 18, 2009 at 17:36 UTC | |
|
Re: Problems with graphing time vs data with Tk
by zentara (Cardinal) on Apr 16, 2009 at 12:38 UTC |