Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-03-19 11:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found