Hello all:

I've been poking around for a couple of days looking for a module or script which would dynamically generate a goal-thermometer graph to support a fundraising effort.

I was hoping that GD::Graph might help, but so far, I haven't figured out how to turn its graphs into a thermometer shaped object.

The only thing I've found for this purpose so far is some php code on a Friends of Scouting site. But I'm hoping for a perl module, or script instead.

If anyone here has done this before and can share some sample code, or knows of something on CPAN designed for this job, I would certainly appreciate hearing about it. Failing that, I guess I can start porting the php code to perl, but I'd love to find the ready-made solution, instead.

Thanks,
-- Hugh

UPDATE:

Here is where I am at so far on this project:

package themometer; use strict; use warnings; use GD::Graph::bars; $GD::Graph::Error::Debug = '5'; my $g = GD::Graph::bars->new(80,180) or die GD::Graph->error; my @data = (['Your Contributions'],[55]); $g->set( y_label => 'Progress toward our Goal (%)', y_max_value => '100', y_tick_number => '10', y_label_skip => '2' ) or die $g->error; my $gd = $g->plot(\@data) or die $g->error; unlink 'fundraising_progress_graph.gif'; open(IMG, '>fundraising_progress_graph.gif') or die $!; binmode IMG; print IMG $gd->gif; close IMG; 1;
If it had a bulb filled with mercury at the bottom, this would fulfill my requirement for a thermometer graphic. As it is, this is getting pretty close. Can any of your GD fans advise me how best to add the bulb at the bottom of this image, please?

if( $lal && $lol ) { $life++; }

In reply to 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!
  • 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.