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

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Hi! I'd like to point you to a GPL thermometer image, alert you to a problem with a module mentioned in this thread, and mention how to do it easily in GD or (probably more quickly) with rsvg. (the image mentioned is available as both PNG and SVG).

First, I tried GD-Dashboard mentioned above many moons ago, on a bug that was 2 years old at the time. I decided instead to roll my own GD-based Gantt-like workflow scheduler and I was very happy with plain GD. So, if you want to try Dashboard note that CPAN says it fails to build and you may have to debug it.

I would say use plain GD, but I also found a neat SVG one.

First, with GD: First find a free thermometer graphic or draw your own. Then use Gimp or another drawing program to find the coordinates of the red rectangle you need to draw to fill the thermometer, and adjust its height based on the thermometer's value. Also make some space above the thermometer to display a big XXX% label (maybe at the top of the thermometer) and get the coordinates of that rectangle too. The rest is pretty straightforward.

As for the graphic and the SVG one I found, I googled for thermometer gpl image (also open clipart might work). Check out this page which provides a script that uses rsvg to rasterize an svg image into a png file. This looks pretty easy to perlize, if you are on linux and install rsvg. At the very least, you can use the png image they show here as a template for your own GD-based thermometer if you don't want to use svg. If you can't view SVG you can get one here at Adobe. It will install an ActiveX component that lets you see the other thermometer in that site’s svg chemistry set on this page though it is more chemistry and less PR style.

Here is something like what you need for the svg one for your info (untested but syntax checked) though if you already are using GD then maybe you just want to use the PNG file on the same page. It is nice and easy to read.

# Usage: perl thermoupdate.pl 12000 # in case you are at the 12000 mark. open(IN,"thermometer_tmpl.svg"); my $buf = <IN>; close(IN); my $amt = $ARGV[0]; my $height = 20000; $n = 10 * $amt/$height; # floating point 0-10 my ($min,$mid,$max) = ('$0','$10,000','$20,000'); $buf =~ s/height="10"/height="$n"/; $buf =~ s/Foo/$min/; $buf =~ s/Bar/$mid/; $buf =~ s/Baz/$max/; open(OUT,"thermo_live.svg"); print OUT $buf; close(OUT); system("rsvg-convert -o thermometer.png thermo_live.svg");

Anyway in the bash script provided replace sed with s/// in perl, and use the system command to run rsvg and it should be doable really in 5 minutes. This will let you easily make a web form or config file to painlessly update the thermometer perhaps automatically. Watch out for when you exceed the boiling point though!

Oh some more links found in some later google results, which you can bend to your purposes.. ugly gd thermometer from php, webthermometer is gpl and has a nice thermo. gif image you can use


In reply to Re: Seeking GD::Graph like goal-thermometer graph by mattr
in thread Seeking GD::Graph like goal-thermometer graph by hesco

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (3)
    As of 2014-08-31 08:21 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The best computer themed movie is:











      Results (294 votes), past polls