Hey monks!
So i am working on this project to get temperature data from a device and graph it. That works great, i read the temperature from the device and stick it into a hash with the time, and put that all inside an array for every sample. I then graph the data using PlotPTk. Everything is peachy until the time rolls over to the next hour (eg sample 1 - 12:59:12, sample 2 - 01:00:12) i get a huge gap of 20090415130012 - 20090415125912 = 4100 in my graph. I'm using date::manip to create the time values.

## 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();

## Creates AOH ##
my %cash = build_comp_hash(); push @aoh, { %cash }; graphable_arrays();

## Creates arrays plotptk likes ##
@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{} }

##Creates plot##
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;

However, I'm beginning to think this is not the best way to handle time data. I could use seconds since epoch but thats horribly unreadable for the user, not that this way is much better. Any suggestions on handling time data in graphs?
Thank you for you time

PS I can post the entirety of the code if need be, just didnt because its ~1000 lines.

-----------------------------------------

foreach(@the_wicked){sleep(0);}

In reply to Problems with graphing time vs data with Tk by transiency

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.