Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Real time data graphs.

by Koosemose (Pilgrim)
on Oct 08, 2006 at 03:31 UTC ( #576935=note: print w/ replies, xml ) Need Help??


in reply to Real time data graphs.

Just an idea for an alternate way to go about it. Consider having Tk::Canvas only show a finite time period, say the last hour for example, Continue to save the data points in an array, and at program completion use Image::Magick or some similar graphics generating package generate a graph containing the full graph.

Not certain if it would work for your particular task, just figured I'd offer another potential way to attack the problem, and it might help solve the problem RobPayne mentioned of only a limited amount of space to draw in.

Just Another Perl Alchemist


Comment on Re: Real time data graphs.
Re^2: Real time data graphs.
by enhering (Sexton) on Oct 09, 2006 at 12:56 UTC
    The idea is to show only the last n minute period of aquisition and n should be configurable by the user. With the resources available now, the best way to do this seems to be by working with as many Tk points as there are horizontal pixels in the graph and make a transformation on the data so that the data points are represented by Tk points.

    But this is makes things unnecessarily complex. The best would be to be able to use imager primitives directly on a canvas, in some way.

      While poking around in the Tk Docs, I noticed Tk::Photo can take a -data option, I was attempting to see if this could lead to a solution by using Imagemagick to generate an image in memory, and use it as the input for the -data option, and just update it via a configure, unfortunately I can't figure out how to get Imagemagick to output the image data in a compatible format (it's ImagetoBlob method doesn't seem to do it quite right) I'm not familiar with any image packages other than Imagemagick, but if you are this may be a valuable route to explore, as you will only have a single image to update.

      Also tried to do a simple writing an image with Imagemagick, as it seems fairly quick at it, and can draw primitives directly as you want. Eh, I'm a little to tired to try offering advice, can't even get my test script to function properly. If you're still having issues by tomorow I'll see if I can't beat Tk and Imagemagick into submission :)

      Happy Coding

      Just Another Perl Alchemist
        Nice info this -data parameter! I'll have a look at it. About Imagemagick, I have no experience with it, but by reading what you've written, it seems to be very similar to Imager. Anyway, it would be very nice to be able to write data in a binary format on Tk::Photo, instead of converting it to string format and deconverting again. Thanks for your help!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://576935]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2014-12-18 05:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (42 votes), past polls